API
OpenAPI modelβ
An API in API AutoFlow is simply an OpenAPI model. You donβt need to be an expert in OpenAPI. API AutoFlow provides an easy-to-use graphic-based API builder.
A Server is configured to perform what is defined in the API.
Read more about OpenAPI specifications (previously Swagger)
The API is used by many features in the API AutoFlow. But, it always plays the same role as an API describing the format for REST APIs and validating the API calls.
When used to receive API callsβ
The OpenAPI is used to determine how to receive the API calls.
For example, the server you create will have various endpoints and parameters. You would first define that in the OpenAPI and then create a server for each of the endpoint operations.
When used to make API callsβ
The OpenAPI is used to make API calls.
For example, Google published OpenAPI for their cloud services. API AutoFlow provides a convenient way to upload the OpenAPI doc and automatically populate the API call parameters.
π‘ At a high level, you can understand that OpenAPIs are used both for external and internal API calls.
Configuring the APIβ
Create a new APIβ
Create an ID for the API or Upload OpenAPI documentβ
π‘ For this example, we will be using the API AutoFlow provided OpenAPI builder. However, you can use your own OpenAPI document using the upload feature.
Enter the API title and description
Create a Pathβ
Go to the newly created test API and create a new path, choose a proper name for the path. The path you create will be /hello
Add a fieldβ
Field refers to the API method. As shown in the picture above, the chosen field for this API is a GET method.
How to use an APIβ
in a Serverβ
a. Create a Server.
Link to Server Guide
b. Go to the newly created hello_world_server and press the edit button
c. Press the Link API button and select the hello_world_api. Change the port number to 1234
π‘ The server instantly gets hosted on the new port number.
d. Add the API operation Now that you have lined the server with the API, you can start creating the operations for each of the paths.
in a Serviceβ
Create a Service.
Link to the Service guide
In the example below, we have created
- Input with argument username accepting only a string
- Output with argument name_filtered responding as a string
a. Add a new Action
c. Select the API Operations Action
d. Click the Choose an API Operation button and select the path
e. The parameters will auto-populate based on the information in the OpenAPI. But you can always overwrite the information.
π‘ Note that the result of the API call will get stored in a variable called output. Click the button labeled [variable output] to change where you would like to store the data.