14 Replies Latest reply on Jun 14, 2016 4:41 AM by yogesh.r

    osapi.jive.connects.post  return the error code 1004

    yogesh.r

      Hi Siddhartha Deshpande, Pawan Shah, Scott A Johnson

       

      I'm trying to update  bulk tagging in selected content Id's  with below code.

      osapi.jive.core.get({

                          v: "v3",

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

                      }).execute(function (response) {

                          tags = response.tags;

                          osapi.jive.connects.post({

                              authz: "signed",

                              alias: "contentService",

                              headers: {"Content-Type": "application/json"},

                              format: 'json',

                              href: '/updateContent',

                              body: {jiveContent: {'tags':_.union(tags,newTags)}, contentId: contentId}

                          }).execute(function (response) {

                              if(response.error){

                                  result.failedIds.push(contentId);

                              }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()

                              }

      The  osapi.jive.connects.post return the following result. any Help how to fix this issue.

       

      [{"result":{"error":{"code":1004,"message":"Application instance needs configuration before it can be used"},"content":"","headers":{},"status":503},"id":"jive.connects.post"}]

       

      Thanks

      yogesh

        • Re: osapi.jive.connects.post  return the error code 1004
          siddhartha107

          Hey, find the commented solutions with -->

           

          I'm trying to update  bulk tagging in selected content Id's  with below code.

          --> I assume this code is taken from the content_manager app that we have open sourced.

           

          osapi.jive.core.get({

                              v: "v3",

                              href: "/contents/" + contentId + ""  // --> contentID to be req to get the content

                          }).execute(function (response) {

                              tags = response.tags;

                              osapi.jive.connects.post({

                                  authz: "signed",

                                  alias: "contentService",  // --> this is a custom service we had built to connect so you need to configure the same

                                  headers: {"Content-Type": "application/json"},

                                  format: 'json',

                                  href: '/updateContent',  // --> this is the server endpoint that we had used to handle the request

                                  body: {jiveContent: {'tags':_.union(tags,newTags)}, contentId: contentId}

                              }).execute(function (response) {

                                  if(response.error){

                                      result.failedIds.push(contentId);

                                  }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()

                                  }

           

          --> so to make this code run you need to make the middleware changes and hence you are getting

          [{"result":{"error":{"code":1004,"message":"Application instance needs configuration before it can be used"},"content":"","headers":{},"status":503},"id":"jive.connects.post"}]

           

           

          --> so the above commented solutions to make the snap you posted to work but you can write other logic to make it work.

          like osapi.jive.core.post{} to update the content.

          You can refer: Making REST API calls directly from a Jive app or tile

           

          Thanks,

          Sidd

          • Re: osapi.jive.connects.post  return the error code 1004
            yogesh.r

            Hi Siddhartha Deshpande     

            I have not  created an end-point in server side code with 'updateContent'.

            Can u share me the screenshot how to do this.

             

            Notes:Current the content manager app deployment process

            1) Copied the all the content manager folder (html, JavaScript, style-sheets) into  IIS server.

            2)in extension zip . I have pointing out the directory of the app

            3)created the content service.- "even without this service configuration two functions(move and delete ) are working"

            4)the app.xml as below

             

            <?xml version="1.0" encoding="UTF-8"?>

            <Module specificationVersion="1">

                <ModulePrefs title=""

                             description="ContentManager jive-sdk app"

                             author=""

                             author_affiliation=""

                             author_email="">

                    <!-- Commonly used features -->

                    <Require feature="dynamic-height"/>

                    <Require feature="embedded-experiences"/>

                    <Require feature="jive-core-v2" />

                    <Require feature="jive-core-v3"/>

                    <Require feature="minimessage"/>

                    <Require feature="setprefs"/>

                    <Require feature="osapi"/>

                    <Require feature="views"/>

                    <Require feature="jive-connects-v1">

                        <Param name="alias:contentService|title:contentService">jive:service://dev-ext.testsite.com/ContentManageApp</Param>

                    </Require>

                    <Require feature="actions">

                        <Param name="action-contributions">

                            <![CDATA[

                            <action id="org.jivesoftware.movecontent.space"

                              path="jive/tabs/places/space"

                              label="Content Manager"

                              view="contentManager"

                            />

                            <action id="org.jivesoftware.movecontent.group"

                              path="jive/tabs/places/group"

                              label="Content Manager"

                              view="contentManager"

                            />

             

                            <action id="com.jivesoftware.launcherlessapp"

                              path="jive/apps/launcher?filter=false()"/>

             

             

                        ]]>

                        </Param>

                    </Require>

             

             

                    <Link rel="Icon"       href="https://dev-ext.testsite.com/ContentManageApp/images/moveContent128x128.png" />

                    <Link rel="MediumIcon" href="https://dev-ext.testsite.com/ContentManageApp/images/moveContent128x128.png" />

                    <Link rel="LargeIcon"  href="https://dev-ext.testsite.com/ContentManageApp/images/moveContent128x128.png" />

             

             

                    <Optional feature="content-rewrite">

                        <Param name="include-url">*</Param>

                        <Param name="exclude-url"></Param>

                    </Optional>

             

             

                </ModulePrefs>

                <Content type="html" view="contentManager" href="https://dev-ext.testsite.com/ContentManageApp/contentManager.html" preferred_height="1000"/>

                <Content type="html" view="embedded,canvas" href="canvas.html" />

             

             

            </Module>

             

            Please this all about my application configuration & deployment.

            Let me know to do the end-point service configuration.

             

            Thanks

            Yogesh

              • Re: osapi.jive.connects.post  return the error code 1004
                siddhartha107

                interesting!

                have you checked whether the service is configured? could you do some sanity on the same?

                plus you could see some docs around configuring service using jive apis.

                as you said you have used content manager app code; there must me an end-point 'updateContent' in explicit_routes. Could you confirm if its there?

                move content and delete content would work as they dont require service side communication.

                lemme know.

                 

                Sidd

                  • Re: osapi.jive.connects.post  return the error code 1004
                    yogesh.r

                    we configured the App service for the application as in previous comment

                    I didn't configured the service using jive apis.

                    Yes the  updateContent method is present in content.js file in current directory.

                    the application folder deployed in IIS.  ITs required some service configuration.

                     

                    before heading to configuring the service in Jive side.. I am trying to using REST API

                    osapi.jive.core.put({

                      v:"v3",

                      href:"/Contents"+ contentId + "",

                      body: {'tags':_.union(tags,newTags),contentId: contentId},

                      }).execute(function (response)

                     

                    This methods returns the  204 status code.. with code block contents updated successfully but tags are not applied to contents..

                     

                    Please any suggestion  ..if anything missing to update tags in the contents thorough osapi.jive.core.put.

                     

                    Thanks

                    Yogesh

                • Re: osapi.jive.connects.post  return the error code 1004
                  yogesh.r

                  Siddhartha Deshpande

                   

                  Still  tags are  not applying to the contents its shows the contents are updated successful .. the status code 204

                   

                  While passing the body : content  (tags are there i have verified in the console)

                   

                  Thanks

                  Yogesh

                  • Re: osapi.jive.connects.post  return the error code 1004
                    yogesh.r

                    Hi

                     

                    siddarth : if possible will have one screen sharing session

                    Code snippet :

                    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'] = newTags;

                      osapi.jive.core.put({

                      v:"v3",

                      href:"/Contents/"+ contentId + "",

                      body: content,

                      }).execute(function (response)

                      {

                      console.log(response);

                                            if(response.error){

                                                result.failedIds.push(contentId);

                                            }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++;

                                        });

                                    });

                                }

                    • Re: osapi.jive.connects.post  return the error code 1004
                      yogesh.r

                      Thanks you!!  Siddhartha Deshpande   The tagging works fantastic using REst API's,

                      I have few questions on tagging in content manager app.

                      • apply tags will updating tags to contents with entered tags or adding the tags to existing tags list ?
                        • content['tags']= newTags  ----->Its updating with entered tags from app
                      • Events are not moving b/w groups/space and Tags are not updating to events. Is there  required any configuration permission issue with events.
                        • ex error message : [{"result":{"status":400,"error":{"code":"400","message":"api.core.v3.error.missing_event_access"}},"id":"jive.core.put"}]

                       

                      Thanks!

                      Yogesh

                      • Re: osapi.jive.connects.post  return the error code 1004
                        yogesh.r

                        Hi Siddhartha Deshpande

                         

                        Whenever the bulk tag operation is happening .. for few of the contents tag are not applying..

                        Ex : 3 to 5 are faling out of 25 tagging.

                        It's return the below error

                        "

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

                          

                         

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

                         

                        Thanks

                        Yogesh