2

I am using Services module to register new users. My registration form has some custom fields like text field, radio buttons and select list. The following is the data I am sending:

{
"name" : "testapi",
"mail" : "test@test.com",
"pass" : "testapi",
"field_name" : {
"und" : [ { "value" : "Prashant TestAPI" } ]
},
"field_contact_no" : {
"und" : [{ "value" : "9898989898" }]
},
"field_user_sex " : {
"und" : [ { "value" : "male" } ]
},
"field_role_s_ " : {
"und" : [ {"value" : "developer"}, { "value" : "tester" } ]
}
}

The other fields like username, password, email and name(textfield) goes through fine but the sex is a radio button and role is a checkbox, those are not getting populated.

If there a specific way of handling those form types?

Update: I was able to get it to work with the following code.

{
"name" : "apiuser",
"mail" : “apiuser@example.com",
"pass" : "testapi",
"field_name" : {
"und" : [ { "value" : "Prashant TestAPI" } ]
},
"field_contact_no" : {
"und" : [{ "value" : "9898989898" }]
},
"field_user_sex" : {
"und" : "male"
},
"field_role_s_" : {
"und" : ["developer","other"]
}
}
0

The views datasource module is more handy. Try this module and create a view of the data you need to send.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.