4 Replies Latest reply on Jun 17, 2016 5:23 AM by yogesh.r

    bulk tags update in OSAPI failed for few content id's

    yogesh.r

      Hi Siddhartha Deshpande

       

      I'm trying to update the bulk tagging operations in content manager app using the custom osapi which is failing for few of the contents in selected contents id's

      osapi.jive.core.get({

         v: "v3",
         href: "/contents/" + contentId + "" 
      }).execute(function (content) {

        content['tags'] = newTags;  //-- updated the content object; newTags is just a sample variable
         osapi.jive.core.put({   //-- make a put call

         v:"v3",
         href:"/contents/"+ contentId + "",
         body: content

        }).execute(function (updatedContent){

         console.log(updatedContent);
         });
      });

      In Console Error as below :

       

      "

      • Not able to do any operation on events  it will return the below error message

       

       

      [{"result":{"error":{"code":"objectNotFound","message":"Security Group ID 1001 does not exist"},"status":404},"id":"jive.core.get"}]

       

      Q) how to make all the selected content id's got  updated

       

      Thanks

      Yogesh

        • Re: bulk tags update in OSAPI failed for few content id's
          bharatpec

          Hey Yogesh,

           

          Please verify that the first call (GET) is working fine. Please share the output if possible. Are you getting the content correctly?
          If yes, then please check that the newTags is a string / comma separated string of strings.

          • Re: bulk tags update in OSAPI failed for few content id's
            yogesh.r

            Hi Bharat Sethi  Scott A Johnson Pawan Shah Siddhartha Deshpande

             

            I'm doing for array of content id's  & I have tested all the list of content id's  individually GET methods.. it return the correct response.

            i'm implementing the content manager app bulk tagging in your jivesite  using this link https://community.jivesoftware.com/community/developer/blog/2015/10/01/content-manager-app-the-idea-into-reality

             

             

            This update tags doing through osapi ..

            var updateTags = function (newTags) {

             

                    var deferred = Q.defer();

                    var selectedContentIds = viewHandler.getSelectedContentIds();

                    var result = {'successIds':[],'failedIds':[]}

                    var counter = 1;

                    _.forEach(selectedContentIds, function (contentId) {

                            var tags = [];

                            osapi.jive.core.get({

                                v: "v3",

                                href: "/contents/" + contentId + ""

                            }).execute(function (content) {

              content['tags'] = _.union(content['tags'],newTags);

              //Making REST API calls directly from a Jive app

              osapi.jive.core.put({

              v:"v3",

              href:"/contents/"+ contentId + "",

              body: content,

              }).execute(function (response)

              {

              console.log(response);

                                   if(response.error){

              result.failedIds.push(contentId);

               console.log(result.failedIds)

                }

              else{

                                        result.successIds.push(contentId);

                                    }

                                    if(counter==selectedContentIds.length){

                                        deferred.resolve(result);

                                        $("#spinner").hide()

                                    }

                                    counter++;

                                },function(error){

                                    result.failedIds.push(contentId);

                                    if(counter==selectedContentIds.length){

                                        deferred.resolve(result);

                                        $("#spinner").hide()

                                    }

                                    counter++;

                                });

                            });

                        }

                    )

                    return deferred.promise;

                }

             

            -- but  some of the content's Tags are getting updated . some contents are failing with below message.

             

            Thanks

            Yogesh

              • Re: bulk tags update in OSAPI failed for few content id's
                siddhartha107

                hey,

                I guess you are not using the exact code that we have open sourced; since I can see you have done some customisations.

                The snippet I had shared with you was the generic and had referred to,

                Making REST API calls directly from a Jive app or tile

                The above link i had used to give a work around since there were some service configuration issue you were facing.

                 

                this is a generic code;

                osapi.jive.core.get({

                   v: "v3",
                   href: "/contents/" + contentId + "" 
                }).execute(function (content) {

                  content['tags'] = newTags;  //-- updated the content object; newTags is just a sample variable
                   osapi.jive.core.put({   //-- make a put call

                   v:"v3",
                   href:"/contents/"+ contentId + "",
                   body: content

                  }).execute(function (updatedContent){

                   console.log(updatedContent);
                   });
                });

                 

                if you are not able to tag the events with this then you could try javascript apis to check it.

                 

                Thanks,

                Sidd

              • Re: bulk tags update in OSAPI failed for few content id's
                yogesh.r

                Hi Siddhartha Deshpande

                 

                I have  not using the any service configuration in app. 

                in bulk tagging & categories i'm using  REST API calls directly from a app.

                issue :

                1) Events are not pulling in the app.

                2) In bulk tagging operation, few of the content  tags are not applying.

                 

                I have done the few things;

                I reiterate tagging for  the failed  contents id's .

                 

                Thanks

                Yogesh