Skip to content

Commit ae0d11a

Browse files
committed
assets added, typos fixed, formating fixed.
1 parent b83d934 commit ae0d11a

20 files changed

+250
-157
lines changed

docs/troubleshooting/api/API Troubleshooting, Client-Server Errors during the API call.md

Lines changed: 0 additions & 78 deletions
This file was deleted.
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: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
keywords: ['api', 'error', 'client']
3+
slug: /api-troubleshooting-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 working with APIs, one of the most common hurdles developers face is understanding and resolving errors that occur during the interaction between a client and a server. Whether you're building, integrating, or consuming APIs, it's important to recognize what different error codes mean and how to fix them. These errors are typically categorized as client-side or server-side, each with its own set of HTTP status codes.
10+
11+
This guide will walk you through the most common client-server error codes encountered during API calls, explain what they mean, and offer practical tips for diagnosing and resolving them effectively. Whether you're a beginner trying to understand what a 404 error really means or an experienced developer dealing with elusive 5XX responses, this article will help you decode the problem and get your API calls back on track.
12+
13+
## Application Programming Interfaces (APIs)
14+
15+
APIs allow two programs to communicate and transfer data. An API call is when a client application submits a request to an API, which retrieves the requested data from an external server or program and delivers it back to the client.
16+
17+
---
18+
19+
## Error Status Codes When Building APIs
20+
21+
### 1. Client-Side Status Codes
22+
23+
- #### 404 Not Found
24+
This is the most common HTTP status code. It indicates that the URL used in your request doesn’t exist on the API server or origin server. While this is a 4XX error (usually meaning something on the client-side is wrong), it can also indicate a server problem. Sometimes API URL paths change after a version update, or due to server issues.
25+
26+
:::tip
27+
Check for typos in your client code before investigating API issues.
28+
:::
29+
30+
![404 Example](../assets/20250430121350517804.png)
31+
32+
- #### 401 Unauthorized
33+
This status code means you haven’t authenticated against the API. The API doesn’t know who you are and won’t serve you. For most APIs, you need to sign up and get an API key, which is used in an HTTP header field when sending a request.
34+
35+
This is similar to the less common **407 Proxy Authentication Required**, which means you haven’t authenticated with the proxy.
36+
37+
![401 Example](../assets/20250430121350799148.png)
38+
39+
- #### 403 Forbidden
40+
This status indicates you don’t have permission to request that URL. You’re authenticated, but your user or role isn’t permitted to make the API request. This can also occur if you use the wrong API key or try to access features not allowed by your subscription plan.
41+
42+
![403 Example](../assets/20250430121351077308.png)
43+
44+
- #### 400 Bad Request
45+
The *400 Bad Request* error is generic. It means your API request was not correctly formatted. If no additional error information is given in the response body, check the docs. You could be missing a query, a field in the request body, or a header field could be wrong. Incorrect syntax in your request data can also cause this.
46+
47+
This differs from the *422 Unprocessable Entity* error, which appears when your request is correctly formatted but cannot be processed. For example, passing a badly formatted `latlang` value to the API (e.g., missing a comma).
48+
49+
![400 Example](../assets/20250430121351345482.png)
50+
51+
- #### 429 Too Many Requests
52+
Most API subscription plans have limits—the cheaper the plan, the fewer requests per second are allowed for your API key. If you send too many requests in a short time, consider throttling them in your client. This response can also indicate you hit a daily, weekly, or monthly limit on your account.
53+
54+
:::tip
55+
Check your API subscription limits before integrating, or you may run into problems later.
56+
:::
57+
---
58+
59+
### 2. Server-Side Status Codes
60+
61+
Sometimes, server-side API errors occur. Here are common ones:
62+
63+
- #### 500 Internal Server Error
64+
This code can mean anything, but usually indicates the API server crashed. It could be caused by your API call or by buggy code/data from an upstream service. Double-check the docs for correct query fields, body fields, headers, and format. If the problem persists, contact the API’s support.
65+
66+
- #### 502 Bad Gateway
67+
This response means the server you called was a gateway or proxy, not the actual API server. The proxy tried to call the API server but didn’t get a response. This could be a network problem, server crash, or maintenance. Usually, this is temporary and should be solved by the API provider.
68+
69+
- #### 503 Service Unavailable
70+
This status indicates a server error—too many API requests were sent and the API can’t handle more. The problem usually resolves itself when clients send fewer requests, but it could also mean the API provider didn’t plan enough resources. If the error persists, contact the API provider.
71+
72+
- #### 504 Gateway Timeout
73+
Like 502, this means the server you called is a proxy for the real API server, but the API server took too long to respond. This could be due to high network latency or a slow API server. Try reducing the amount of data or complexity of your request. If the error persists, contact support.
74+
75+
- #### 501 Not Implemented
76+
This status code is related to the HTTP method you used. Try a different HTTP method. Usually, an inappropriate method results in a 404, but 501 means the method isn’t implemented yet and may be available in the future.
77+
78+
---
79+
80+
You’ll encounter many error codes when using APIs, but most have reasonable fixes. Some are server errors, some are client-side errors, and often one can cause the other.
81+
82+
83+
:::tip
84+
Always read the docs and API notes thoroughly. If things are broken, contact the API provider or search for answers on the web (e.g., StackOverflow). Stay determined, and you’ll see your 200 OK status codes in no time!
85+
:::
86+
87+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
keywords: ['api', 'call', 'outputs']
3+
slug: /fixing-incorrect-api-call-outputs-due-to-charset-and-encoding
4+
title: Fixing Incorrect API Call Outputs Due to Charset and Encoding
5+
---
6+
# Fixing Incorrect API Call Outputs Due to Charset and Encoding
7+
8+
API responses can vary based on factors like charset and encoding, occasionally leading to what may seem like incorrect outputs. This brief guide offers a solution to address and correct such issues.
9+
10+
## Solution for Accurate API Responses
11+
Ensure the API header is correctly set up by including the following elements:
12+
13+
`Content-Type: application/json`
14+
15+
`Charset: utf-8`
16+
17+
![](../assets/20250430121409119593.png)
18+
19+
You can also set up an API advanced settings whether to force the response to be decoded as UTF-8:​
20+
21+
![](../assets/20250430121409391507.png)
22+
23+
By verifying these settings, you can get more consistent and accurate outputs from your API calls.
24+
25+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
### Where to Put Your API Keys
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+
For example, you can hard-code the key directly into your API call header like this:​
19+
20+
```
21+
{ "Authorization": "Bearer YOUR_API_KEY_HERE" }
22+
```
23+
24+
Or directly within the API endpoint URL:​
25+
26+
```
27+
https://api.example.com/resource?api_key=YOUR_API_KEY_HERE
28+
```
29+
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.
30+
31+
### Verification
32+
33+
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.​
34+
35+
Example: Not Secure
36+
37+
![](../assets/20250430121157297846.png)
38+
39+
Example: More Secure
40+
41+
![](../assets/20250430121157601185.png)
42+
43+
44+
By adhering to these best practices, you can increase the safety of your API keys even while making private API calls. Remember, the goal is to keep all sensitive data, including API keys, away from the client side of the application to ensure optimal security.
45+
46+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
keywords: ['api', 'error', 'codes', 'understanding']
3+
slug: /understanding-and-troubleshooting-api-error-status-codes
4+
title: Understanding and Troubleshooting API Error Status Codes
5+
---
6+
# Understanding and Troubleshooting API Error Status Codes
7+
8+
9+
When integrating and utilizing Application Programming Interfaces (APIs), encountering error status codes is a common part of the development process. These errors can arise from a variety of issues, ranging from client-side mistakes to server-side problems. Understanding these errors and knowing how to troubleshoot them is crucial for developers. This article combines insights from two sources to provide a comprehensive overview of common API error status codes and troubleshooting steps.
10+
11+
## Client-Side Status Codes
12+
13+
- ### 400 Bad Request
14+
15+
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.
16+
17+
![](../assets/20250430121124107334.png)
18+
19+
- ### 401 Unauthorized:
20+
21+
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.
22+
23+
![](../assets/20250430121124391823.png)
24+
25+
- ### 403 Forbidden:
26+
27+
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.
28+
29+
![](../assets/20250430121124669111.png)
30+
31+
- ### 404 Not Found:
32+
33+
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.
34+
35+
![](../assets/20250430121124874853.png)
36+
37+
- ### 429 Too Many Requests:
38+
39+
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.
40+
41+
## Server-Side Status Codes
42+
43+
- ### 500 Internal Server Error:
44+
45+
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.
46+
47+
- ### 501 Not Implemented:
48+
49+
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.
50+
51+
- ### 502 Bad Gateway:
52+
53+
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.
54+
55+
- ### 503 Service Unavailable:
56+
57+
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.
58+
59+
- ### 504 Gateway Timeout
60+
61+
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.
62+
63+
## Troubleshooting Steps
64+
65+
### 1. Clear Browser Cache and Cookies:
66+
67+
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.
68+
69+
### 2. Verify the Requested URL:
70+
71+
Ensure the URL or endpoint is correct. Remember, domain names are case-sensitive.
72+
73+
### 3. Adjust Request Parameters:
74+
75+
For 400 errors, check if the file size is too large (for POST requests) or if there are any other incorrect parameters.
76+
77+
### 4. Consult API Documentation:
78+
79+
Always refer to the API's official documentation for specific requirements and troubleshooting tips.
80+
81+
### 5. Contact API Support:
82+
83+
If you continue to face issues, reaching out to the API's support team can provide further assistance and insights into resolving the problem.
84+
85+
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.
86+
87+
88+
89+
84.7 KB
Loading
122 KB
Loading
85 KB
Loading
64.8 KB
Loading

0 commit comments

Comments
 (0)