how to PUT to a REST API?

All,

I am probably losing my mind but I am having an issue with a REST API. Part of the API is GETs, POSTs, and PUTs. Now I got the GETs/POSTs working. I am having problems with the PUTs. How do I do one? Polling the API with curl -X PUT https://api.com/api/api/api works fine.

I am overlooking something very simple (probably!).
sb

I have not encountered an API that uses a PUT yet, so I looked up the difference. It boils down to this: POST is used to create, PUT is used to create OR update.

Stackoverflow Explanation

As far as I know, the HTTP sockets provided by Xojo only support GET and POST. To PUT, I think you’d have to extend the generic TCPSocket and do the implementation yourself (ick!).

I hope I’m wrong - but it seems to me that PUT is pretty rarely used in most public APIs, and that when it is, it is interchangeable with POST.

this is a public API that requires the use of PUT to update items. Other parts of the API use GET or POST (depending where in the API). I wish it was all GETs/POSTs.

And I hope I dont have to write/extend the HTTP(s)Socket/TCPSocket to be able to do it.

you can very easy convert from curl command line to use of our CURL plugin.

see
http://www.mbsplugins.de/archive/2013-09-26/CURL_from_command_line_to_Plug/monkeybreadsoftware_blog_archive

HTTPSocket has a SendRequest method

Example:

[quote]Dim http as new HTTPSocket

msgbox(http.SendRequest(“PUT”,“http://www.yoursite.com/api.php”,30))[/quote]

[quote=65211:@Christian Schmitz]you can very easy convert from curl command line to use of our CURL plugin.

see
http://www.mbsplugins.de/archive/2013-09-26/CURL_from_command_line_to_Plug/monkeybreadsoftware_blog_archive[/quote]

Christian, I will keep this in my pocket as a second solution to my problem. Thanks!!

Good find, @Ashot Khachatryan - interestingly, when I searched the docs for “PUT” using Dash, it does not find or suggest the SendRequest method. But when I go back to the language reference and search there, it does.

This is the first time Dash has not performed better than the LR for me. I’ll have to remember that when looking for stuff in the future.

I did the same search before I posted. I am surprised that Dash didnt find it. And Yes, Ashot that was a great find for me. Thank you!

Top one, Ashot.
Just what i needed!