SOLVED

pagingtoken API gives error even when using one of the supported date formats

Go to solution
Anonymous
Not applicable

pagingtoken API gives error even when using one of the supported date formats

Hi There,

We are using Marketo Rest API to pull data from Marketo. For extracting activities we have to first generate a token(nextpagetoken) which can be used to fetch Activity from the date that user has provided.

For generating initial token as per marketo documentation we have to use pagingtoken API? . As per documentation this API supports three date formats for sinceDatetime parameters using any of these three formats we were able to generate paging token using either of the below sample API call:

https://074-uin-407.mktorest.com/rest/v1/activities/pagingtoken.json?access_token=xxxx&sinceDatetime...

https://074-uin-407.mktorest.com/rest/v1/activities/pagingtoken.json?access_token=xxxx&sinceDatetime...

https://074-uin-407.mktorest.com/rest/v1/activities/pagingtoken.json?access_token=xxxx&sinceDatetime...

But suddenly it started giving below error for 2013-05-22T11:03:26+05:30 and 2013-05-22T11:03+05:30 date formats and it only works with 2013-05-22 date format.

{

  "requestId": "a1c9#15524613da4",

  "success": false,

  "errors": [

    {

      "code": "1001",

      "message": "Invalid value '2013-05-22T11:03:26 05:30'. Required of type 'Date'"

    }

  ]

}

Can someone please look into this issue and let us know why it suddenly stopped working?

Thanks!!

Message was edited by: Anil Upadhyay

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: pagingtoken API gives error even when using one of the supported date formats

Not a bug, standard URL encoding requirement.  Encode + to %2B:

sinceDatetime=2016-03-01T00:00:00%2B05:00

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: pagingtoken API gives error even when using one of the supported date formats

Are you actually including the trailing question mark?  That is certainly not allowed in the date format.  This is standard ISO formatting, nothing special to Marketo.

EDIT: I didn't catch until a couple of posts later that Anil wasn't URL-encoding the plus sign.

Anonymous
Not applicable

Re: pagingtoken API gives error even when using one of the supported date formats

No We are not appending ? at end . Updated the description.

Anonymous
Not applicable

Re: pagingtoken API gives error even when using one of the supported date formats

Hi Anil

I just remembered.

In this case, plus timezone does not supported.

I think it's bug.

For example

Success

https://000-xxx-999.mktorest.com/rest/v1/activities/pagingtoken.json?sinceDatetime=2013-05-22T11:03-...

Failed

https://000-xxx-999.mktorest.com/rest/v1/activities/pagingtoken.json?sinceDatetime=2013-05-22T11:03+...

{"requestId":"17cc9#155247d9848","success":false,"errors":[{"code":"1001","message":"Invalid value '2013-05-22T11:03 09:00'. Required of type 'Date'"}]}

SanfordWhiteman
Level 10 - Community Moderator

Re: pagingtoken API gives error even when using one of the supported date formats

Not a bug, standard URL encoding requirement.  Encode + to %2B:

sinceDatetime=2016-03-01T00:00:00%2B05:00

Anonymous
Not applicable

Re: pagingtoken API gives error even when using one of the supported date formats

Thank you Sanford Whiteman

I forgot encoding.

I was confused because the "hh:mm:ss+09:00" format was working.

I think Anil's problem is same as me

Anonymous
Not applicable

Re: pagingtoken API gives error even when using one of the supported date formats

Thanks Sanford!!

It was working before even if we were submitting the datetime having + sign. Seems like marketo started decoding the date parameter before executing request or marketo might have been ignoring time portion and now started considering that.

We will start encoding datetime string before submitting request.

Thanks again.