23.09.2025, 11:22
(23.09.2025, 08:17)admin Wrote: In last URL you have "valor" instead of "value".
Argument order does not matter:
Code:> curl 'http://192.168.1.16/public/write.lp?addr=35/1/12&value=test'
Addr: 35/1/12
Value: test
Type: string
Value: test
> curl 'http://192.168.1.16/public/write.lp?value=test&addr=35/1/12'
Addr: 35/1/12
Value: test
Type: string
Value: test
Same thing when testing via browser.
If you call grp.write(addr, value) without decoding value as JSON then string values don't need to be escaped. But then if you send "false" the resulting value will be true because the input is not a boolean but a string (1/0 can be used instead). Sending complex values like date/time won't be possible as well.
The only way the string is accepted is like 3th option:
Code:
>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value=test"
Addr: 35/1/12
Value: nil
Type: nil
C:\Users\DGRANDES>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value='test'"
Addr: 35/1/12
Value: nil
Type: nil
>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value=\"hola\""
Addr: 35/1/12
Value: hola
Type: string
Thanks!