Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

legacy api might return incorrect totalResult values #229

Closed
JoernBerkefeld opened this issue May 5, 2023 · 1 comment · Fixed by #232
Closed

legacy api might return incorrect totalResult values #229

JoernBerkefeld opened this issue May 5, 2023 · 1 comment · Fixed by #232
Assignees
Labels
bug Something isn't working

Comments

@JoernBerkefeld
Copy link
Collaborator

JoernBerkefeld commented May 5, 2023

Expected:
the framework tests how many records are actually returned by API and checks against that, rather than against the counter integer that the API returns to make an educated decision.

Most of all. I would expect that the framework does not endlessly request new pages once a request returned 0 records.

Actual:
image
The initial call only returned 10 instead of 12 records, despite the pageSize being set to 500.
Calls for next pages then return 0 records:
image

Log excerpt (removed all but id and cut off log after 2 bad retries):

12:41:10.959 info: Retrieving: mobileKeyword
12:41:10.961 debug: API REQUEST >> {
  "method": "GET",
  "url": "/legacy/v1/beta/mobile/keyword/?view=simple&$top=50&$skip=0",
  "baseURL": "https://mc-dummy.rest.marketingcloudapis.com/",
  "headers": {
    "Authorization": "Bearer *** TOKEN REMOVED ***"
  }
}
12:41:11.434 debug: API RESPONSE << {
  "startIndex": 0,
  "itemsPerPage": 50,
  "totalResults": 12,
  "entry": [
    {
      "id": "MGtuaEdmbDRJMEtzMmN5cGIyTlJzQTo4Njow"
    },
    {
      "id": "ZVVGOUl2ZzlXVWVockxLSlUzTWRFQTo4Njow"
    },
    {
      "id": "VVF0NnJIYjhyVS1xa2dITW5rTkNuUTo4Njow"
    },
    {
      "id": "S3FsUGRJUks1RUNUdEJVR1VxcG9Hdzo4Njow"
    },
    {
      "id": "TGwxNGZ3ZmFFVWlOM2ZmdGgzd1Rqdzo4Njow"
    },
    {
      "id": "M211MUc3MmNJRU80d2FvdndUS3E1Zzo4Njow"
    },
    {
      "id": "OFplbURfd1U2RXl3eHVxMU1GZGJjZzo4Njow"
    },
    {
      "id": "a3ZYLXdXSXlsVWVKb09yVjZxMC1MZzo4Njow"
    },
    {
      "id": "YkJrNDUxSVc4MDZ3eDBtVlZLMTRudzo4Njow"
    }
  ]
}
12:41:11.437 info: - Requesting next batch (currently 10 records)
12:41:11.437 debug: API REQUEST >> {
  "method": "GET",
  "url": "/legacy/v1/beta/mobile/keyword/?view=simple&$top=50&$skip=1",
  "baseURL": "https://mc-dummy.rest.marketingcloudapis.com/",
  "headers": {
    "Authorization": "Bearer *** TOKEN REMOVED ***"
  }
}
12:41:11.693 debug: API RESPONSE << {
  "startIndex": 50,
  "itemsPerPage": 50,
  "totalResults": 12,
  "entry": []
}
12:41:11.694 info: - Requesting next batch (currently 10 records)
12:41:11.695 debug: API REQUEST >> {
  "method": "GET",
  "url": "/legacy/v1/beta/mobile/keyword/?view=simple&$top=50&$skip=2",
  "baseURL": "https://mc-dummy.rest.marketingcloudapis.com/",
  "headers": {
    "Authorization": "Bearer *** TOKEN REMOVED ***"
  }
}
12:41:11.942 debug: API RESPONSE << {
  "startIndex": 100,
  "itemsPerPage": 50,
  "totalResults": 12,
  "entry": []
}
@JoernBerkefeld
Copy link
Collaborator Author

confirmed working with live test data:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants