Skip to main content

RestAPI gem

Use the RestAPI gem to make API calls from your pipeline.

Use cases

While RestAPIs vary greatly in functionality, we can highlight a few use cases that may be particularly helpful for your pipelines.

Use caseExample
Bringing in more data from external systemsRetrieve active users from an internal user database.
Enriching data with specific APIsSend data to LLMs to analyze text and return the sentiments of a column.
Sending notifications or alertsSend real-time messages to a Slack channel when an event occurs in your pipeline.

Parameters

Configure the RestAPI gem using the following parameters.

ParameterDescription
URLThe endpoint of the API that you are making a request to.
MethodThe HTTP method used for the request to determine the action performed on the resource.
Example: GET, POST, PUT, DELETE
ParamsKey-value pairs that represent query parameters included in the request URL.
Usually used for filtering, sorting, or pagination.
Example: page:2 and limit:10.
BodyThe payload sent with POST, PUT, or PATCH requests containing the data to be processed by the API.
Typically in JSON format.
HeadersKey-value pairs that carry additional information about the request, such as credentials or content type.
You can use hard-coded values, configurations (pipeline parameters), or secrets.

You can populate these parameters with hard-coded values, or you can reference columns. If you use a column to dynamically populate the RestAPI, Prophecy will generate one API call per row in that column. For example, if you reference a column with 100 rows, this gem will make 100 API calls.

tip

To reference a column, use curly brackets.
For example, if your dataset has a column named AccountID, you can call an API like this:
https://api.company.com/users/{{AccountID}}