Use Case for Fetching a List of All Customers with Pagination

Add the limit and offset criteria to your request to get the results in multiple pages. For more information about pagination, read Collection Paging.

          GET {{REST_SERVICES}}/record/v1/customer?q=dateCreated ON_OR_AFTER "{{thisYearStart}}" AND dateCreated BEFORE "{{thisYearEnd}}"&limit=3&offset=6 

        

The following is an example of a response:

          {
    "links": [
        {
            "rel": "previous",
            "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=3&offset=3"
        },
        {
            "rel": "first",
            "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=3&offset=0"
        },
        {
            "rel": "next",
            "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=3&offset=9"
        },
        {
            "rel": "last",
            "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=3&offset=12"
        },
        {
            "rel": "self",
            "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=3&offset=6&q=dateCreated+ON_OR_AFTER+%221%2F1%2F2022%22+AND+dateCreated+BEFORE+%221%2F1%2F2023%22"
        }
    ],
    "count": 3,
    "hasMore": true,
    "items": [
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer/514"
                }
            ],
            "id": "514"
        },
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer/614"
                }
            ],
            "id": "614"
        },
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://<accountID>.suitetalk.api.netsuite.com/services/rest/record/v1/customer/716"
                }
            ],
            "id": "716"
        }
    ],
    "offset": 6,
    "totalResults": 14
} 

        

Related Topics

General Notices