4 Replies Latest reply on Apr 28, 2017 4:55 PM by mbrybag

    Unable to add values to custom profile fields using the api Person service if the field is blank

    mbrybag

      Hi All,

      We are currently on Jive 7.0.3.1. I've been trying to call the Jive 3.0 api person service via PUT /people/{personID} to update a custom user profile field but it only works if that field already has a value in it, not if its blank and needs an initial value.

       

      Steps are as follows:

      1. In the admin console, I created a custom profile field (text) under profile settings called "Jive Share Community"

          I am able to look up a user record in the admin console and manually update this field.

      2. I created an application that makes an api call and retrieves the user record by issuing a GET request to the people service in the following form: /people/[userid]

      3. The application receives a JSON response from Jive with a Person object where the Profile struct resembles this:

          "profile": [

            {

              "jive_label": "Title",

              "value": "Application Developer"

            },

            {

              "jive_label": "AboutMe",

              "value": "Interesting facts about me that I totally didn't make up..."

            },

            {

              "jive_label": "Department",

              "value": "Information Technology"

            },

            {

              "jive_label": "Street",

              "value": "Anton Dragtenweg 54"

            },

            {

              "jive_label": "City",

              "value": "Paramaribo"

            },

            {

              "jive_label": "Jive Share Community",

              "value": "Librarian"

            }

          ]

       

      4. The application sets the profile.Jive Share Community value  to "Tech Team". EG:

      {"jive_label": "Jive Share Community","value": "Tech Team"  }

       

      5. The application then updates the user's custom profile field with a call to PUT /people/{personID} sending the modified "person" JSON object returned in the original call. This works perfectly and I can see the above user in the admin console has their Jive Share Community value updated.

       

      Where this doesn't work is if the user starts off with a blank value in this field. In this case, i expected the Person object returned in the first call to have a blank value for profile.Jive Share Community, however, that key/value pair is missing entirely in the response. EG:

       

          "profile": [

            {

              "jive_label": "Title",

              "value": "Application Developer"

            },

            {

              "jive_label": "AboutMe",

              "value": "Interesting facts about me that I totally didn't make up..."

            },

            {

              "jive_label": "Department",

              "value": "Information Technology"

            },

            {

              "jive_label": "Street",

              "value": "Anton Dragtenweg 54"

            },

            {

              "jive_label": "City",

              "value": "Paramaribo"

            }

          ]

       

      So my first thought was since this custom field already exists on the user profile, I could just append the Jive Share Community key/value pair to the Profile Struct and update via the API that way. However when I do this I get the following error:

       

      400 Bad Request {
         "error" : {
           "message" : "Invalid field name Jive Share Community"

       

      Is it not possible to provide an initial value for a custom profile field via an API call or am I doing something wrong? I allso tried POSTing this update via extprops but as this is a custom field and not an external property, that call obviously fails.

       

      Any ideas?