Pagination
It's advisable to paginate requests for potentially large object sets. This will help prevent API truncation or timeouts when attempting to retrieve large results. Pagination improves reliability by limiting requests to a manageable number of objects per request, resulting in faster results. Page numbers are provided to differentiate between different pages.
Paginated requests
The Fireberry API allows you to paginate requests by setting a page size. Unpaginated requests, despite potentially returning more results, are still subject to a timeout limit that can cause failure due to server load or network latency.
Pagination limits allow you to set a page size that can always be served, regardless of other factors. You can request paginated results by including the pagesize
and pagenumber
parameters in your request.
Limits
- 50 records per page.
- 500 records per request.
Now let's detail the different properties that can be defined in the two types of requests: GET and Query.
GET Requests pagination
Property | Meaning |
---|---|
pagesize | Allows you to set the number of records received per page. |
pagenumber | Allows you to see the page number you are on out of all the received pages. |
Page size
Unless otherwise specified under
pagesize
, the number of records defined for each page is 50 by default.
To get the next page in the order, enter the page number that you want to receive under pagenumber
. For example, if currently page 1
is displayed, change the number to 2
to see the next page and so on for the following pages.
GET Request example
Request
GET https://api.fireberry.com/api/record/account/{id} HTTP/1.1
"tokenid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Response
{
"success": true,
"data": {
"PrimaryKey": "accountid",
"PrimaryField": "accountname",
"Total_Records": 1,
"Page_Size": 50,
"Page_Number": 1,
"Records": [
{
"pcfsystemfield85": "2022-06-19T15:33:59",
"telephone1": "0500000000",
"accountnumber": "2195",
"statecode": 1,
"accounttypecode": 3,
"accountid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"emailaddress1": "[email protected]",
"accountname": "Gary Carter",
"firstname": "Gary",
"originatingleadcode": 6,
"lastname": "Carter",
"statuscode": 2,
"createdbyname": "Jordan Smith",
"ownername": "Bob Davis",
}
]
},
"message": ""
}
Query Requests pagination
Property | Meaning |
---|---|
page_size | Allows you to set the number of records received per page. |
page_number | Allows you to see the page number you are on out of all the received pages. |
The IsLastPage
property allows you to check if there are additional pages of records or not. If it's not the last page, the value will be False
. If it is the last page, the value will be True
.
If there are additional pages, meaning the value False
appeared in the IsLastPage
field, go to the next page by entering the following page number under the property page_number
.
Query Requests example
Request
POST https://api.fireberry.com/api/query HTTP/1.1
"tokenid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
{
"objecttype": 1,
"page_size": 50,
"page_number": 1,
"fields": "accountname,accountid",
"query": "(accountid = '1002')",
"sort_by": "telephone1",
"sort_type": "desc"
}
Response
{
"success": true,
"data": {
"ObjectName": "Account",
"SystemName": "Account",
"PrimaryKey": "accountid",
"PrimaryField": "accountname",
"ObjectType": 1,
"PageNum": 1,
"SortBy": "telephone1",
"SortBy_Desc": true,
"IsLastPage": true,
"Columns": [
{
"name": "Account Name",
"fieldname": "accountname",
"systemfieldtypeid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"fieldobjecttype": null,
"isprimaryfield": true,
"isrequired": true,
"isreadonly": false,
"maxlength": 200
},
{
"name": "Account Id",
"fieldname": "accountid",
"systemfieldtypeid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"fieldobjecttype": 1,
"isprimaryfield": false,
"isrequired": false,
"isreadonly": false,
"maxlength": null
}
],
"Data": [
{
"accountname": "Joe Warner",
"accountid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
]
},
"message": ""
}
Updated about 1 year ago