Search code examples
jsonrestdrupal-7

Unable to POST to custom user registration field Services 3.0 Drupal


When trying to post to my custom zip code field on user registration form it get the following:

post data to endpoint/user/register.json

{
"name":"testuser123",
"pass":"testuser123",
"mail":"[email protected]",
"field_zip_code":{
"und": {
"0": {
"postal": {
"value":"11209"}
}
}
}
}

response:

{
"form_errors": {
"field_zip_code][und][0][postal": "Postal Code field is required."
}
}

If make the zip code field not required - the post is successful (user is created) but zip is not entered. Seems like the field is missing the start and end brackets - not sure if that is relevant.

See screenshot for the form data that i believe i matched with the post: http://puu.sh/rRU34/1fe628599c.png

Any help is appreciated.


Solution

  •   "field_zip_code":{"und": [{"postal": "11111"}]}
    

    was the correct format.