I'm querying an Azure Digital Twin instance using the query API, which is fine, it authenticates, and I can get results back. The issue I'm having is when I need to make a subsequent API call with the continuation token. The call works, and I'm passing in the continuationToken
property instead of the query
property in the message body, but I'm getting duplicated results.
For example, If I run a query which I know returns 22 records and set max-items-per-page
to 100 then I get the results I'm expecting. If I do the same but set max-items-per-page
to 3, I still get 22 results back, but most of them are duplicated. I could set the max-items-per-page
to a ridiculously high number, but that doesn't feel like the right approach.
Not sure if I've missed something in the documentation, or if this is a known issue, but any help is welcome.
Edit:
The overall flow is this
API Call #1: Made with body {"query": "select * from digitaltwins"}
API Call #2: Made with body {"continuationToken": "<token here>"}
And so on, each new call using the continuation token from the previous call until the continuation token is null.
As part of this I'm also correctly escaping the continuation token before passing it back in the API call as the code reads the content as JSON but then has to escape the JSON string continuation token.
The following is an example token where I've set max-items-per-page to 1 to highlight the issue.
"{\"_t\":1,\"_s\":3,\"_rc\":null,\"_q\":\"SELECT dt FROM digitaltwins dt\",\"_id\":\"c50ef08b-abcd-1234-9baa-c93226665e34\",\"_tr\":3,\"_pn\":3}"