node.jsrestjive

Making REST API calls from jive app through jive platform to node client


I have a jive app and my node client has a REST API behind the URL http://[nodeclientIP]/myhook/[METHOD_NAME]. The problem is that the user can't reach the node client because it is behind a firewall. So i need to tell the jive platform to do this call for me and give me the result. Firs of all is this possible? If yes how?


Solution

  • You can also register the backend service "http://[nodeclientIP]/myhook/" using Jive Connects and then invoke the API method as below:

        osapi.jive.connects.get({
          alias : '[SERVICE_ALIAS]',
          href : '[METHOD_NAME]'
        }).execute(function(response) {
          ...
        });
    

    The advantages of this approach are for example that the URL or IP of the service can change without the need to change the code and install a new version of the app and that the definition of the service in Jive Connects can include things like Basic Authentication or oAuth so the app does not need to implement the authentication logic.