2 Replies Latest reply on Jul 22, 2013 11:32 AM by CharlesSimon

    Accessing User Properties using REST API

      I am working with the REST API v3 in Jive 6 and there does not appear to be a way to get or update a user property.  These are the values stored in the JIVEUSERPROP table in the database.


      We are using those properties in Jive 4.5 for extended user management will need to do the same in Jive 6.


      Does anyone know if this is supported in Jive 6 using the REST API v3??

        • Re: Accessing User Properties using REST API

          Hi Charles,


          I used the following code to retrieve the value of a field, Company, that we had created in our Jive Users Profile.  It doesn't do any updates just retrieves the data.


          <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
          <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js"></script>
          <script type="text/javascript" charset="utf-8">

          function getCompanyName(){
          //getCompanyName:  Gets the company name of the logged in user from their profile
          //Get the current user id
                  var userid = window.parent._jive_current_user.ID;
          //Gets the complete URL of the widget
                  var url = window.location.href;
          //Gets the URL of the Jive site
                  var rootUrl = "http://"+window.location.hostname;

          //Contains the URL of the required API to get the data for the UserId
                  var restEndPoint = rootUrl + "/api/core/v3/people/" + userid;
          //Initialize the saveCompanyName
                                          var saveCompanyName = "NONE";
          //jquery get call
                          function(data,status) {
              //  The following are debugging statements that can be uncommented to help debug

                    //console.log("The Status:" + status);
                    //console.log("RestEndPoint: " + restEndPoint);
              //  Due to change in Jive, need to replace this error message so the code will not
              //  error out   
                              var jsonString = data.replace("throw 'allowIllegalResourceCall is false.';", "");
                              var json = JSON.parse(jsonString);
              //  Walk thru each member of the UserId group
              //  Save the Company Name
                              $.each(json, function(i, val) {
                                 if (i == "jive") {
               for (var p = 0; p < val.profile.length; p++)
                   if (val.profile[p].jive_label == "Company")
                           saveCompanyName = val.profile[p].value;

          //Update the the company name field on the widget with the user's company name.  Also set the default value
          //for the company name field to be the same.
                document.getElementById("TheCompanyName").value = saveCompanyName;
                document.getElementById("TheCompanyName").defaultValue = saveCompanyName;


            • Re: Accessing User Properties using REST API

              Thanks for the response.


              Unfortunately, we are not using profile fields, but are using user properties for the functionality and there appears to be no API to retrieve or update user properties.  I am not sure why we are using properties instead of profile fields, but c'est la vie.


              After some more digging into our current usage I found out that we have private Web service addition (via a plug-in) that allows access to the values in the JIVEUSERPROP table.  I will be upgrading this plug-in from Jive 4.5 to Jive 6.