Page 1 of 1

Api methode PUT

Posted: Wed Jan 25, 2023 2:48 am
by lignum
I am an oldschool computertechnician started programming in the 70's in assembly on 6502 cpu.
Tiny basic was the first step on the long path of higher level programming languages in my career.
Annex rds is for me like a reunion with an old friend. :)
Iot is now my new challenge. Home automation system like Hue, Smartconnect, homewizard custom controlling and connecting with dmx and serial devices.
Using rest API's is an easy solution with Annex. The wget, wpost and json commands are very useful. But...
Two of my target devices are using the PUT method. So a lot of other api do so.
Is there a special reason for this omission? Is there a solution to emulate such.
Maybe a reason for implementing WPUT$ in the next revision?

Otherwise I have to switch inbetween to another relation e.g. arduino C :P

Re: Api methode PUT

Posted: Wed Jan 25, 2023 9:31 am
by cicciocb
Hi,
This method have not been implemented simply because is rarely used and then considered without any particular interest.
Actually it is not possible actually to emulate this function because it relies internally on a specific code

This is the first time that someone request for it, I'm surprised that you cannot achieve the same result using POST or GET.

Having said that, it should not hard to implement it in the future (for the ESP32)

Re: Api methode PUT

Posted: Wed Jan 25, 2023 9:53 am
by PeterN
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Jan 25, 2023 2:48 am :)
Annex rds is for me like a reunion with an old friend. :)
... not to mention the technical question....
I agree with that!
This is one of the best and most accurate sentences I have ever had the pleasure to read here! :)

Re: Api methode PUT

Posted: Thu Jan 26, 2023 2:02 pm
by SteanX
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Jan 25, 2023 9:31 am This is the first time that someone request for it, I'm surprised that you cannot achieve the same result using POST or GET.
I believe many REST API's like to map the HTTP METHOD to correspond to database-like actions, typically mapping it as:
GET : Read
POST : Create/Insert
PUT : Update
DELETE : Delete
HEAD : I don't remember, but something to do with checking if a record has changed

so I can understand how this might be useful when connecting to an API that is not under your control. But as CiccioCB points out, it's probably not a big deal to POST from your ESP to your own server where you then "translate" to PUT to the foreign API.

On the other hand, I would also imagine that Annex uses a library for the HTTP functions (perhaps ESP AsyncTCP as listed in the help file). Perhaps that library can be used to bring arbitrary TCP support to Annex, a little like the UDP support, and then you could do your own PUT method?

Re: Api methode PUT

Posted: Wed Aug 16, 2023 8:26 pm
by cicciocb
Implemented in the version 1.49.2

Re: Api methode PUT

Posted: Thu Aug 17, 2023 8:51 am
by lignum
Yeah. Thanks. I pick up my project to control hue and tradfri lamps via a rs232 connection of the DCP controller/ barco movieprojector combination. Annex has al the possibilies gor making a gateway from serial to RESTAPIs in the hue inhouse gateway! In the language i understand...

I already used annex to create a visitors monitor fir our entrysystem.

The data is fetched via a POST from the Sumup cash system. A big 3x8x8 led display shows how many visitors are in.
Basic progam is about 20 lines and mostly comments.
And my follow volunteers are astonished. :D

Going on with the apipuzzle. Again thanks.