Introduction
The Generic API tool allows users to integrate external data sources and services into their analytics analyses in Savant. This tool provides a simplified interface for making API requests, enabling users to effortlessly retrieve and manipulate data from various APIs without the need for extensive coding. With support for both GET and POST methods, users can configure API calls by specifying the URL, headers, request body, and additional parameters.
Add a Generic API tool
1. Navigate to your Analysis.
Configuration
1. Add a Generic API tool to your Canvas.
2. URL - The URL is the endpoint of the API that you want to call. It is the base address where the API resides.
3. Method - The method refers to the type of HTTP request to be made to the API. The Generic API tool supports two methods:
GET: Use the GET method to retrieve data from the API.
POST: Use the POST method to send data to the API.
4. Headers - Headers are additional information passed along with the request. Click the +Add button to add Headers to your Generic API configuration.
Note: Reference data columns using double-brackets (e.g., {{Field}} ).
5. Use Rate Limiting (Optional Checkbox) - Rate limiting allows you to control the number of requests sent to the API within a specific time period. When using the "Use Rate Limiting" checkbox, you can set the following parameters:
Quota: The number of requests allowed within the defined period.
Period: The time period in which the allowed number of requests is applicable.
6. Use Pagination (Optional Checkbox) - Pagination is useful when an API response returns a large number of records that need to be split into smaller chunks. The "Use Pagination" checkbox helps you manage paginated responses. It provides the following options:
Offset & Limit: Use the offset and limit parameters to fetch a specific number of records starting from a particular offset.
Offset Parameter: The URL parameter for offset (page start). You normally only need either the offset or the page parameter, not both. Reference data columns using double-brackets (e.g., {{Field}} ).
Starting Offset: The offset value for the first page.
Page Parameter: The URL parameter for page (page number). You normally only need either the offset or the page parameter, not both. Reference data columns using double-brackets (e.g., {{Field}} ).
Starting Page: The page number of the first page.
Limit Parameter: The URL parameter for limit (page size). Reference data columns using double-brackets (e.g., {{Field}} ).
Page Size: Number of records in each page.
Next Page URL: The API might use an alternative method to define the next page URL in the response. You can extract the next page URL using a JSON path or specify the "Next Rel" value based on RFC 5988.
Note: Keep in mind that the tool currently supports either offset and limit or next page URL for pagination. Choose the appropriate method based on your API's pagination mechanism.
Using Postman for Testing
Postman is a popular tool for testing APIs. Before configuring the API in the Generic API tool, you can use Postman to test the API and ensure it returns the desired results. Follow these steps to configure the API:
Copy the API URL from Postman to the URL field in the Generic API tool.
Choose the appropriate method (GET or POST) based on your API requirements.
Add any necessary headers using the key-value pairs from Postman. You can also reference data columns using double brackets if needed.
If the API requires query parameters, add them to the Params field, and the parameters will be appended to the URL. You must include the parameters in the URL of the API call.
Set up rate limiting and pagination as needed using the corresponding checkboxes and parameters.
Remember, in build mode, the tool will limit the number of API calls to 10, so you can safely test the API without exceeding your API limits.