REST - DATA SOURCE
Description
The REST Data Source allows for the integration of external RESTful APIs into your application, enabling the retrieval of data from various services over the internet. This method is particularly useful for accessing data that is not stored locally but is available through a RESTful API endpoint.
Config
REQUIRED
Config Parameters
name | description |
---|---|
url | The URL of the RESTful API endpoint. This is a required parameter. |
method | The HTTP method to use for the request (e.g., GET, POST). This is a required parameter. |
headers | An object containing any headers required by the API. This is optional but may be necessary for authentication or specifying content types. |
requestParams | An object containing any query parameters required by the API. This is optional and depends on the API's requirements. |
substitutions | An object containing values to be substituted into the URL or request parameters. This is optional and can be used for dynamic values. |
cascadeSub | The name of the substitution to cascade through multiple pages. This is optional and used for pagination. |
cascadeMax | The maximum number of pages to cascade through. This is optional and used in conjunction with cascadeSub . |
Config Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Inline Feed Source
A rest feed can also be using inline within a dataFeed
. This inline version uses the same parameters. The payload for each data point is accessed using Json list path operators. An example is given below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
Common Mistakes
- Incorrect URL: Ensure that the
url
parameter is correctly specified and points to a valid RESTful API endpoint. - Incorrect HTTP Method: Verify that the
method
parameter matches the API's requirements (e.g., GET, POST). - Missing Headers or Parameters: If the API requires specific headers or query parameters, ensure they are correctly specified in the
headers
andrequestParams
objects. - Incorrect Substitutions: If using substitutions, ensure that the
substitutions
object correctly maps to the placeholders in the URL or request parameters. - Cascade Configuration: If using cascading for pagination, ensure that
cascadeSub
andcascadeMax
are correctly configured to avoid excessive requests.