{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-products/payments-odl/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Pagination","description":"User guides, API reference, and support resources.","siteUrl":"https://docs.ripple.com/products/custody","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"pagination","__idx":0},"children":["Pagination"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some RippleNet API operations paginate their responses to make the result set easier to handle. For example, if you request a list of objects that is potentially too large to handle efficiently, the operation returns the first batch of results along with a marker that you use to access the next batch of results. In RippleNet this marker is a URL parameter, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]},", indicating the starting point."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, if you call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v4/transfers"]},", the default response includes 5 transfers (the default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]},") on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page=0"]}," (the default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]},"). If there are more transfers to fetch (indicated by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last=false"]}," in the API response), fetch the next set of transfers by using the same endpoint with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page=1"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We recommend that you fetch all the results on all pages before processing them. If you paginate over a moving list, you may miss some results."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pagination-flowchart","__idx":1},"children":["Pagination flowchart"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/pagination-flowchart.1836b7a1da52ed43134968fc9391359788cd8978a381218efe5681b4e4ddbe7f.40f61ff2.svg","alt":"Pagination flowchart"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-by-step-implementation","__idx":2},"children":["Step-by-step implementation"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#1-create-the-request"},"children":["Create the request"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#2-read-the-response"},"children":["Read the response"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#3-process-data"},"children":["Process data"]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{"noshade":"","size":"-1"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1-create-the-request","__idx":3},"children":["1. Create the request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Choose the data you need to retrieve (payments, transfers, etc.). The HTTP method for all the data types is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"GET {ripplenet_base_url}/v4/transfers\n\nAuthorization: Bearer eyJhbGciO...l0ZSIwIm\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use pagination, add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," parameter to the request. Its default value is 0."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your request becomes:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"GET {ripplenet_base_url}/v4/transfers?page=X\n\nAuthorization: Bearer eyJhbGciO...l0ZSIwIm\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"logging-checklist","__idx":4},"children":["Logging checklist"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The full request"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"pseudocode","__idx":5},"children":["Pseudocode"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Choose the data to retrieve (payments, transfers...)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Include the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," parameter in the request"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{"noshade":"","size":"-1"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2-read-the-response","__idx":6},"children":["2. Read the response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before processing the data you received with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page=0"]},", read and analyze the response."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This is a sample response from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v4/transfers?page=0&size=5"]},":"]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{"style":{"color":"gray"}},"children":["Click to show complete response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json{","header":{"controls":{"copy":{}}},"source":"    \"first\": true,\n    \"last\": false,\n    \"number\": \"0\",\n    \"numberOfElements\": \"5\",\n    \"size\": \"5\",\n    \"totalElements\": \"18\",\n    \"totalPages\": \"4\",\n    \"sort\": [\n        {\n            \"direction\": \"DESC\",\n            \"property\": \"lastModifiedDate\",\n            \"ignoreCase\": false,\n            \"nullHandling\": \"NATIVE\",\n            \"ascending\": false,\n            \"descending\": true\n        }\n    ],\n    \"content\": [\n        {\n            \"transfer_id\": \"59d96a63-1c41-43ab-af10-7bf961d73457\",\n            \"state\": \"EXECUTED\",\n            \"owner_address\": \"test.cloud.blueprint2\",\n            \"sender_address\": \"trans_eur_receiver@test.cloud.blueprint2\",\n            \"receiver_address\": \"conct_eur_sender@test.cloud.blueprint2\",\n            \"amount\": \"1000000000.000000000\",\n            \"internal_id\": null,\n            \"end_to_end_id\": null,\n            \"sending_fee\": null,\n            \"created_at\": \"2021-02-16T08:20:59.842Z\",\n            \"user_info\": [],\n            \"labels\": []\n        },\n        {\n            \"transfer_id\": \"2e6f1167-e91a-43dd-be81-716088884549\",\n            \"state\": \"EXECUTED\",\n            \"owner_address\": \"test.cloud.blueprint2\",\n            \"sender_address\": \"conct_eur_sender@test.cloud.blueprint2\",\n            \"receiver_address\": \"trans_eur_receiver@test.cloud.blueprint2\",\n            \"amount\": \"900000.000000000\",\n            \"internal_id\": null,\n            \"end_to_end_id\": null,\n            \"sending_fee\": null,\n            \"created_at\": \"2021-02-16T07:29:35.036Z\",\n            \"user_info\": [],\n            \"labels\": []\n        },\n        {\n            \"transfer_id\": \"89b6668c-7a81-485b-99b4-bc924f29140a\",\n            \"state\": \"EXECUTED\",\n            \"owner_address\": \"test.cloud.blueprint2\",\n            \"sender_address\": \"conct_eur_sender@test.cloud.blueprint2\",\n            \"receiver_address\": \"trans_eur_receiver@test.cloud.blueprint2\",\n            \"amount\": \"99999000000.000000000\",\n            \"internal_id\": null,\n            \"end_to_end_id\": null,\n            \"sending_fee\": null,\n            \"created_at\": \"2021-02-16T07:29:07.781Z\",\n            \"user_info\": [],\n            \"labels\": []\n        },\n        {\n            \"transfer_id\": \"594ceb52-4db1-4bbd-9956-141e7d3f032a\",\n            \"state\": \"COMPLETED\",\n            \"owner_address\": \"test.cloud.blueprint1\",\n            \"sender_address\": \"trans_usd_sender@test.cloud.blueprint1\",\n            \"receiver_address\": \"conct_usd_sender@test.cloud.blueprint1\",\n            \"amount\": \"3.000000000\",\n            \"internal_id\": \"456\",\n            \"end_to_end_id\": \"123\",\n            \"sending_fee\": null,\n            \"created_at\": \"2021-01-04T09:33:35.105Z\",\n            \"user_info\": [\n                {\n                    \"node_address\": \"test.cloud.blueprint1\",\n                    \"state\": \"EXECUTED\",\n                    \"json\": {},\n                    \"created_at\": \"2021-01-04T09:33:35.106Z\"\n                }\n            ],\n            \"labels\": []\n        },\n        {\n            \"transfer_id\": \"827da53b-8086-4d1b-8d0f-d8d18ac46051\",\n            \"state\": \"COMPLETED\",\n            \"owner_address\": \"test.cloud.blueprint1\",\n            \"sender_address\": \"trans_usd_sender@test.cloud.blueprint1\",\n            \"receiver_address\": \"conct_usd_sender@test.cloud.blueprint1\",\n            \"amount\": \"3.000000000\",\n            \"internal_id\": \"456\",\n            \"end_to_end_id\": \"123\",\n            \"sending_fee\": null,\n            \"created_at\": \"2020-12-02T13:52:40.909Z\",\n            \"user_info\": [\n                {\n                    \"node_address\": \"test.cloud.blueprint1\",\n                    \"state\": \"EXECUTED\",\n                    \"json\": {},\n                    \"created_at\": \"2020-12-02T13:52:40.909Z\"\n                }\n            ],\n            \"labels\": []\n        }\n    ]\n}\n","lang":"json{"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The first fields of the response are important:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"first\": true,\n    \"last\": false,\n    \"number\": \"0\",\n    \"numberOfElements\": \"5\",\n    \"size\": \"5\",\n    \"totalElements\": \"18\",\n    \"totalPages\": \"4\",\n}\n...\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The above response indicates that 18 transfers (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalElements"]},") are available on 4 pages (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalPages"]},")."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last"]}," is a boolean indicating whether this is the last page of the response data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implement logic in your middleware to keep retrieving your data until ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last=true"]},", and increment ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," by 1 for each call."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"logging-checklist-1","__idx":7},"children":["Logging checklist"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The full request"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{"noshade":"","size":"-1"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"pseudocode-1","__idx":8},"children":["Pseudocode"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Receive the successful response"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last"]}," boolean field"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last=false"]},", use pagination"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Else, process data"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example Java code for pagination of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v4/payments"]}," response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"Payments payments = paymentsServices.getPaymentsFromAllPages(getPaymentsParams);\n\n...\n\n@Override\npublic Payments getPaymentsFromAllPages(GetPaymentsParams getPaymentsParams)\n        throws RippleNetProblemException, RnAuthException {\n\n    int page = 0;\n    getPaymentsParams.setPage(page);\n\n    // We retrieve the payments on page 0 first\n    Payments payments = getPayments(getPaymentsParams);\n    int numberOfElements = payments.getNumberOfElements();\n\n    // If the page is not the last one\n    while (!payments.isLast()) {\n        // We increase the page by 1\n        page++;\n        getPaymentsParams.setPage(page);\n\n        // We retrieve the payments on the incremented page\n        Payments paymentsTemporary = getPayments(getPaymentsParams);\n\n        // And for each payment on the new page\n        for (Payment payment : paymentsTemporary.getContent()) {\n            // we add it to the global list of Payments\n            payments.addContentItem(payment);\n            // we also update the total number of payments/elements in the payments object\n            numberOfElements++;\n            payments.setNumberOfElements(numberOfElements);\n        }\n        // Finally, at the end of the while loop, we update the first/last booleans\n        // If page 1, for example, is the last, then the while loop will exit\n        payments.setLast(paymentsTemporary.isLast());\n        payments.setFirst(paymentsTemporary.isFirst());\n    }\n\n    LOGGER.info(\"Total amount of payments retrieved: {}\", numberOfElements);\n    LOGGER.info(\"Last page where payments were retrieved is page {}\",\n            getPaymentsParams.getPage());\n\n    // Return the list of Payments\n    return payments;\n}\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{"noshade":"","size":"-1"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"3-process-data","__idx":9},"children":["3. Process data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After retrieving all the data on all pages, process the list containing your data in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}," response field."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"pseudocode-2","__idx":10},"children":["Pseudocode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example for payments."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["If total number of payments > 0, then send them for processing"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["else do nothing, wait for next polling"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"if (payments != null) {\n    if (payments.getNumberOfElements() > 0) {\n        paymentsProcessor.processPayments(payments, hasSubStates);\n    } else {\n        LOGGER.info(\"No payments in {} states retrieved\", getPaymentsParams.getStates());\n    }\n}\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"logging-checklist-2","__idx":11},"children":["Logging checklist"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Completed"},"children":["Completed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Total number of data to process"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Last ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," used"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{"noshade":"","size":"-1"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"http-errors","__idx":12},"children":["HTTP errors"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"HTTP Status Code"},"children":["HTTP Status Code"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Error Message"},"children":["Error Message"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["invalid_request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Invalid Request parameters"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Error 401 Unauthorized"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Bad credentials, wrong authentication method OR the token can be expired"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Forbidden"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["No handler found for GET"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["500"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Server not available"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Service is temporarily unavailable."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"handlers","__idx":13},"children":["Handlers"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Code"},"children":["Code"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Action"},"children":["Action"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Unauthorized"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Credentials could have been altered by an administrator or renew the token."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Server not available"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["500"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Retry three times every two seconds. If it fails, raise an alert."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"handlers-sample-code","__idx":14},"children":["Handlers sample code"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To handle retries with a 500 HTTP status code, the RippleNet Reference Implementation uses the Spring ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://www.baeldung.com/spring-retry#using-spring-retry"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@Retryable"]}]}," annotation."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"@Retryable(value = {RippleNetProblemTemporaryException.class},\n            maxAttempts = 3,\n            backoff = @Backoff(maxDelay = 2000, random = true))\n    Payments getPayments(GetPaymentsParams getPaymentsParams)\n            throws RippleNetProblemException, RnAuthException;\n","lang":"java"},"children":[]}]},"headings":[{"value":"Pagination","id":"pagination","depth":1},{"value":"Pagination flowchart","id":"pagination-flowchart","depth":2},{"value":"Step-by-step implementation","id":"step-by-step-implementation","depth":2},{"value":"1. Create the request","id":"1-create-the-request","depth":3},{"value":"Logging checklist","id":"logging-checklist","depth":4},{"value":"Pseudocode","id":"pseudocode","depth":4},{"value":"2. Read the response","id":"2-read-the-response","depth":3},{"value":"Logging checklist","id":"logging-checklist-1","depth":4},{"value":"Pseudocode","id":"pseudocode-1","depth":4},{"value":"3. Process data","id":"3-process-data","depth":3},{"value":"Pseudocode","id":"pseudocode-2","depth":4},{"value":"Logging checklist","id":"logging-checklist-2","depth":4},{"value":"HTTP errors","id":"http-errors","depth":3},{"value":"Handlers","id":"handlers","depth":3},{"value":"Handlers sample code","id":"handlers-sample-code","depth":4}],"frontmatter":{"seo":{"title":"Pagination"}},"lastModified":"2025-10-03T17:57:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/payments-odl/api-docs/ripplenet/best-practices/pagination","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}