Jive's Open Social API Overview

Version 16

    When creating a UI for an App or a Tile, you have access to many different types of functions through Jive's open social JavaScript API. These APIs give you access to the content, people, and places within your Jive community. Some of these calls overlap with the Jive REST API, others are unique to the Jive open social API. This document provides an overview of the basic types of functions that are available, along with links to reference documentation where you can find more information.

     

    This document is not a tutorial. If you are looking for a basic tutorial related to building an App or a Tile that can use the open social API, refer to:

     

    The following topics are covered in this document:

     

    Create, Modify, or Delete Item

     

    These functions allow you to manipulate content, people, and places in your Jive community. You can start a discussion, delete a document, create a comment, etc.

     

    Example

    This example creates a new document.

     

    osapi.jive.corev3.documents.create({
       type:"document",
       content: {  type: "text/html",
          text: "<body><p>Hello!</p></body>"
        },
        subject: "Hello world!"
    });
    
    
    
    
    
    
    
    
    
    
    
    

     

    For More Information

     

    Pick From Existing Items

     

    These functions allow you to prompt the user to pick one or more items from a list of content, people, or places.

     

    Example

    This example prompts the user to pick from a list of existing people.

     

    osapi.jive.corev3.people.requestPicker({
       success: function(data) { ... },
       error: function(data) { ... },
       multiple: true
    }).execute (...);
    
    
    
    
    
    
    
    
    
    
    
    

     

    For More Information

     

    Get Existing Item

     

    These functions allow you to query your Jive community for information about existing content, people, or places.

     

    Example

    This example gets an existing document.

     

    var documentURI = // Get URI with picker
    
    var request =
       osapi.jive.corev3.contents.get({
          "type": "document",
          "uri": documentURI,
          "fields": "@all"
    });
    
    request.execute(function(data) {
        ...
    });
    
    
    
    
    
    
    
    
    
    
    
    

     

    For More Information

     

    Interact with Rich Text Editor (RTE)

     

    This function allows you to interact with the RTE. This is applicable when you are building bang app (!app) functionality.

     

    Example

    This example inserts content into the current document.

     

    osapi.jive.core.container.editor().
      insert("<table><tr><td><b>Some markup!</b>
              </td></tr></table>");
    
    
    
    
    
    
    
    
    
    
    
    

     

    For More Information

     

    Save App Data

     

    These functions allow you to save, modify, or delete application-specific information to the Jive server.

     

    Example

    This example saves application data (a key/value pair) to the Jive server.

     

    var update = function( key, value, success, error ) {
              var obj = {};
              obj[key] = value;
              osapi.appdata.update({
                data : obj,
                userId: '@me',
                escapeType: opensocial.EscapeType.NONE
              }).execute(function(response) {
                if (response.error) {
                   if ( error ) error();
                } else {
                   if ( success ) success();
                }
              });
         };
    
    
    
    
    
    
    

     

    For More Information

     

    Modify User Preferences

     

    You can also modify user preferences, as described in this document: Working with User Preferences.

     

    Acquire Security Group Information

     

    These functions allow you to access information about security groups.

     

    Example

    This example determines whether the current user is an administrator. It responds with status code 200 if the user is an administrator; returns 403 if not.

     

    osapi.jive.corev3.securityGroups.get({"id":"@registered"}).execute(function(data){
       showResult(data);
    });
    
    
    
    
    
    
    

     

    For More Information