As with other data sources, Polytomic enables syncing from arbitrary HTTP APIs using a data model.
Polytomic supports the following when extracting data from HTTP APIs:
- GET and POST requests
- JSON responses
- Pagination ("next page" tokens or URIs; page size support)
- Extracting elements based on a JSONPath expression
- Custom HTTP headers/parameters
- In Polytomic, go to Connections → Add Connection → HTTP API.
- Fill in the config fields. Here is a brief explanation of the various fields:
- Base URL: the API's base URL. This can be a host (e.g. https://api.service.com) and can include a path if needed (e.g. https://service.com/api). To avoid having to revise your models, try to pick the shortest common path for your endpoints.
- Headers/Query String Parameters (optional): any parameter that you need to include on every request can be put here.
For example: a header containing your authorization key or token.
Constructing Authorization Headers
Many times, APIs will require that you create a "Basic" or "Username and Password" Authentication header. This is done by encoding a username and password (often one of these is an API Key) into a new value. We have a tool that you can use to help construct these headers if you're not familiar with Base64 encoding, or don't have an easy way to encode the information.
- Healthcheck endpoint (optional): a path that Polytomic will use to check if it can reach your API. Polytomic will periodically ping this endpoint with your included headers. A good option is a path that requires authentication. For example, many APIs supply a
/tokeninfothat you can use to make sure your authentication is working. Enter the path only (e.g.
- Click Save.
Updated about 1 month ago