API Requests
With PushMetrics, you can make requests to any REST API endpoint.
It can be used to both receive data and send data to the API.
API results data can be used in subsequent tasks.
Creating API Requests
To compose an API request, you can make use the following input options:
Option | Description |
---|---|
HTTP Method |
This indicates the type of action you want to perform on the resource. The supported methods are:
|
Endpoint (URL) |
This is the URL where the API service can be accessed. Example:
|
Headers |
These provide meta-information about the request or the response. Common headers include:
|
Params (or Query Parameters) |
typically used with GET requests to filter, sort, or specify the data you're looking for. They are included in the URL after a Example:
|
Data (or Body) |
This contains information you want to send to the server. In a GET request, the data is typically sent as URL parameters. In POST or PUT requests, the data is sent in the request body. Example:
|
Further Resources
PushMetrics uses the python requests
library to execute requests server-side. Refer to the library's official documentation for more information:
Using Response Data
JSON
responses for API tasks.After execution of a request, the response will be displayed below the request.
You can reference this data in other tasks using the .data
method.
For example:
- Use
{{ api_call_1.data }}
to retrieve the entire response JSON - Use
{{ api_call_1.data.results[0] }}
to retrieve the first element of the results array in the example above.
Chaining Multiple Requests
If you want to create a reusable task that needs to perform a series of chained API requests (e.g. first a request to authentitcate, then the actual request to receive data), you can do this in PushMetrics using a Custom App integration.