Strange API response encoding

simor3 months ago

Hi,

While trying to evaluate the APIs exposed on the demo server (demo.traccar.org) in Postman, when I call the endpoint api/reports/trips with the parameters "deviceId", "from", and "to", I receive a 200 status code, but the response body is not in JSON format. Specifically, I get something like the following:

Postman screenshot

Am I doing something wrong?

Best regards,
Simone

simor3 months ago

[More infos:] I'm using basic auth as authorization and I'm sure is well defined because others endpoints work with that.

Anton Tananaev3 months ago

You forgot to provide the Accept header to indicate the format you want.

simor3 months ago

By default in Postman is setted to */*
should it be application/json ?

Anton Tananaev3 months ago

If you want JSON - yes.