Checklist for connecting Accode to an external API

Updated 2023-04-28

A short guide/checklist on best practices around fetching data from an external system into Accode, and vice versa.

Fetching data into Accode

The preferred method of fetching data into Accode is a pull-based method, where Accode is the active party in the exchange. This means that a workflow in Accode polls data based on set intervals (usually once per hour or day, depending on the type of data), and logic can be built into the Accode workflow to retry API calls on failure or downtime. We have observed that this results in more robust integrations.

After the external system is selected, the following steps are usually taken:

  • Determine the API endpoint(s) for the external API
    • The API can be built using any technology: REST, GraphQL, WebSocket, SOAP, etc.
  • Authenticate the connection with the external API using the appropriate credentials
    • A simple API-key or token based system is sufficient, but more nuanced OAuth flows can also easily be implemented
    • It is important to get access to test credentials as early as possible, so that the data flow can be tested and validated quickly
  • Define the data mapping between the external API and Accode
    • The leading idea is to follow the external API data definitions as closely as possible
    • Supporting data may be simplified or flattened to make working with the data in workflows simpler
  • Implement a logic that triggers the data integration from Accode to the external API
    • A pull-based method can simply be run periodically, e.g. once per hour. This is often configured directly in the Accode workflow that handles the data fetching.

Example of a data fetching workflow:

Updating data to the external API

After data has been run through an Accode workflow, the changes to the data often need to be synchronized to either

  • The original external system that was the source of the data, or
  • Another external system or several external systems.

The most straightforward approach to accomplishing this in Accode is to either use one of the built-in actions that handle sending data (such as the @accode/http.fetch action) or to create a custom action for it. A custom action may be preferred if the external API requires many different HTTP calls or some additional logic to synchronize correctly. Many actions can be chained together to call multiple external systems.

The easiest way to update an external system is to utilize a HTTP endpoint with a POST or PUT request containing the updated data. If the endpoint is more granular and allows for partial updates, the request can be tailored to be more specific.

Previous
Fetch Slack messages to your Accode workspace