Forum Discussion

mrsalta's avatar
mrsalta
New Member
3 years ago
Solved

Pagination code returns first page forever instead of properly paginating

I've been consulting all of the recommended articles shared in this forum (thanks for that!) but I think I'm probably missing something very basic.   My query:   (app_id as text, survey_id as te...
  • mrsalta's avatar
    mrsalta
    3 years ago

    Thanks ams1 -
    I'm not able to share the API documentation directly, but here's a sample response object they provided:

    {
      "responses": [
        {
          "id": "5e22085d5379215be800002b",
          "survey_id": "6e22085d5379215be800002b",
          "created_at": "2020-09-24T00:20:10",
          "conversation_id": "7e22085d5379215be800002b",
          "answers": [
            {
              "question": {
                "id": "5e22085d5379215be800002b",
                "value": "Choose one option",
                "type": "multichoice | multiselect | range | nps | singleline"
              },
              "answer": {
                "value": "'yes' OR ['Red', 'Blue']"
              }
            }
          ],
          "snapshot_data": {
            "device": {
              "id": "55fbe2e775bf3c760b1000bc",
              "carrier": "Verizon",
              "custom_data": {
                "key": "CustomKey",
                "value": "CustomValue"
              },
              "manufacturer": "Samsung",
              "model": "S22",
              "os_api_level": "3.5.9",
              "os_name": "Android",
              "os_version": "5.2.0"
            },
            "person": {
              "id": "95fbe2e775bf3c760b1000bc",
              "custom_data": {
                "key": "CustomKey",
                "value": "CustomValue"
              },
              "email": "[email protected]",
              "facebook_id": "1184928249824",
              "mparticle_id": "-29482958295729572",
              "name": "Jack Daniels"
            },
            "app_release": {
              "cf_bundle_version": "78",
              "cf_bundle_short_version_string": "4.5.11",
              "sdk_version": "4.5.11",
              "sdk_platform": "iOS",
              "sdk_distribution": "source",
              "sdk_distribution_version": "4.5.11"
            }
          }
        }
      ],
      "ends_with": "6e22085d5379215be800002b",
      "page_size": 250,
      "has_more": true
    }

    And these are the sample params:

     

    I've tried your sample code and I think I just need to make sure the result is the  `"responses": [` portion and the `ends_with`, `page_size`, and `has_more` just used for cursor/paging.