[Solved]-Django REST: Unsupported media type 'application/xml' in request

8👍

Looks like you’re sending a request using XML content.

As the docs note, the obtain_auth_token view expect a JSON request.

Make sure the data is JSON encoded, and that you’re correctly setting the ‘Content-Type’ header to 'application/json.

1👍

It’s because django-rest-framework can return data in more than one format. It apparently decides on which format by looking at the “Accept:” HTTP header in the request. Try changing the value of this header to something like “application/json” for example.

Leave a comment