-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom api using extra_action gives error on POST request. #76
Comments
This is an issue with the header format sent with your request. |
Hello, Same problem here. Request URL Response Body But, using POSTMAN application and sending the parameters using the application/json, it works. I suspect a bug with swagger (as the api works correctly on tastypie side). I tried to print request.META.get('CONTENT_TYPE'). With postman I got "application/json", with swagger UI, got nothing. Hope it will help. |
…ome resource object (tastypie-mongodb)
Hi, I think I found the problem. |
Probably related to the swagger specs not being fully implemented. See here for a starting point. |
i also got same error my content type is application/json help me |
same issue with angularjs. |
I have added custom api using extra_action such as
class Meta:
extra_actions = [
{
'name': 'login',
'http_method': 'POST',
'resource_type':'list',
'fields':{
'username': {
'type': 'string',
'required': True,
'description':'Unique username required.'
},
'password': {
'type': 'string',
'required': True,
'description':'password required'
}
}
}
]
This display the api in doc as mentioned in attached picture.
But when i fill all mentioned fields and press "Try it Out" than it gives me error such as
{
"error_message": "The format indicated 'text/plain' had no available deserialization method. Please check your
formats
andcontent_types
on your Serializer.","traceback": "Traceback (most recent call last):\n\n File "/home/synerzip/educator-env/local/lib/python2.7/site-packages/tastypie/resources.py", line 195, in wrapper\n response = callback(request, _args, *_kwargs)\n\n File "/home/synerzip/Dropbox/Educator/educator-backend/educator/users/api.py", line 121, in login\n data = self.deserialize(request, request.body, format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n File "/home/synerzip/educator-env/local/lib/python2.7/site-packages/tastypie/resources.py", line 375, in deserialize\n deserialized = self._meta.serializer.deserialize(data, format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n File "/home/synerzip/educator-env/local/lib/python2.7/site-packages/tastypie/serializers.py", line 219, in deserialize\n raise UnsupportedFormat("The format indicated '%s' had no available deserialization method. Please check your
formats
andcontent_types
on your Serializer." % format)\n\nUnsupportedFormat: The format indicated 'text/plain' had no available deserialization method. Please check yourformats
andcontent_types
on your Serializer.\n"}
Please refer the attached image.
Thanks,
AbdulWahid
The text was updated successfully, but these errors were encountered: