You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/resources/control-flow/backend-logic/api/create-test-api-calls.md
+47-38Lines changed: 47 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,26 +8,57 @@ sidebar_position: 2
8
8
9
9
# Create & Test API Call
10
10
11
-
On this page, you will learn how to [create](#creating-api-calls) and [test](#testing-api-calls) the API call.
11
+
In this guide, you'll learn how to create and test API calls in FlutterFlow. Integrating API calls allows your app to interact with external services, bringing in real-time data and functionality that enhances your app's capabilities.
12
12
13
-
## Creating API calls
13
+
## Create API Call
14
+
To use an API in your app, you first need to create the API call in FlutterFlow.
14
15
15
-
To use an API in your app, first, you have to create the API Call.
16
+
Simply select API Calls from the left navigation menu, click the **+ Add** button, and choose **Create API Call**. Enter an **API Call Name**, select the **Method Type** (GET, POST, DELETE, PUT, or PATCH), and input the API URL of the service you wish to access.
16
17
17
-
Follow the steps below to create an API Call:
18
+
<div style={{
19
+
position: 'relative',
20
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
The Method Type specifies the type of operation the API call will perform. Here’s a breakdown of common method types:
48
+
49
+
-**GET:** Retrieves data from the server.
50
+
-**POST:** Sends data to create or update a resource.
51
+
-**DELETE:** Removes a resource from the server.
52
+
-**PUT:** Updates or creates a resource with full data.
53
+
-**PATCH:** Partially updates a resource.
54
+
:::
18
55
19
-
1. Select **API Calls** from the left [Navigation Menu](../../../../intro/ff-ui/builder.md#navigation-menu).
20
-
2. Click on the **+ Add** button and select **Create API Call**.
21
-
3. Enter the **API Call Name**.
22
-
4. Select the **Method Type**: *GET, POST, DELETE, PUT, or PATCH*.
23
-
5. Enter the **API URL** of the service you want to access.
56
+
### Dynamic API URLs
24
57
25
-
:::note
26
58
If you want to use a dynamic URL, for example, `<https://reqres.in/api/users/2>` where 2 is dynamic and `<https://reqres.in/api/users?page=5>` where 5 is dynamic:
27
59
28
60
1. Replace the hard-coded value with a meaningful name inside the brackets (e.g., from `https://reqres.in/api/users/2`to `https://reqres.in/api/users/[user_id]`).
29
61
2. And then, [**create a new variable**](rest-api.md#creating-variables) with the same name you provided inside the brackets.
30
-
:::
31
62
32
63
The further instructions are based on the **Method Type** you selected.
Open the Action Flow Editor on the widget where the API call should be triggered. After selecting the desired Action Trigger, search for "API Calls" in the Actions dropdown and select the API call you want to use.
203
+
204
+

196
205
197
206
:::tip
198
207
You can also add the API Call as a [**Backend Query**](../backend-query/api-call-query.md) that gets triggered automatically when the page or widget is loaded on the screen.
0 commit comments