_method=GET in Rest APIs

Highlighted

_method=GET in Rest APIs

As per http://developers.marketo.com/rest-api/error-codes/

We can convert a GET API to POST type by appending _method=GET in URL

Would this also be done to make API hits more secure ?, as POST request are more secure than GET
Also,

By using _method= GET in rest APIs , some times getting proper response.... while sometimes getting error array as.... [{message=name cannot be null., code=701}, {message=folder cannot be null., code=701}]

Do anybody came up with same case,
or
what would be probable reasons for it..?

7 REPLIES 7
Highlighted
Level 10 - Community Moderator

Re: _method=GET in Rest APIs

It has nothing to do with security. It's about the request size. Large request payloads can't be managed in the URL.

Highlighted

Re: _method=GET in Rest APIs

Agreed
but By using _method= GET in rest APIs , some times getting proper response.... while sometimes getting error array as.... [{message=name cannot be null., code=701}, {message=folder cannot be null., code=701}].... not getting the reason...

Highlighted
Level 10 - Community Moderator

Re: _method=GET in Rest APIs

Well, I'd have to see the payloads and that you're using proper encoding. Not sure if every single Marketo GET can be used with _GET.

Highlighted

Re: _method=GET in Rest APIs

For example, for getting static list
GET https://######.mktorest.com/rest/asset/v1/staticLists.json?access_token=######## -> working fine and getting all static list
but, for

POST https://######.mktorest.com/rest/asset/v1/staticLists.json?_method=GET with access token passed in request in x-www-form-urlencoded

This was working earlier, but now it giving error = [{message=name cannot be null., code=701}, {message=folder cannot be null., code=701}]
Not getting the reason, why this is happening

Highlighted
Level 10 - Community Moderator

Re: _method=GET in Rest APIs

Please show the full payload, and use the Advanced Editor's syntax highlighter so it's readable.

Highlighted

Re: _method=GET in Rest APIs

POSTMAN's screen shots

GET.png -> My GET request


POST.png -> My POST request

Highlighted
Level 10 - Community Moderator

Re: _method=GET in Rest APIs

I require the request payload and headers to be pasted as plain text and syntax-highlighted for readability. Not gonna work w/screenshots.