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