0

I have a user account, in this account I added a global fields. I am using services module for consuming users data.

I am performing CRUD operations on users account. In this account, normal fields are updated successfully and one more global field also updated by using PUT method.

But some user's global fields are not updated.

Example:

enter image description here

In this, first name and user email fields are updated when I perform PUT call, but check boxes fields are not updated.

And in my request content body I wrote this code:

URL: http://drupal.com/services/user/100

{
"uid":"100",
"mail":"example@gmail.com",
"current_pass":"xyz",
"field_first_name": {
            "und": [
                {
                    "value": "xyz",
                    "format": null,
                    "safe_value": "xyz"
                }
            ]
        },
"field_status": {
            "und": [
                {
                    "value": "1"
                }
            ]
        }
}

field status given 1, but field is not checked in user account.

Any suggestion?

  • The data you send is dependant on the widget you have specified for your fields. What widget(s) are you using? Also the user must have the administer users permission, or be logged in as their own account to update values. – tyler.frankenstein Sep 25 '15 at 14:14
  • widget type = boolean and these fields are global fields for users,and logged in as a user credentials. – RaMeSh Sep 25 '15 at 15:02
  • The field type is boolean, the widget can be single on/off checkbox, etc...? – tyler.frankenstein Sep 25 '15 at 16:53
  • boolean and single on/off only,how can i take these checkbox value in drupal json input format for update PUT call. – RaMeSh Sep 26 '15 at 14:44
  • Also try this field value: field_status: { und: { value: 1 }} - sometimes the delta value needs to be excluded, and sometimes the language code may need to be excluded - it is a bit unpredictable at times. – tyler.frankenstein Sep 27 '15 at 20:09

Your Answer

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

Browse other questions tagged or ask your own question.