Django & TastyPie: request.POST is empty -


i'm trying post using curl:

curl --dump-header - -h "content-type: application/json" -x post --data '{"item_id": "1"}' http://www.mylocal.com:8000/api/1/bookmarks/ 

however, request.post empty.

below modelresource code:

class bookmarkresource(modelresource):       class meta:         queryset = bookmark.objects.all()             resource_name = 'bookmarks'         fields = ['id', 'tags']         allowed_methods = ['get', 'post', 'delete', 'put']         always_return_data = true         authorization= authorization()         include_resource_uri = false      def determine_format(self, request):         return "application/json"      def obj_create(self, bundle, **kwargs):          request = bundle.request          try:             payload = simplejson.loads(request.post.keys()[0])         except:             payload = simplejson.loads(request.post.keys()) 

anybody knows i'm missing?

thanks in advance.

starting @ django 1.5, post not contain non-form data anymore. in request.body.

https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.httprequest.post


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -