Skip to main content

Connect to GoREST with the REST Data Source

GoREST is a free REST API designed for testing API calls. It supports Bearer Token authentication, header-based pagination, request limits, and nested resources — making it a useful reference for learning how to configure each of these features in the Jet Analytics REST data source.

Prerequisites

Bearer Token authentication is optional for read-only access — data can be retrieved without a token. However, a token is required to use the request limits feature.

To generate a token, go to gorest.co.in/my-account/access-tokens and click New access token. Fill in the fields and click Submit. Copy the generated token for use in the data source configuration.

Configure the data source

Add a new Jet Analytics REST data source and set the Base URL to:

https://gorest.co.in/public/v2/

Expand the Authorization section, change the type from None to Bearer, and paste the access token.

[Insert image (GoREST_Bearer_Config) here]

Under Advanced > Request Limits, set the per-minute limit to match the token's rate limit. The default token allows 90 requests per minute.

Note:

Each main endpoint returns 10 records per page by default. After configuring pagination (see below), each endpoint may have 100 or more pages. To avoid long transfer times, run one endpoint at a time or set a Max number of pages limit.

Add the main endpoints

Add the following four endpoints. For each, set the Path as shown and enter the corresponding Name. No additional settings are required for the initial setup.

  • Path:usersName: Users
  • Path:postsName: Posts
  • Path:commentsName: Comments

    [Insert image (GoREST_Endpoint_Comments) here]

  • Path:todosName: Todos

Save the data source, synchronise the data source in the Ingest instance, and run the transfer task. A preview of any endpoint table should show the returned data.

Configure header-based pagination

GoREST uses header-based pagination. The response header for each paginated endpoint includes an x-links-next value containing the full URL for the next page.

In the Pagination section, click Enable and then Add next to Parameters. Configure the parameter:

  • Name:nextPage (or any descriptive name)
  • Value:x-links-next

Set Parameter action to Replace URL and set Replaced URL to {nextPage}.

Dynamic stop condition

Rather than setting a fixed Max number of pages, a dynamic stop condition detects when the last page has been reached. When caching is enabled, empty response files are written for pages beyond the last page — these look like this:

To stop pagination when there is no data, add a parameter in the Pagination section:

  • Name:stopCondition
  • Type: XPath
  • Value:(//id)[1]

This expression checks for the presence of an <id> node. If none is found, pagination stops.

With the stop condition set, execution terminates automatically when all pages have been retrieved.

Add dynamic endpoints

User posts

Returns the posts for each user. The path uses the id field from the Users endpoint.

  • Path:users/{id}/posts
  • Name: Users posts
  • Dynamic values source: From endpoint table
  • Select endpoint: Users
  • Select table: [Users_Tx_Root]

Save, synchronise, and run the transfer task.

Post comments

Returns the comments for each post. The path uses the id field from the Posts endpoint.

  • Path:posts/{id}/comments
  • Name: Posts comments
  • Dynamic values source: From endpoint table
  • Select endpoint: Posts
  • Select table: [Posts_Tx_Root]

Save, synchronise, and run the transfer task.

Note:

If no table appears in the results, enable Perform exhaustive metadata scan. If the first post returned by the Posts endpoint has no comments, the result set is empty and no table structure is generated. The exhaustive scan runs all endpoint calls before determining the table structure. Disable this option after running the scan, as it significantly increases execution time.

Was this article helpful?

We're sorry to hear that.