GideonZ / ultimate_releases

Binary blobs of U2/U2+ and U64 firmware versions
71 stars 5 forks source link

Special Chars on Rest API #39

Open DHA81 opened 8 months ago

DHA81 commented 8 months ago

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.

Grrrolf commented 8 months ago

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
}%
4ch1m commented 8 months ago

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

Grrrolf commented 8 months ago

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

matozoid commented 5 months ago

@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? :-)

Grrrolf commented 5 months ago

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 commented 5 months ago

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