a-know / Pixela

A service for generating GitHub-like graphs. Record and Track your habits or effort. All by API.
https://pixe.la
402 stars 26 forks source link

GET - /v1/users/<username>/graphs/<graphID>/pixels – doesn't work with JSON #36

Closed Alex-V69 closed 3 months ago

Alex-V69 commented 3 months ago

I was having a hard time figuring out why I got '400' constantly. Apparently this endpoint doesn't support JSON because when I send parameters in the query string everything works, but when I send them as JSON data it doesn't.

a-know commented 3 months ago

@Alex-V69 Thank you for approaching. Yes. It is showed in our API document as examples: https://docs.pixe.la/entry/get-graph-pixels

Alex-V69 commented 3 months ago

Well, I just thought that since it wasn't mentioned in the documentation anywhere (that the only correct response form is a query string in a URL) it may be a bug – after all, 'Update a pixel', for instance, accepts parameters in JSON format.

a-know commented 3 months ago

@Alex-V69 Normally, the GET endpoint of the REST API cannot specify a request body, but specifies parameters with query string. The "Update a pixel" API is a PUT endpoint, so a JSON structure can be specified as the request body.

Alex-V69 commented 3 months ago

I see. Thank you for explaining that.