alerts.beta
Background - API1Created with Sketch.

Pagination

On the Hotmart platform, we can find some resources collections. Collections of users, subscriptions, products, among many others. These collections can also be called lists.

The Hotmart API has endpoints that give access to some of these lists of elements that in some cases can become very large.

Imagine an endpoint that returns all sales from the previous year, for example. That would be a lot, right?

With improving the experience in mind, we've uses a pagination structure, using the cursor pagination approach.

Request parameters

  • max_resultsinteger

    The maximum number of items per page that can be returned.

  • page_tokenstring

    The cursor used in pagination. It is a reference to the part you want to go to on the list.

    For example, you make a request that returns 50 items, but the total of items is 95. Adding the query param page_token with the value of the attribute next_page_token, you will have access to the 45 remaining. In the next request, changing the page_token for the value of prev_page_token, you will again have access to the previous 50 items.

Return

  • itemsarray containing objects

    Collection of items on the type of list, such as sales list for example.

  • page_infoobject

    Pagination information, with the possible data below:

    general.showParameters
Response
{
  "items": [...],
  "page_info": {
      "total_results": 30,
      "next_page_token": "eyJwYWdlIjoyLCJyb3dzIjoxMH0=",
      "prev_page_token": "eyJwYWdlIjoyLCJyb3dzIjoxMH0=",
      "results_per_page": 10
  }
}

Where the items attribute contains a collection of items from the list type, such as sales list for example.

isPageUseful.question