4 Replies Latest reply on Nov 7, 2017 2:18 PM by Michael Tyson

    Activities API nextPageToken

    Michael Tyson

      I'm currently trying to debug a problem in our CRM integration where when scraping the API for activities changing, I'm getting the same results over and over.

       

      In my CRM sync script, I start by tracking the last scrape attempt in a database. On the next run of the script, it provides that date (which is stored as EST then converted to UTC) to the paging token endpoint (/rest/v1/activities/pagingtoken.json).

       

      In this example, I store the date as "2017-10-18 14:04:43" in MySQL then convert to "2017-10-18T18:04:43+00:00". After getting the paging token, I send a request to /rest/v1/activities/types.json and retrieve 300 activities for processing. The first activity date returned is "2017-10-18T14:03:10Z" and the last returned is "2017-10-18T14:03:26Z". If I run the script 10 times, I get the same datetimes over and over. The paging token is also always the same.

       

      So as a sanity check, I fired up a REST client and crafted the exact same request to the pagingtoken.json endpoint and got a completely different paging token. I ran that request again & again and got the same token.

       

      So at this point we have a repeatable "CRM" paging token and a repeatable "REST client" paging token.

       

      Now when I take the paging token from the REST client and send a request to the types.json endpoint, the first activity's datetime is "2017-10-20T21:30:35Z" and the last is "2017-10-20T21:30:38Z".

       

      Both of the clients use the same accessToken which is grabbed from "/identity/oauth/token" endpoint using the exact same credentials.

       

      Can anyone tell me what is going on here?