14 Replies Latest reply on Aug 3, 2017 2:15 AM by gopi.gorantala

    How to update Title for users via API

    greg.wright@act-on.net

      Can anyone help me out with updating the Title field for our users via API?

      Thanks!

        • Re: How to update Title for users via API

          Title meaning "Job Title"?  Using cloud, Jive 7 or 8?

           

          In short, you'd start with the:

          Jive REST API v3.14 → Person service

           

          Depending on the version of Jive, you may just have to do a Get Person / Set Person operation for each result in /people/@all

           

          If you are running cloud, there are some new capabilities coming out around PATCH support for individual profile fields...that should work for you!  More to come on that after JiveWorld, unfortunately!

           

          Does this help at all?

           

          Note: REST API v3 Examples is a good document to check out for some good portable calls to the API.

            • Re: How to update Title for users via API
              greg.wright@act-on.net

              Thanks for the quick response!

              We are on cloud and you are correct that I'm trying to update Job Title. It shows as just Title in the UI.

              I manually added a title to my profile and did a GET. Below is what I'm looking to update via API.

              "profile" : [ {

                    "jive_label" : "Title",

                    "value" : "Director of Technical Operations",

                    "jive_displayOrder" : 0,

                    "jive_summaryDisplayOrder" : 0,

                    "jive_showSummaryLabel" : true

                  }

               

              I hope that helps. Please let me know if you need more detail.

              Thanks!

                • Re: How to update Title for users via API

                  Since you are using cloud, this is some new capability that the documentation is a bit lean on at the moment, will be discussing more at JiveWorld, it should work, but I haven't had a chance to try it myself.  Perhaps Steve Vorhees can share some insights if there are issues?

                   

                  Using HTTP Basic or an OAuth token that is authorized to update the Person object.

                   

                  PATCH /api/core/v3/people/{personID}, or

                  PUT /api/core/v3/people/{personID} (see notation below)

                   

                  Headers:

                  Content-Type: application/json-patch+json

                  X-HTTP-Method-Override: PATCH

                  Note: X-HTTP-Method-Override is only needed when not using a proper PATCH verb

                   

                  Body:

                  [

                       {

                            "op" : "replace",

                            "path" : "/jive/profile/title",

                            "value" : "Your Value"

                       }

                  ]

                  Hope this helps.

                  1 person found this helpful
                    • Re: How to update Title for users via API
                      greg.wright@act-on.net

                      I'll give it a shot and keep you posted. Thanks!

                      • Re: How to update Title for users via API
                        pawans

                        Interesting update Ryan. Good for updating custom profile fields

                          • Re: How to update Title for users via API
                            greg.wright@act-on.net

                            Hi guys,

                            I finally got a chance to test and I'm getting the following error:

                            {

                              "error": {

                                "message": "Invalid field name title",

                                "context": "peopleInvalidFieldName",

                                "status": 400

                              }

                            }

                             

                            Here is my PUT request:

                            PUT /api/core/v3/people/2017 HTTP/1.1

                            Host: thepub.jiveon.com

                            Authorization: <auth>

                            Content-Type: application/json-patch+json

                            X-HTTP-Method-Override: PATCH

                            Cache-Control: no-cache

                            Postman-Token: <token>

                             

                            [

                                 {

                                      "op" : "replace",

                                      "path" : "/jive/profile/title",

                                      "value" : "Your Value"

                                 }

                            ]

                             

                            Any idea why this is happening?

                            Thanks!

                              • Re: How to update Title for users via API
                                greg.wright@act-on.net

                                Figured it out... title needs to be capitalized.

                                [

                                     {

                                          "op" : "replace",

                                          "path" : "/jive/profile/Title",

                                          "value" : "Your Value"

                                     }

                                ]

                                 

                                Thank you all very much for the help!

                                  • Re: How to update Title for users via API
                                    greg.wright@act-on.net

                                    Hi Ryan,

                                    Thanks for getting me on the right path with this! The next step is to convert my request to cURL so I can batch update Titles.

                                    Here are the commands I'm trying with corresponding errors:

                                     

                                    WITH PATCH

                                    $ curl --user user:pass -i -X PUT -H "Content-Type: application/json-patch+json" -H "X-HTTP-Method-Override: PATCH" -d "{""op"":""replace"",""path"":""/jive/profile/Title"",""value"":""Senior dishwasher""}" https://thepub.jiveon.com/api/core/v3/people/2017

                                    {                                                                               

                                      "error" : {                                                                   

                                        "message" : "Invalid JSON PATCH was found with operation null and path null",

                                        "status" : 400                                                              

                                      }                                                                             

                                    }                                                                               

                                     

                                    WITHOUT PATCH

                                    $ curl --user username:pass -X PUT -H "Content-Type: application/json-patch+json"  -d "{""op"":""replace"",""path"":""/jive/profile/Title"",""value"":""Senior dishwasher""}" https://thepub.jiveon.com/api/core/v3/people/2017

                                    {

                                      "error" : {

                                        "status" : 400,

                                        "message" : "Missing email address with Jive label of 'email'"

                                      }

                                    }

                                     

                                    Any idea what I'm missing here?

                          • Re: How to update Title for users via API
                            niharika1108

                            Hi Ryan Rutan,

                             

                            We have the similar requirement but we are on the hosted 9 instance. I tried with the similar step as you mention for cloud but it didn't work. Can you please help how to update the title for hosted instance.

                             

                             

                            Update:

                             

                            I tried with some other REST client and it worked, But I am getting a strange behavior. The API is not updating a federated user title however for unfederated user's title is updating with this api. Is there anything we cannot update federated user title with this. Can you Please clarify.

                              • Re: How to update Title for users via API
                                gopi.gorantala

                                Is your user-account(unfederated super admin account which has admin rights to update all jive users), has got proper rights to update user-profile fields ??

                                 

                                I just tried and I am able to update a user title with Basic Auth using REST Client with the below payload

                                 

                                 

                                {

                                            "emails" : [ {

                                            "value" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",

                                                    "type" : "work",

                                                    "primary" : true,

                                                    "jive_label" : "Email"

                                        } ],

                                            "jive" : {

                                                    "username" : "XXXXXX",

                                                    

                                                      "enabled" : true,

                                                      "profile" : [ {

                                                            "jive_label" : "Title",

                                                            "value" : "XXXXXXXXXXXXXXXXXXXXXXXXX",

                                                            "jive_displayOrder" : 0,

                                                            "jive_showSummaryLabel" : false

                                                                }]

                                                       

                                        },

                                            "name" : {

                                            "familyName" : "XXXXXXX",

                                                    "givenName" : "XXXXXXXXXXXXXXXXXXXXXXXXX"

                                        }

                                        }