Using the HTTP connector you can connect to REST APIs.  The HTTP connector provides the ability to pass in headers for authentication, the body for POST body, and HTTP query string parameters.

You can read JSON data into tables for processing with SELECT statements and JOIN against other tables.

Security Mechanisms

Key-based Security

Add your key to the header property.

OAuth-based Security

You can use multi-step authentication processes using a combination of HTTP connectors, the executionContext container, and the REFRESH statement.

  1. Connectors
    1. Create an HTTPReader connector containing your API key/ secret in the header
    2. Create an HTTPReader/Writer connector containing the access token returned by step #2 in the executionContext Jinja script in the header.
  2. Statements
    1. Select the response from the HTTPReader connector.
    2. Insert the response into the executionContent table.
    3. Refresh the connector in step 1.b .
    4. Select the response from the connector.

Other types of security

Contact support@lingk.io if you have other security protocol needs.

Pagination

The HTTPReader connector does not natively support pagination. Native connectors, like Salesforce, handle pagination automatically for you. 

Contact support@lingk.io if you have specific pagination needs.

Storing Environment Information

To utilize the environment capabilities of Lingk, store your credentials in a properties file (CSV ideally) in the local file connector and read them as the first statement of recipe execution.

Handling Multiple API Calls on a Single REST Resource

Using the parameterizedBy property on the connect, a recipe a execute multiple API calls based on a dynamic dataset created in a prior statement. The parameterizedBy property will defer the processing of the connector until a REFRESH statement is executed after the input table of data is ready.

Processing JSON results

Simple JSON Array

If you have a simple response containing a base array, you can immediately process the response.

[ {"a":"b"}, {"a":"c"} ]

Nested JSON Array

If you have a complex JSON response containing a base array with nested datasets, you can use the explode and inline functions to pull the data into separate tables. Then use the JOIN statement to bring the data into other operations.

{ "items": [{"a":"b"}, {"a":"c"}] }

Debugging

It can be helpful to make a text formatter and output the results of the API call as text if the results are not JSON.