Skip to main content
?

Parameter

Parameters are one of the essential components of the HTTP protocol, which is an optional entity but can be used in combination for various purposes.


We already know how to make basic API from the API Example Page.
This Page explains How to use API Parameter with GET Example!

Goal

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 the NEW PATH and Add this in the Server in Autoflow
Follow the below steps!

note

We will make the below GET method with the URL Parameter.

GET /user/{user_info}
We will send below URL with parameter
Version Location
Then Getting a query result from Database user who is engineer and living in seoul.

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 {user_info} .
In /user/{user_info} , {user_info} means that you can receive data from URL Parameters
And we select the GET Method.

Version Location
tip

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

/user/{user_info}

Version Location
tip

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!

Version Location

2.2. Click Add API Operation, Then Click your new Path!​

Click the Add API Operation, then Click your new PATH.

Version Location

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.

Version Location
tip

Now we can use GET /user/{user_info}


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 getting a query result from database as a response. To parse Data, we should add Autoflow Action.

3.1 Click the Add Action button​

To add an action, we should click the Add Action button.

Version Location

3.2 Select Action.​

We have lots of Actions in Autoflow.
On this page, we will use Database Query Action.

Select Database

Version Location

Then Select Query

Version Location

3.3 How to use Database Query Action.​

info

This page's goal is getting a query in the database from the GET with parameters.
I will send GET with Request parameters.

3.3.1 Select your Client​

Select your Client which you connected.
I will connect 'MySQL' database.

tip

If you don't know how to connect Client, Click hereπŸ”—

Version Location

3.3.2 Write SELECT SQL in 'Query'​

Our goal is SELECT Query in Database from PUT URL Parameters.
Write SELECT QUERY and Select 'read' in Type.
I only wrote SELECT `name` FROM `account` WHERE job = AND city =;
Because I will put the values from GET URL Parameters.

Version Location

3.3.3 Add a Variable Name.​

Write the variable name in the Key field.

Version LocationVersion Location

3.3.4 Drag the Params to where you want to SELECT.​

Let's drag the 'job' and 'city' params to where you want to SELECT!

Version Location

3.3.5 Click String type in Params​

We want to use the GET URL Parameter.
So we will use this variable as one of the GET URL Parameter.

Version Location

3.3.6 Change to Data Type​

Click Data Type.

Version Location

3.3.7 Write Path Scope!​

We can get GET Request query parameter by request > query > city.
So write the path below.

Version Location

In the same way, job proceeds the same way.

Version Location

We can get GET URL Path by request > query > job .
So write path by below.

Version LocationVersion Location

3.3.8 We are ready to GET Request! πŸ‘β€‹

Version Location

4. Test GET Request and Response​

info

I will use POSTMAN to GET request with the URL parameter & Request Body.

Before starting my user database is as below.

idnamecityjob
1ericseoulengineer
2bobbyseoulengineer
3losseouldesigner
4bobnewyorkaccount
5ericmontreallawer

4.1 GET Request with URL Parameter.​

First, I will GET with URL Parameter.

GET

URL: http://localhost:8080/user/hello?job=engineer&city=seoul

Then I get the below response. Now we can see the URL Path user's data was updated in the MySQL database.

Version Location

Second, I will check the result using Action.

Then I got the below response. Now we can see the URL Path user's data was updated in the MySQL database.

Version Location

Also, If you click Simulation, you can see your data like below.

tip

You don't know how to use Simulation in Autoflow?
Then, Click here! πŸ”—

Version Location