{"action":"created","issue":{"url":"https://api.github.com/repos/jfinkels/flask-restless/issues/541","repository_url":"https://api.github.com/repos/jfinkels/flask-restless","labels_url":"https://api.github.com/repos/jfinkels/flask-restless/issues/541/labels{/name}","comments_url":"https://api.github.com/repos/jfinkels/flask-restless/issues/541/comments","events_url":"https://api.github.com/repos/jfinkels/flask-restless/issues/541/events","html_url":"https://github.com/jfinkels/flask-restless/issues/541","id":158064332,"number":541,"title":"[1.0.0b1] Post requests result in MissingData (Error 400)","user":{"login":"cryarchy","id":7136550,"avatar_url":"https://avatars.githubusercontent.com/u/7136550?v=3","gravatar_id":"","url":"https://api.github.com/users/cryarchy","html_url":"https://github.com/cryarchy","followers_url":"https://api.github.com/users/cryarchy/followers","following_url":"https://api.github.com/users/cryarchy/following{/other_user}","gists_url":"https://api.github.com/users/cryarchy/gists{/gist_id}","starred_url":"https://api.github.com/users/cryarchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryarchy/subscriptions","organizations_url":"https://api.github.com/users/cryarchy/orgs","repos_url":"https://api.github.com/users/cryarchy/repos","events_url":"https://api.github.com/users/cryarchy/events{/privacy}","received_events_url":"https://api.github.com/users/cryarchy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-02T05:49:09Z","updated_at":"2016-06-02T06:38:04Z","closed_at":"2016-06-02T06:38:04Z","body":"I have the following code:\r\n```python\r\n>>> import requests\r\n>>> data = {u\"username\":u\"cryarchy\", u\"password\":u\"Pass1234\", u\"email\":u\"email@domain.com\"}\r\n>>> url = \"http://localhost:5000/api/account\"\r\n>>> headers = {\"Content-Type\":\"application/vnd.api+json\", \"Accept\":\"application/vnd.api+json\"}\r\n>>> import json\r\n>>> r = requests.post(url, data=json.dumps(data), headers=headers)\r\n```\r\nafter the request, the flask-debug console displays the following:\r\n```\r\n127.0.0.1 - - [02/Jun/2016 08:33:03] \"POST /api/account HTTP/1.1\" 400 -\r\n{u'username': u'cryarchy', u'password': u'Pass1234', u'email': u'email@domain.com'}\r\n--------------------------------------------------------------------------------\r\nERROR in base [/home/user/tizy/MyFlask/e2-papers/venv/local/lib/python2.7/site-packages/flask_restless/views/base.py:726]:\r\n\r\n--------------------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/user/tizy/MyFlask/e2-papers/venv/local/lib/python2.7/site-packages/flask_restless/views/resources.py\", line 385, in post\r\n    instance = self.deserialize(data)\r\n  File \"/home/user/tizy/MyFlask/e2-papers/venv/local/lib/python2.7/site-packages/flask_restless/serialization.py\", line 693, in __call__\r\n    raise MissingData\r\nMissingData\r\n127.0.0.1 - - [02/Jun/2016 08:33:11] \"POST /api/account HTTP/1.1\" 400 -\r\n```\r\nThe data is getting printed on the debug window because I have the following **POST** preprocessor:\r\n```python\r\ndef post_vars_init(data=None):\r\n    if (not data):\r\n        raise ProcessingException(description=\"No data\", code=500)\r\n    print(data)\r\n```\r\n**NB:** I get the same results when I make the POST request from Angular2 post"},"comment":{"url":"https://api.github.com/repos/jfinkels/flask-restless/issues/comments/223208010","html_url":"https://github.com/jfinkels/flask-restless/issues/541#issuecomment-223208010","issue_url":"https://api.github.com/repos/jfinkels/flask-restless/issues/541","id":223208010,"user":{"login":"cryarchy","id":7136550,"avatar_url":"https://avatars.githubusercontent.com/u/7136550?v=3","gravatar_id":"","url":"https://api.github.com/users/cryarchy","html_url":"https://github.com/cryarchy","followers_url":"https://api.github.com/users/cryarchy/followers","following_url":"https://api.github.com/users/cryarchy/following{/other_user}","gists_url":"https://api.github.com/users/cryarchy/gists{/gist_id}","starred_url":"https://api.github.com/users/cryarchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryarchy/subscriptions","organizations_url":"https://api.github.com/users/cryarchy/orgs","repos_url":"https://api.github.com/users/cryarchy/repos","events_url":"https://api.github.com/users/cryarchy/events{/privacy}","received_events_url":"https://api.github.com/users/cryarchy/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T06:38:04Z","updated_at":"2016-06-02T06:38:04Z","body":"Noticed my mistake after a revisit to https://flask-restless.readthedocs.io/en/1.0.0b1/creating.html. The post request data format is what I'd got wrong. It should be:\r\n```python\r\ndata = {'data': {'attributes': {u'username': u'cryarchy', u'password': u'Pass1234', u'email': u'email@domain.com'}, 'type': 'account'}}\r\n```"}}
{"actor":{"display_login":"cryarchy"}}