Skip to content

Commit 705b362

Browse files
mrdavidorokDavid Edet OrokPoojaB26
authored
API Issues (#373)
* Add troubleshooting FAQ * Added API troubleshooting FAQ * proper spacing * Added more CodeMagic Deployment tips * assets added, typos fixed, formating fixed. * improved formatting and updated content. * Update docs/troubleshooting/api/client-server_errors_during_the_api_call.md Co-authored-by: Pooja Bhaumik <[email protected]> * Update docs/troubleshooting/api/client-server_errors_during_the_api_call.md Co-authored-by: Pooja Bhaumik <[email protected]> * Update docs/troubleshooting/api/client-server_errors_during_the_api_call.md Co-authored-by: Pooja Bhaumik <[email protected]> * two files merged into one, improved formatting. * improved formatting and bolded internal hyperlinks * fixed headers, added more details --------- Co-authored-by: David Edet Orok <[email protected]> Co-authored-by: Pooja Bhaumik <[email protected]>
1 parent 1f74e56 commit 705b362

16 files changed

+227
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "API"
3+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
keywords: ['api', 'encoding', 'charset']
3+
slug: /api-charset-and-encoding-fix-guide
4+
title: API Charset and Encoding Fix Guide
5+
---
6+
# API Charset and Encoding Fix Guide
7+
8+
When working with API calls in FlutterFlow, you might encounter issues where the response returns with strange characters, incorrect formatting, or unreadable content. These problems are often caused by improper charset or encoding settings either in the API request or the server response.
9+
10+
This guide shows you how to resolve such issues and ensure your API outputs are correctly displayed in your FlutterFlow project.
11+
12+
Follow the steps below:
13+
14+
1. **Set Proper Request Headers**
15+
16+
Make sure your API call includes the appropriate headers to instruct the server on how to format the response. Add the following headers to your API configuration:
17+
18+
- `Content-Type: application/json`
19+
20+
- `Charset: utf-8`
21+
22+
23+
These headers tell the server to return the data in JSON format using UTF-8 encoding, which is compatible with FlutterFlow.
24+
25+
![Setting Content-Type and Charset headers](../assets/20250430121409119593.png)
26+
27+
2. **Enable UTF-8 Decoding in FlutterFlow**
28+
29+
If the server does not specify encoding—or if you're still getting corrupted text—you can configure FlutterFlow to decode the API response as UTF-8 manually.
30+
31+
To do this:
32+
33+
1. Go to your API call setup in FlutterFlow.
34+
2. Scroll to **Advanced Settings**.
35+
3. Enable **Force response decoding as UTF-8**.
36+
37+
This setting helps FlutterFlow correctly interpret the API response, especially from servers that don’t return standard headers.
38+
39+
![Force decode response as UTF-8](../assets/20250430121409391507.png)
40+
41+
42+
:::tip[Final Tips]
43+
- Always test your API calls in FlutterFlow’s API Test tab to ensure the response is properly formatted.
44+
- Confirm that the external API supports UTF-8 and returns a valid JSON response.
45+
- Review your server settings if you control the backend, to ensure it sends the correct headers.
46+
:::
47+
48+
:::note
49+
Incorrect API call outputs due to charset or encoding can be quickly resolved by:
50+
- Adding proper headers like `Content-Type: application/json` and `Charset: utf-8`.
51+
- Enabling **Force response decoding as UTF-8** in FlutterFlow’s API advanced settings.
52+
These simple steps will help you get accurate and readable data from your APIs, resulting in a smoother app development experience.
53+
:::
54+
55+
If you still face challenges, don't hesitate to reach out to our support team through Live chat or by emailing [email protected]
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
keywords: ['api', 'error', 'client']
3+
slug: /client-server-errors-during-the-api-call
4+
title: Client-Server Errors during the API call
5+
---
6+
# Client-Server Errors During the API Call
7+
8+
9+
When calling an API in FlutterFlow, you may run into client-server errors. These typically come as status codes that indicate what went wrong, either on your end (the client) or on the server you're requesting data from.
10+
11+
This guide will help you understand the most common API error codes and how to fix them.
12+
13+
To learn more about APIs, check out our **[API documentation guide](/resources/backend-logic/rest-api/)**.
14+
15+
## Common Client-Side Status Codes
16+
17+
These errors are usually caused by incorrect requests from the client side.
18+
19+
- **400 – Bad Request**
20+
21+
The 400 error is a generic response indicating that the server could not understand the request due to malformed syntax. Common causes include incorrect query parameters or missing fields in the request body. Ensure your request is correctly formatted and all required information is included.
22+
23+
:::tip
24+
Check the API's own documentation to ensure you're including the correct fields and headers.
25+
:::
26+
27+
![400 Example](../assets/20250430121351345482.png)
28+
29+
- **401 – Unauthorized**
30+
31+
This status code appears when authentication has not yet been provided. To resolve this, ensure you have signed up for the API and included your API key in the HTTP header of your request.
32+
33+
![401 Example](../assets/20250430121350799148.png)
34+
35+
- **403 – Forbidden**
36+
37+
Receiving a 403 error means you're authenticated but do not have permission to access the requested resource. This could be due to using the wrong API key or attempting to access features not available in your subscription plan.
38+
39+
![403 Example](../assets/20250430121351077308.png)
40+
41+
- **404 – Not Found**
42+
43+
The 404 error indicates that the requested URL does not exist on the server. This could be due to a typo in the URL or changes in the API endpoints. Always verify the URL and check for any recent API updates.
44+
45+
:::tip
46+
Always double-check your request URL before troubleshooting further.
47+
:::
48+
49+
![404 Example](../assets/20250430121350517804.png)
50+
51+
- **407 – Proxy Authentication Required**
52+
53+
You haven't authenticated with the proxy server. This is less common but can happen in restricted network environments.
54+
55+
- **422 – Unprocessable Entity**
56+
57+
Your request was well-formed but couldn’t be processed. For example, passing a `latlng` without a comma.
58+
59+
- **429 – Too Many Requests**
60+
61+
This error occurs when too many requests are sent in a short period, exceeding the API's rate limits. To avoid this, implement request throttling or review your API subscription plan to ensure it meets your needs.
62+
63+
:::tip
64+
Check your API plan limits and consider throttling requests from your app.
65+
:::
66+
67+
## Common Server-Side Status Codes
68+
69+
These errors occur on the API server side.
70+
71+
- **500 – Internal Server Error**
72+
73+
A 500 error can occur for various reasons, often indicating that the API server has crashed. Check your request for accuracy and consult the API documentation for any known issues.
74+
75+
- **501 – Not Implemented**
76+
77+
This error occurs when the HTTP method used in the request is not supported by the server. Trying a different HTTP method or checking the API documentation for supported methods can resolve this issue.
78+
79+
- **502 – Bad Gateway**
80+
81+
This error means that the server, acting as a gateway or proxy, received an invalid response from the upstream server. It's usually a temporary issue that should be resolved by the API provider.
82+
83+
- **503 – Service Unavailable**
84+
85+
The 503 status code indicates that the server is temporarily unable to handle the request due to overload or maintenance. Waiting before sending another request is often the best approach.
86+
87+
- **504 – Gateway Timeout**
88+
89+
A 504 error suggests that the server, acting as a gateway, did not receive a timely response from the upstream server. This could be due to network latency or the API server processing the request too slowly.
90+
91+
92+
**Troubleshooting Steps**
93+
94+
- **Clear Browser Cache and Cookies**
95+
96+
If you're encountering a 400 Bad Request error, clearing your browser's cache and cookies can resolve issues related to expired or invalid data.
97+
98+
- **Verify the Requested URL**
99+
100+
Ensure the URL or endpoint is correct. Remember, domain names are case-sensitive.
101+
102+
- **Adjust Request Parameters**
103+
104+
For 400 errors, check if the file size is too large (for POST requests) or if there are any other incorrect parameters.
105+
106+
- **Consult API Documentation**
107+
108+
Always refer to the API's official documentation for specific requirements and troubleshooting tips.
109+
110+
- **Contact API Support**
111+
112+
If you continue to face issues, reaching out to the API's support team can provide further assistance and insights into resolving the problem.
113+
114+
Understanding these common API error status codes and their solutions can significantly smooth the development process, ensuring more efficient and effective communication between your application and the APIs you rely on.
115+
116+
:::tip[Final tips]
117+
- Always check the API's own documentation, inspect your request, and look up error messages. If the issue persists, contact the API provider.
118+
- Once you fix the issue, your calls should return a `200 OK`, which means everything is working as expected!
119+
:::
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
keywords: ['api', 'calls', 'private']
3+
slug: /securing-your-api-keys-in-private-api-calls
4+
title: Securing Your API Keys in Private API Calls
5+
---
6+
# Securing Your API Keys in Private API Calls
7+
8+
9+
Ensuring the security of API keys is a critical aspect of building and maintaining a safe and reliable application. In the realm of private API calls, it's especially important to make sure your API keys are not exposed. This article aims to provide a best-practices guide on where to place your API keys to increase security in a FlutterFlow environment.​
10+
11+
**The Misconception: Private API Calls Secure Everything**
12+
13+
Many users assume that simply marking an API call as 'private' is enough to protect all associated data. However, this is not the case. Private API calls run in a Cloud Function, which means any keys or sensitive data in the body will be secure, as long as they're not passed in from the frontend. Even in private API calls, if you're loading an API key from the frontend (like from Firebase remote configs), then you're still exposing it.​
14+
15+
## Secure Placement of API Keys in Your Project
16+
17+
The ideal way to secure an API key is to include it in a request header or directly within the API endpoint URL. This ensures that it is never passed in from the client, thereby maintaining its confidentiality.​
18+
19+
For example, you can hard-code the key directly into your API call header like this:​
20+
21+
```js
22+
{ "Authorization": "Bearer YOUR_API_KEY_HERE" }
23+
```
24+
25+
Or directly within the API endpoint URL:​
26+
27+
```js
28+
https://api.example.com/resource?api_key=YOUR_API_KEY_HERE
29+
```
30+
The key should never be a variable that gets passed in from the frontend, as that would make it accessible via the client-side code, defeating the purpose of using private API calls for secure operations.
31+
32+
## Verifying the Security of Your API Key
33+
34+
After implementing these changes, a straightforward way to verify that your key is secured is by downloading your application code and checking to make sure the API key doesn’t appear in any frontend files.​
35+
36+
Example: Not Secure
37+
38+
![](../assets/20250430121157297846.png)
39+
40+
Example: More Secure
41+
42+
![](../assets/20250430121157601185.png)
43+
44+
45+
By adhering to these best practices, you can increase the safety of your API keys even while making private API calls.
46+
47+
:::info
48+
The goal is to keep all sensitive data, including API keys, away from the client side of the application to ensure optimal security.
49+
:::
50+
84.7 KB
Loading
122 KB
Loading
85 KB
Loading
64.8 KB
Loading
312 KB
Loading
191 KB
Loading

0 commit comments

Comments
 (0)