Re: Invalid access token when removing lead from list via REST API

Anonymous
Not applicable

Invalid access token when removing lead from list via REST API

Could anyone help explain why I am experiencing this error? I know the access token, list_id, instance, etc. I'm using are correct because I perform several different API calls before this one using the same values and within the same session with no problem, I only get the error when trying to delete a lead from a list.

I'm following exactly the steps in http://developers.marketo.com/documentation/rest/remove-leads-from-list/ and generating an HTTP request that looks like:

"#{my_marketo_instance}/rest/v1/lists/#{list_id}/leads.json?access_token=#{session[:marketo_token]}_method=DELETE"

and calling RestClient.post with the same format as the documentation and getting error code 601: access token invalid. I have a feeling the problem is with appending "_method=DELETE" immediately after the token but I don't know how else this can be accomplished since that's what the REST doc shows.

For context, I am trying to add a lead to a new list after they fill out a specific form on my website, and then delete the lead from a previous list so that they don't appear in both.

Tags (1)
4 REPLIES 4
John_M
Marketo Employee

Re: Invalid access token when removing lead from list via REST API

Glen

the format looks off to me. As you know it has to be %URL%?access_token=%access_token%&_method=POST. can you try using something like Postman so you can more precisely control the URL?

I'm assuming you're calling the Authentication API endpoint first to get that access token.

Anonymous
Not applicable

Re: Invalid access token when removing lead from list via REST API

Sorry, I'm using Ruby so the #{ } enclosed portions are simply variables I'm passing in to build the request. You did help me realize I was missing an ampersand before "_method=DELETE", but other than that the format is the same. The access token problem is no longer present so I should be able to get it working from here. Thanks for the response!

John_M
Marketo Employee

Re: Invalid access token when removing lead from list via REST API

Excellent!!!!

John

John_M
Marketo Employee

Re: Invalid access token when removing lead from list via REST API

If you can, can you mark the question as answered so it can be searched and can help others?

Thanks!