GET
The HTTP GET method requests a representation of the specified resource.
Requests using GET should only be used to request data (they shouldn't include data).
We already know how to make a basic GET Method from the API Example Page.
This Page explains How to make GET Method API with URL Path and Get a response from this API!
Add New GET Path (in APIs Page)
➡️ Add New GET Path (in Server Page).
As you know, we already made API and Server.
So, we just add a NEW PATH and add this in the Server in the API Autoflow
Follow the below steps!
We will make the below GET method with the URL path.
Then we will get a response "Oh! Your name is {name}" from this API.
1. Add New Path with URL Path
We already made Autoflow API and Autoflow Server.
So we will use this which we made.
Then just add new a Path with URL PATH!
1.1 Click the Add Path button and write your Path name!
First, we click the Add Path button.
Then we will write the path name with bracket {name}
.
In /my/{name}
, {name}
means that you can receive the path you want as the path of URL.
And we select the GET Method.
You can write the URL path Name whatever you want to write.
1.2 API page Overview
When you added a New path, We can see below the new Path.
GET/my/{name}
Also, you can make this path by OpenAPI schema on the rightside!
2. Add a New Path in the Server!
Let's Add a new path in the Server!
As you know, we already made a Server from the API Example Page.
2.1. Click Server Page, Then Click Server Operation!
Click the Server Page, then Click the Server Operation which we made it before!
2.2. Click Add API Operation, Then Click your new Path!
Click the Add API Operation, then Click your new PATH.
Now we can see the below screen.
The API has already been made and completed.
However, our goal is to send a response using the URL path value.
Now we can use GET /my/{name}
3. Get Response using Action and URL path by API.
We can already receive the URL path through the API.
Let's process this in Autoflow and send "Oh! Your name is {name}!" as a response.
To parse Data, we should add Autoflow Action.
3.1 Click the Add Action button
To add Action, we should click the Add Action Button.
3.2 Select Action.
We have lots of Actions in Autoflow.
On this page, we will use String Interpolate Action.
Select String
Then Select Interpolate
3.3 How to use String Interpolate Action.
3.3.1 Write message, and click the Add variable button
Write below the message ("Oh Your name is") which you want to get,
Then add the 'variable' button.
3.3.2 Add the Variable Name.
Write the variable name in the Key field.
3.3.3 Click String type
We want to use URL Path to respond. So we will this Variable as URL Path.
3.3.3 Change to Data type
Click Data Type.
3.3.4 Write Path Scope!
We can get URL Path by request > path > name
.
So write the path below.
3.3.5 Drag your variable!
Drag your variable in anywhere you want.
We are ready to get a Response 👏
4. Test GET Response
Now, we can get a response with URL Path.
GEThttp://localhost:8080/my/Eric
GET
http://localhost:8080/my/Autoflow