how to PUT to a REST API?


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 works fine.

I am overlooking something very simple (probably!).

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.


HTTPSocket has a SendRequest method


[quote]Dim http as new HTTPSocket


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


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!