Api methode PUT

Feature requested and implemented
Post Reply
lignum
Posts: 3
Joined: Fri Aug 27, 2021 3:03 pm
Been thanked: 1 time

Api methode PUT

Post 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
From profession to hobby. Micro-computers still my challenge!
User avatar
cicciocb
Site Admin
Posts: 1989
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 426 times
Been thanked: 1329 times
Contact:

Re: Api methode PUT

Post 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)
User avatar
PeterN
Posts: 385
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 179 times
Been thanked: 214 times
Contact:

Re: Api methode PUT

Post 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! :)
SteanX
Posts: 39
Joined: Sat Jun 19, 2021 10:33 pm
Has thanked: 17 times
Been thanked: 6 times

Re: Api methode PUT

Post 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?
User avatar
cicciocb
Site Admin
Posts: 1989
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 426 times
Been thanked: 1329 times
Contact:

Re: Api methode PUT

Post by cicciocb »

Implemented in the version 1.49.2
lignum
Posts: 3
Joined: Fri Aug 27, 2021 3:03 pm
Been thanked: 1 time

Re: Api methode PUT

Post 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.
From profession to hobby. Micro-computers still my challenge!
Post Reply