Skip to main content

Move a cursor and get records

  1. Paste this code into the API Request editor.

    {
        "api": "db",
        "action": "getRecordsFromCursor",
        "params": {
            "cursorId": "clickApplyDefaultsToReplaceThisWithTheLastCreatedCursor",
            "startFrom": "beforeFirstRecord",
            "skipRecords": 1,
            "fetchRecords": 1
        },
        "authToken": "clickApplyDefaultsToReplaceThisWithValidAuthToken"
    }
    
  2. Click Apply defaults to JSON request (Apply) to set the "authToken" to a valid value.

    Note

    Clicking the Apply defaults to JSON request icon populates the "cursorId" with the most recent value returns by getRecords action.

  3. Click Send request (Run Icon).

  4. Continue to click Send request to move through the records.

    Note

    The same code fetches different records each time it is run because each call moves the cursor position.

  5. To fetch records from different locations in the recordset, change the values of "startFrom", "skipRecords", and "fetchRecords".

  6. Verify the action completed successfully.

    Note

    • "errorCode" with a value of 0 indicates success. "errorCode" with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.

    • The API Explorer automatically recognizes the "cursorId" in a response and remembers it so when you select the "getRecordsFromCursor" from the JSON Actions dropdown menu, API Explorer automatically populates the action with the latest "cursorId" value to simply using cursors.

    • The "cursorId" property is secure because it is a very large crypto-random number — for example, "cursorId": "w0gs3RZz8eD5Qtf0VuQ9V86tsd85IdlvMwUocQwK0U548ew5RlXpNIP0tyaVVX0w".