SOLVED

Rest API error code 601, Access token invalid

Go to solution
Anonymous
Not applicable

Rest API error code 601, Access token invalid

Hey guys,

I'm tryin to insert leads via rest api and am getting an access token invalid error. I've verified the token and I believe everything is formatted properly...

URL: https://XYZ.mktorest.com/rest/v1/leads.json?access_token=some_verified_token
HTTP Headers: Authorization: Bearer: some_verified_token

HTTP body:
{"Action":"createOnly",
"lookupField":"email",
"input":[
{"email":"aaron@blahblah.com"},
{"email":"will@blahblahblah.com"},
{"email":"yigit@blahblahblahblah.com"}]
}

Any help would be appreciated. Thanks!
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

1 - Keep the access token in the URL and remove it from the header. The 612 error means you are on the right track here. In othe words, you solved the 601 error, so you are seeing the other error you need to solve to get this working. 
2 - To address the 612 error, you need to add a Content-Type HTTP header. You need to set it to application/json. See this StackOverflow question for more info:
http://stackoverflow.com/questions/28181325/why-invalid-content-type
 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

I would trying removing the colon after Bearer (but keeping the colon after Authorization), then retry the request. 

You only need to include the access token into either the Header or as a parameter. Not both. 
Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

Murtza - thanks! The extra colon was a typo when I typed my question...

So, if I remove the header, then I get "invalid content type," (code 612) which would lead me to believe that a header is required.

If I remove the token from the URL, then I get code 600 - "Access token not specified"

As with before, if I use both, then I get "Invalid Access Token."

Thanks agian for your help - I've been working at this for awhile.
Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

1 - Keep the access token in the URL and remove it from the header. The 612 error means you are on the right track here. In othe words, you solved the 601 error, so you are seeing the other error you need to solve to get this working. 
2 - To address the 612 error, you need to add a Content-Type HTTP header. You need to set it to application/json. See this StackOverflow question for more info:
http://stackoverflow.com/questions/28181325/why-invalid-content-type
 

View solution in original post

Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

Murtza - thanks again for the response. I figured that out: needed "Content-Type: application/json"

I coudln't find it anywhere in the api documentation...
Anonymous
Not applicable

Re: Rest API error code 601, Access token invalid

Glad you got it working! Just updated the REST API error code documentation with this info.