12 Replies Latest reply on Mar 16, 2016 5:53 AM by pierce.currid@citi.com

    Develop OSAPI

    div_gcet

      Hi everyone

       

      Pawan Shah can we create our own OSAPI ?

       

      I am trying to create one but facing errors as below.

       

      Here is service code:

       

      @Path("/spacefollowers")

      @Produces({"application/json"})

      @CoreApiExtensionService(name="ihs-followers-emailnotification-plugin", version="3")

      public class EmailsDataService extends AbstractService

      {

       

       

        @GET

        @Path("/emailsdata")

        @StaticJavaScriptMethod(name="osapi.jive.corev3.emailsdata.get")

        @RequiresAuthentication

        @Trace

        public List<EmailEntity> getEmailsData() throws BadRequestException, ForbiddenException, NotFoundException

        {

      Rest v3 service is working fine while facing "Could not fire onloadhandler Cannot read property 'get' of undefined" warning on crome browser console.  Looks my OSAPI method is recognized properly. Am I missing anything here ?

       

      Accessing it using

      osapi.jive.corev3.emailsdata.get().execute(function (response) {

        alert("Hello");

                });

       

      Please provide suggestions.

       

      Thank you

      Divya Garg

        • Re: Develop OSAPI
          div_gcet

          Would you like to update here Ryan Rutan

           

          Divya

          • Re: Develop OSAPI

            So while you can technically embed stuff into the JS API, this is something that isn't very common (at-least for non-Jive engineers). 

             

            That being said, you can achieve similar results with less headache by creating a standard service ....and then calling it using the examples similar to this:

            osapi.jive.core.get({ 

                v:"v3", 

                href:"/activities?count=2" 

            }).execute(function(response) { 

                console.log("Response is: " + JSON.stringify(response)); 

            }); 

            See this document for more details:

            Making REST API calls directly from a Jive app or tile

             

            Assuming the largest value you had was to be able to call the services with a known-context using osapi calls?

             

            Hope that helps.

            1 person found this helpful
              • Re: Develop OSAPI
                div_gcet

                Thanks Ryan Rutan this is helpful!.

                 

                I am using this rest URL: /api/core/ext/plugin-name/v3/spacefollowers/emailsdata and similar pattern  to be used in OSAPI call as well.

                 

                Tried

                osapi.jive.core.get({

                    v:"ext/plugin-name/v3",

                    href:"/spacefollowers/emailsdata"

                }).execute(function(response) {

                    console.log("Response is: " + JSON.stringify(response));

                });

                 

                and

                osapi.jive.core.get({

                    v:"ext",

                    href:"/plugin-name/v3/spacefollowers/emailsdata"

                }).execute(function(response) {

                    console.log("Response is: " + JSON.stringify(response));

                });

                 

                both are nor working. Please suggest if anybody tried it

                 

                Divya Garg