correct usage of offset to get a full result set f...
# ask-stanley-ai
l
correct usage of offset to get a full result set from a suiteql query through the rest endpoint
c
AI generated answer (using internal Slack threads):
In order to get a full result set from a SuiteQL query through the REST endpoint, you can use the
offset
parameter. The
offset
parameter is used to specify the starting point in the set of rows returned by your query. For example, if you have a query that returns 5000 rows, and you want to get rows 1001 to 2000, you would use
offset=1000
. Here is an example of how you can use the
offset
parameter:
Copy code
json
{
  "q": "SELECT * FROM item ORDER BY itemId",
  "limit": 1000,
  "offset": 1000
}
In this example, the
limit
parameter is used to specify the maximum number of rows to return, and the
offset
parameter is used to specify the starting point in the set of rows returned by the query. Please note that the
offset
parameter is zero-based. This means that if you want to start from the first row, you would use
offset=0
. Also, keep in mind that the REST API has a limit of 1000 rows per request. If you want to retrieve more than 1000 rows, you will need to make multiple requests and increment the
offset
parameter for each subsequent request. For example, to retrieve the first 2000 rows, you would make two requests. The first request would have
offset=0
and
limit=1000
, and the second request would have
offset=1000
and
limit=1000
. Finally, when using the
offset
parameter, it's a good practice to include an
ORDER BY
clause in your query to ensure that the rows are returned in a consistent order. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804559648
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803531587
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.79540211
Please provide your feedback on this answer.