Strange API response encoding

simor 2 years 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

simor 2 years ago

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

Anton Tananaev 2 years ago

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

simor 2 years ago

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

Anton Tananaev 2 years ago

If you want JSON - yes.