POST: error 451 "Unsupported media type 'text/plain' in request."

12,802 views
Skip to first unread message

Stefano Tranquillini

unread,
Apr 8, 2013, 12:30:57 PM4/8/13
to django-res...@googlegroups.com
HI all.
i've developed the api using the framework and they work pretty well with python and request.
now i've to (i have to, if it's not clear :D) to develop the same call in Java.

i tried out and this is what i get:

{"detail": "Unsupported media type 'text/plain' in request."}

does anyone of you know why?


ciao

Tom Christie

unread,
Apr 8, 2013, 12:39:38 PM4/8/13
to django-res...@googlegroups.com
Hi Stefano, you need to make sure you're setting the 'Accept' header correctly to 'application/json'.
It's currently being set to 'text/plain' by the client for whatever reason.
Perhaps in the `webResource.type(...)` line?
Hope that helps some...

  Tom

(One of these fine days we'll have to get together some better troubleshooting notes for the various possible error responses.)


--
You received this message because you are subscribed to the Google Groups "django-rest-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Stefano Tranquillini

unread,
Apr 8, 2013, 2:37:06 PM4/8/13
to django-res...@googlegroups.com
thanks. 
i was using the wrong settings. now it works. 
too many hours doing the same things and this is what happens. 
sorry for the non-problem.

ciao


--
You received this message because you are subscribed to a topic in the Google Groups "django-rest-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/e9s8xggthFg/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Stefano

Roman

unread,
Jul 28, 2020, 9:13:21 AM7/28/20
to Django REST framework
Hello thanks guys.
It helps to get result.
Enter info into Body-raw section. And switch TXT to JSON there! 

понедельник, 8 апреля 2013 г., 20:30:57 UTC+4 пользователь Stefano Tranquillini написал:
Reply all
Reply to author
Forward
0 new messages