Some APIs authorize calls and maintain session information by responding to a cookie request, which is sent back in a set-cookie response header. Cookie authentication is vulnerable to cross-site request forgery (CSRF) attacks and should be used with other security measures, such as CSRF tokens.
Before creating the connection, review your app’s API guide. It will provide the information you need, such as the kind of authentication that the app requires and its URI. Every app puts its documentation – guides and reference material – in different places. You can often find it by searching for “API guide” or “API documentation” on the company’s website.
Tip: Some companies put their documentation on third-party sites. If you can’t find the guide on their website, you can also try a web search.
- A. Set up a REST connection
- B. Provide general REST connection settings
- C. Edit application details
- D. Edit cookie-based auth settings
- E. Test and save the connection
Start establishing the universal, or generic, REST API connection in either of the following ways:
- Select Connections from the Resources menu.
- Next, click + Create connection at the top right. In the resulting Create source panel, select REST API from the Application list, under the Universal connectors group.
Name (required): Provide a clear and distinguishable name. Throughout integrator.io imports and exports, you will have the option to choose this new connection, and a unique identifier will prove helpful later when selecting among a list of connections that you’ve created.
Application (required, non-editable): A reminder of the app you’re editing.
Mode (required): Select one of the following options:
- Cloud to connect to a publicly accessible server application
- On-premise to connect to a server that is publicly inaccessible and has integrator.io agent installed on it
Agent (required, if On-premise selected for Mode; otherwise not displayed): Select an agent from the list. To connect to an on-premise application, integrator.io requires that an agent be installed on a networked computer. An agent is a small application that allows you to connect to data behind your firewall. When installing an agent, you will specify a unique access token, which then populates the Agent drop-down list. The installed agents connect to integrator.io and establish a reverse SSH tunnel, allowing secure communication without the need to whitelist integrator.io IP addresses in your firewall settings. A single agent can be used by multiple different connections.
Base URI (required): Enter the common part of the API’s URL to be used across all of the HTTP endpoints you invoke.
Configure HTTP headers (optional): In some rare cases, you may need to include custom HTTP headers with your API requests. integrator.io automatically adds the appropriate content-type header based on the mediaType value described in the connection associated with this request (typically application/json). Note that the request header value automatically includes the authentication method described in the associated connection if required. Use this header field in the rare case when an API requires additional headers other than application or JSON.
Media type (required): Specify the data format to use in the HTTP request body and HTTP response body.
Auth type (required): Select Cookie if your service implements cookie-based authentication strategy. (basic, custom, and token authentication are treated separately.) This authentication method adds Base64-encoded username and password values in the Authentication HTTP request header.
HTTP method (required): Select GET or POST, depending on the API requirements for making a request for the cookie.
Absolute URL (required): Enter the endpoint that integrator.io will use to make the cookie authorization request.
Override HTTP status code for success (optional): If the application returns any success status code other than 200, enter the expected value.
HTTP method (optional): Select the HTTP method to use when making the ping request.
Relative URI (required): Enter the relative URI to a specific resource, as documented in your app’s API guide. (The ping URI is relative to the base URI.) This field is required for testing the connection.
Path to success field in HTTP response body (optional): Provide the location of custom error codes, as documented in the error schema in your app’s API guide.
A success path is necessary only if your app returns errors outside of the standard 4xx and 5xx status codes. For example, Slack sets a field in the response body and returns a 200 HTTP status code, whether or not the ping HTTP request failed. In such cases, for the Ping success path value, you can specify the JSON path of a field in the response body that should instead be used to determine if a ping request succeeded. For example, if you are building a connection to the Slack API, set this field to ok (see Slack API docs for more info).
Success values (optional): Enter the values to test whether a connection succeeded. This optional field is used in conjunction with the Ping success path field. The value found in the HTTP response at the path provided is compared against this list of success values. If there is an exact case-sensitive match of any of the values, then the request is considered successful.
Click Test to try connecting before you save these values. If the connection fails, double-check the provided settings, and test again.