This is mostly a note to myself. When calling the user.register method for the Services module, the JSON data format is a little wonky:
{
"mail":"[email protected]",
"postal_code":"21401",
"account":{
"name":"username",
"pass":"password",
"mail":"[email protected]"
},
"field_name":{
"und":[
{
"family":"Grasmick",
"given":"Matthew"
}
]
}
}
Notice that 'mail' must be included twice. Depending on which one is missing, you may receive one of these two errors:
- 406 Not Acceptable: E-mail field is required.
- 401 Unauthorized: Missing required argument account
As for additional fields, such as field_name, must be defined as top-level properties in the JSON object and NOT nested in the 'account' sub-object. A little odd.
Still getting "401 Unauthorized: Missing required argument account" ? You probably messed up the JSON syntax. Check it with a JSON validator.
How to pass field_name_first[und][0][value]
field_name_first[und][0][value] i have first name value how to pass this key in json i got following error...
<?xml version="1.0" encoding="utf-8"?>
<result>
<form_errors>
<field_name_first__und__0__value>First Name field is required.</field_name_first__und__0__value>
<field_name_last__und__0__value>Last Name field is required.</field_name_last__und__0__value>
</form_errors>
</result>
Thanks.. for article ...
Add new comment