Headers
When you POST or PUT data to the REST API, at minimum set the
Content-Type header to application/json. However, you should generally specify two headers
when you post the log in request.
Example:
-
content-type: application/json ;charset=UTF-8
-
accept: application/json, text/plain, */*
Any of the following Accept headers are allowed with the
Content-Type header request header:
- accept: application/json
- accept-encoding: gzip, deflate, br
- accept-language:
en-US,en;q=0.8,und;q=0.6
How you specify the headers depends on the tools you are using:
- Postman - Use the tab titled Headers, where you can select
the header type and specify the value that you want.
- curl - Add headers to the request using the '-H' command line option (for
example, -H "Accept:application/json").
- A Programming Language - The HTTP library you are using likely has a call to set
the request headers.
If you get an "unsupported media type" error, it is likely that your
program did not specify the content-type header.