Most of the Messaging APIs support pagination to fetch a long list of records returned in the GET request.
The following two query parameters can be used for the same.
Limit query param determines how many records can be fetched at a time.
Offset query param is used to specify the offset of the record to fetch. Offset starts from 0 until (total records -1).
For example to fetch all sender Ids configured under the account we invoke the following API
https://api.syniverse.com/scg-external-api/api/v1/messaging/sender_ids?limit=100&offset=0
The API response payload returns the total count at the end. That can be used to pro grammatically determine the next sequence of calls needed to fetch all the data.
For example, if we the total count is 210
We would call the following APIs requests for fetching all of them.
https://api.syniverse.com/scg-external-api/api/v1/messaging/sender_ids?state=ACTIVE&limit=100&offset=0 [return 100 records, with offset 0 – 99]
https://api.syniverse.com/scg-external-api/api/v1/messaging/sender_ids?state=ACTIVE&limit=100&offset=100 [return 100 records, with offset 100 – 199]
https://api.syniverse.com/scg-external-api/api/v1/messaging/sender_ids?state=ACTIVE&limit=2&offset=200 [return 10 records, with offset 200 – 209]
0 Comments