ultimate_releases icon indicating copy to clipboard operation
ultimate_releases copied to clipboard

Special Chars on Rest API

Open DHA81 opened this issue 1 year ago • 6 comments

Started trying new Rest API Setting Volume on Audio Mixer via PUT failed because a + is needed on positive value, but it's a special char on html, so setting a positive value is impossible. Also removing "dB" from value would make usage a bit more easy.

DHA81 avatar Jan 03 '24 14:01 DHA81

Special chars need to be URL-encoded.

image

curl -v -X 'PUT' \
  'http://192.168.64.176/v1/configs/Audio%20Mixer/Vol%20Socket%201?value=%2B6%20dB' \
  -H 'accept: application/json'
*   Trying 192.168.64.176:80...
* Connected to 192.168.64.176 (192.168.64.176) port 80
> PUT /v1/configs/Audio%20Mixer/Vol%20Socket%201?value=%2B5%20dB HTTP/1.1
> Host: 192.168.64.176
> User-Agent: curl/8.4.0
> accept: application/json
>
< HTTP/1.1 200 OK
< Connection: close
< Content-Type: application/json
< Content-Length: 22
<
{
  "errors" : [  ]
* Closing connection
}%

Grrrolf avatar Jan 03 '24 21:01 Grrrolf

@Grrrolf Where/how did you get access to that neat Swagger-UI? :smile:

Does the Ultimate-64 provide the OpenAPI spec file? I didn't find anything about that in the official docs.

4ch1m avatar Jan 04 '24 18:01 4ch1m

@4ch1m wrote:

Does the Ultimate-64 provide the OpenAPI spec file?

No, unfortunately it doesn't. I'm creating one myself as a learning experience. I will most definitely share the resulting OAS with Gideon and if there are no kinks, then also with the community.

Grrrolf avatar Jan 04 '24 19:01 Grrrolf

@Grrrolf - oh, I just started a project to supply an OpenAPI spec file. Are you still working on it? If not, can I have it so I can save some work? :-)

matozoid avatar Mar 19 '24 09:03 matozoid

I am. I can create a repo and we can work on it together and anyone who likes to join, can also help. Just create a branch and provide a pull request with the changes.

What needs to be done is finishing it. I did a lot of copy and paste and as a result there may be duplicate information but with the wrong requests and such. Also, status codes are not complete and also have this issue of too much copy and paste :)

It's the first stime I try making an open API spec and it's a learning experience too.

Grrrolf avatar Mar 19 '24 18:03 Grrrolf

@matozoid, I have added / invited you as a collaborator (not a word us Dutchies would use in Dutch ;-) ).

Find the repo here: https://github.com/Grrrolf/u2plus-open-api-spec

Feel free to improve, fix, add, remove and make it easier to maintain.

Grrrolf avatar Mar 19 '24 18:03 Grrrolf