Searchโ€ฆ
Making API requests
An overview of HTTP request
To quickly connect a custom API use HTTP Request Builder. You can make GET request to visualizing orders data in Table component or POST request to reset a password for a specific user.
Watch the video below on how to get API Builder set up!
โ€‹

Open API Builder

You can open the API Builder directly from the component simply by selecting the Rest API resource. The API Builder will be opened automatically in case you do not create any collections yet, otherwise you will need to select Make HTTP Request from the list of collections for your Rest API resource:

Pass Values to API Builder

To pass Values to API Builder, such as charge you need to specify Inputs.

Visual Response Transformer

You can transform the data from the response with a Visual Response Transfomer:

JavaScript Response Transformer

If you need custom transformation you can use a JavaScript response transformer. Thedata is a JS variable that stores a response from your request. Javascript transformation:
For example, you can use JS functions to parse the data:
1
function getProperties(data) {
2
result = {};
3
for (var key in data) {
4
result[key] = data[key]['value'];
5
}
6
return result;
7
}
8
โ€‹
9
function contactMapper(contactData) {
10
result = getProperties(contactData['properties']);
11
result['dealId'] = contactData['dealId'];
12
return result;
13
}
14
return data['deals'].map((x)=>contactMapper(x));
Copied!

Sorting your data

You can sort all fields by ascending and descending value:

Pagination

APIs like to send data back in pages. By default, you only get 1 page. You will need to ask for more. In your API docs, there is probably a section called Pagination.
There are 3 types of pagination: page, offset, and cursor pagination.

Page based pagination

If you see the mention of a numerical page number that you increment to get each page, then you are in the right place.
Intercom uses this style of pagination. And it looks like this in their docs:
The first page from this endpoint would look like this: https://api.intercom.io/users?page=0
1
$ curl https://api.intercom.io/users?page=0 \
2
-H 'Authorization:Bearer <access_token>' \
3
-H 'Accept:application/json'
Copied!
In API Builder that would be set up with these settings:

Offset pagination

If you see the word offset in your API docs, this is the style for you. Hubspot uses this style. Their docs say:
Some endpoints support a way of paging the dataset, taking an offset and limit as query parameters:
1
https://api.hubapi.com/v1/deals/v1/deal/paged?offset=20&limit=20
2
โ€‹
Copied!
In this example, in a list of 20 (total) singles by the specified deal: from the twentieth (offset) deal, retrieve the next 10 (limit) deals.
In Jet API Builder that would be set up with these settings:
1
https://api.hubapi.com/v1/deals/v1/deal/paged?offset={{paging.offset}}&limit={{paging.limit}}
Copied!

Cursor based pagination

Sometimes APIs use something that looks weird for their pagination. Each call may return a cursor key to use to get the next page. Something like "nextPageCursor": "<cursor_key>" or ID as the next cursor (Stripe API) "next cursor" : data['data'][data['data'].length - 1].id
For instance, Stripe sends back a URL as well as a cursor (object ID) to use to get the next page. Their docs show this:
You can send this in two ways. Either use the cursor or use the full URL. If you use the cursor, you need to send it in a parameter.
For instance, Stripe API in Jet API Builder that would be set up with these settings:
1
https://api.stripe.com/v1/customers?limit={{paging.limit}}&starting_after={{paging.cursor_next}}&ending_before={{paging.cursor_prev}}
Copied!
Last modified 1mo ago