0 Replies Latest reply on Mar 18, 2015 12:36 AM by kumar.harshvardhan

    How to Extracting Jive data into the external application

    kumar.harshvardhan

      Hello Jivers,

      I am new to jive development.My requirement is to get Jive Inbox data,inbox notification onto the external application using PHP script.

       

      I have run a sample php code with community URL.It is retuning value as 1 in the browser.If i am running with sandbox URL it is returning the value browser in browser as:

       

      { "id" : "1955", "resources" : { "entitlements" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/entitlements" }, "followingIn" : { "allowed" : [ "POST", "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/followingIn" }, "images" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/images/contents/117167" }, "comments" : { "allowed" : [ "POST", "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/comments" }, "followers" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/followers" }, "read" : { "allowed" : [ "POST", "DELETE" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/read" }, "self" : { "allowed" : [ "DELETE", "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167" }, "html" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/people/kumar.harshvardhan/status/1955" }, "externalURLs" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/urls/contents/117167" }, "extprops" : { "allowed" : [ "POST", "DELETE", "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/extprops" }, "likes" : { "allowed" : [ "GET" ], "ref" : "https://sandbox.jiveon.com/api/core/v3/contents/117167/likes" } }, "subject" : "Vacation coming up soon!", "type" : "update" }1

       

       

      Sample PHP Script:-

      <?php

       

              $url= 'https://community.jivesoftware.com/api/core/v3/people/username/username'; For Jive community

               $url = 'https://sandbox.jiveon.com/api/core/v3/contents?fields=subject                 For sandbox

           

          

       

          //open connection

          $ch = curl_init();

       

          //$fields_string = '{ "type": "discussion", "content": { "type": "text/html", "text":"Starting a discussion"}, "subject": "A new discussion1"}';

          $fields_string = '{ "type": "update", "content": { "type": "text/html", "text":"Vacation coming up soon!"}, "subject": "Vacation"}';

       

          //set the url, number of POST vars, POST data   

          curl_setopt($ch, CURLOPT_USERPWD, 'username:password');

          curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

          curl_setopt($ch,CURLOPT_URL,$url);

          curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);   

       

          //execute post

          $result = curl_exec($ch);       

           echo $result;

          //close connection

          curl_close($ch);

       

       

      ?>

      Please help to find the solution for my requirement.

       

      Thanks & Regards

      Kumar Harshvardhan