Rest
Last updated
Last updated
Unlike the API task, this task instead of providing an Endpoint for other systems to use Gaio, it allows Gaio to connect to external APIs.
To use it, the analyst must know how to use the API to which Gaio will connect. Systems that provide connection via API have the standard of providing documentation.
A table is required to use the Rest task. It will provide, for example, the CPF column that will allow you to return data from an external system of those CPFs present in the source table. If no data is required to be sent to the API, it is still necessary to have a reference table, which may not provide data. However, it is important that for each row of the table, Gaio will make a call to the provided endpoint.
Gaio only interprets JSON when returning from the API.
The first step is to click on the table, go to the Tasks menu and click on Rest.
Type of request : Gaio allows connections to endpoints using GET or POST.
Endpoint : Enter the target API endpoint. At this address it is possible to pass columns from the source table, such as https://www.receitaws.com.br/v1/cnpj/ {{cnpj}} . In this case, cnpj is a column from the source table. Their values will be passed to the queried API and the return will be written to a Gaio table.
Maximum request time : if 0 is entered, Gaio will wait for the API to return for an unlimited time. At this point the time is recorded in milliseconds (1000 = 1 second).
Properties and Values : Define the headers sent during the API request. Ex: Bearer, Authorization, Accept among others.
Various settings can be adjusted to work with the API data return.
Define the name of the table that will store the return.
Choose between identifying return columns automatically or manually.
Automatic : The task will identify the name, quantity and type (data type) of the columns within the list or the API return object. If desired, inform Gaio of the property/endpoint where the name/data types are located. If the response is a JSON OBJECT, one line will be inserted into this table, but if the response is a LIST/ARRAY in JSON, one line will be inserted per item in this list.
Manual : It is necessary to define the fields that will be captured from the API response. If the response is a JSON OBJECT, one line will be inserted into this table but if the response is a LIST/ARRAY in JSON, one line will be inserted per item in this list.
Source table data : it may be desired to take some fields from the source table to the destination table, such as a queried customer code.
Delete table before inserting data : it is possible to accumulate the returned data in the destination table or delete it whenever the process is executed. Two fields will be added to the created table: gaio_id which refers to a unique numeric value and gaio_created_at which refers to the date-time of insertion of the row into the table
Property of the object where the results are located: if the returned JSON has an object with a hierarchy within it, it is possible to return this hierarchy and build a new table, using this option. The way to call is for example result.data .
Define the name of the log table, which will always start with log_ and from this point on can be customized by the analyst.