跳至主要内容

Cursor pagination on the order listing

What's new

GET /v1/orders takes a new start_after_id query parameter, the id of the last order on the page you just read. The next response starts with the order that follows it. offset still works but is marked deprecated, and its description now points at the replacement.

limit is unchanged and sets the page size either way.

Impact

Offset paging counts from the start of the result set on every request, so an order created while you page through shifts the whole list down and one record comes back twice. A cursor is anchored to a record instead, so pages stay stable while the list grows underneath them.

Changes

ResourceChange
get_ordersAdded the optional start_after_id query parameter, which takes the id of the last order on the previous page
get_ordersMarked the offset query parameter deprecated in favor of start_after_id

Upgrade

  • Replace offset with start_after_id on get_orders. Read the first page with limit alone, then pass the id of the last order in the response as start_after_id on the next call.
  • Stop paging when a response comes back with fewer than limit orders.
  • offset keeps working, so the switch can wait, but treat it as on its way out.

需要技术支持?
联系我们的集成技术团队: [email protected]