Integrations
Overview
This module helps to integrate external API with Appspotr Apps. This provides option to specify API endpoint and methods to call on that API for getting and putting data for different methods.
-
You can specify End point/Base URL for API to communicate with.
-
You can specify method(s) to call on API.
-
Perform Test to verify the settings.
-
Method can have Inputs and Outputs
-
Inputs are the parameters to pass in method.
-
Outputs are the results that can be pass to next view/method/dataset for further process.
-
We can specify Type, Headers and body in request.
-
Request Types
o GET
o POST
o PUT
o PATCH
o DELETE
-
Headers, Generally Authentication token can be pass in header. User can pass one or more header values as per requirement.
-
Body, You can pass different values needed to pass in request.
For example, data to pass for creating new entry in database.
Here API integration can be done in 2 steps.
Integration |
Basically integration identifies the API Base URL. What end point we need to call while calling different methods of the API. Example, https://www.facebook.com, |
Methods |
Under one API integration we can specify multiple methods. We can configure inputs and outputs of each method as well as for the view. |
Integration
It specifies the base URL for the API for calling it’s methods. You can also configure default payloads to specify in request object by default to attach for every method of an integration.
Create
-
There is new menu option under Data with “Integration”.
-
We can click “New”.
-
Name & Base URL are mandatory fields.
-
We can specify Headers and Local storage for integration.
Headers |
There is option to specify one or more Key-value as a default header to pass in request. |
Local Storage |
These are the key-value pairs can be used to store values in integration. For example, if an API needs new token in every method execution. In that case, we can keep token in local storage and update during every method execution. |
Methods
Once integration is added, now we can add methods to call on the API. Here, in this section we have flexibility to configure complete request object for calling method on API. to Select the integration by clicking on Integration record in list. You can add new method by clicking “New” - button on right top corner.
Add new
It has basically 2 sections
Right Section |
User have option to configure request object for method in terms of Headers, Type of request, Body content and URL. Also user can specify Inputs and outputs of the integration logic block. |
Left Section |
Used for verifying/display request configuration, response received and output parameter values. |
Below screenshot shows the new method configuration page.
Right Section
This section is design to collect information about the method and payloads to send request to API. Here user can configure header, body and method url for the request.
Method Name
Method URL (URL after Basic URL specified in integration, usually a method name)
Method Type (GET/POST/PUT/PATCH/DELETE)
Body
Inputs
Variable/parameter that we need to pass to method. We may use these parameters to append to URL, Body or Header to prepare request.
Name |
Type |
id |
String |
These inputs can be used to receive value from other view/integration.
Headers
Key-value pair for request object. We can use inputs to specify values in headers.
Example. Authorization: ${token}
Outputs
Out parameters can be specified, here we can form the output we need from the integration block. Same like outputs of normal view.
Name |
Response key |
Type |
fname |
result.0.first_name |
String |
Lname |
result.0.last_name |
String |
Storage
When request is executed, if we want to update the Local storage defined in integration, we can configure that here.
Input |
Response key |
Token |
_meta.token |
Left Section
To review Request, Response and Output details, it has a tabs for each.
Request
As we feed in the details in Right panel for preparing method, we can see update in request details updated. This tab will provide the detail about request object.
Response
Once Request is completed, we can hit the “Test” button to get the response.
It will display raw response object. That can be referenced to define output in right sections.
Output
When request is tested, as an output of integration we specify the value received in response. It displays the list of output specified and value map with response.