Issue querying Card IDs

Hello again! I've been happily querying card IDs for a few days, but now ran into this issue:
> Exception: Request failed for returned code 400. Truncated server response: { "description" : "Invalid paging token" } (use muteHttpExceptions option to examine full response) (line 36).
When I follow the pagination token URL on the browser it works, logging it also gives me a working token.
The call I'm making is using only the Card ID, it breaks when it has to fetch the next page, I'm using the same code from the Google Sheet you shared but only modified it so cardId is added instead of dates.

4 replies

Userlevel 1
Hey @joshua.ordehi! Is there a way you can see the URL you're trying to load? The header with the next page's URL is formatted like this:
```Link: ; rel="next-page"```
So my first thought is there might be a problem extracting the URL from that value.
thank you! I was able to catch the URL fed to GETKCS on second run, turns out I was concatenating ?cardId every time, which broke the paging token. Wrapped it in a conditional to fix it :slightlysmiling_face:
Userlevel 1
Ah, perfect! One thing I learned about after making that KCS sheet is the ability to make buttons that execute scripts, like the "Load users" button on this sheet.
Depending on what you're doing, you might find that to be more helpful. The way you update the sheet is a little different (calling functions to update cells vs. just returning a value) but I've found it can be easier to debug sometimes. These scripts can also run for 6 minutes, compared to 30 seconds when you call it from a formula.
oooh, this is pretty cool, thanks for sharing!