Pagination
In the case where an API GET request returns multiple results, Paysafe returns the first 10 records by default and uses HATEOAS links to provide page navigation. In addition to the default behavior, it is also possible to control the number of results and starting point by passing in query parameters as follows:
Name | Description |
---|---|
limit | This is the total number of records to return. Max = 50. Default = 10. |
offset | This is the starting position, where 0 is the first record. Default = 0. |
startDate | This is the start date in UTC. Default = 30 days before the endDate. |
endDate | This is the end date in UTC. Default = current date and time. |
HATEOAS
The Account Management API uses a RESTful endpoint structure and relies on HTTP verbs (GET, PUT, POST, DELETE) to determine what action you are attempting to perform on a specific resource.
Each API call response includes an array of HATEOAS (Hypermedia as the Engine of Application State) links. These links can be used to integrate subsequent flows and typically they will provide you information as to what you can do next. Additionally these links might be used to link to other resources related to the current response object.
By using these links, you no longer need to hardcode your integration to call specific endpoint URLs to utilize our API, but rather you can use the returned URL for the specific purpose as defined by the rel definition.
HATEOAS Link Structure
Element | Description |
---|---|
rel | Link relation that describes how this link relates to the previous call. Examples include self (get details of the current call), next (navigate to the next set of resources), or a related call. |
href | URL of the related HATEOAS link you can use for subsequent calls. |
Below are sample HATEOAS links from an API response that returns a collection of subaccounts associated to a specific merchant account. Links are provided to navigate through the set of resources in the collection.
GET https://api.paysafe.com/accountmanagement/v1/accounts/{ACCOUNT_ID}/subaccounts&limit=10&offset=10
...result set
"links": [{
"rel": "self",
"href": "https://api.test.paysafe.com/accountmanagement/v1/accounts/{ACCOUNT_ID}/subaccounts&limit=10&offset=10"
}, {
"rel": "prev",
"href": "https://api.test.paysafe.com/accountmanagement/v1/accounts/{ACCOUNT_ID}/subaccounts&limit=10&offset=0"
}, {
"rel": "next",
"href": "https://api.test.paysafe.com/accountmanagement/v1/accounts/{ACCOUNT_ID}/subaccounts&limit=10&offset=20"
}]