Invalid access token when removing lead from list via REST API | Community
Skip to main content
July 8, 2015
Question

Invalid access token when removing lead from list via REST API

  • July 8, 2015
  • 1 reply
  • 1924 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

John_M
Adobe Employee
Adobe Employee
July 8, 2015

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.

July 8, 2015

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
Adobe Employee
Adobe Employee
July 21, 2015

Excellent!!!!

John