REST API v3 Examples

    Introduction

    This document contains REST API v3 examples. Please edit it to add more examples.

    Comments are not allowed as issues are better discussed as new threads within Developer.

     

    Replace '$CURL' with 'curl -v -u Username:Password -k --header "Content-Type: application/json" -d' in the examples below.

    CURL='curl -v -u Username:Password -k --header "Content-Type: application/json" -d'

    API 3.3 requires a "Content-Disposition:" header with an (empty) "name=" parameter in each part of a multipart request. REST API 3.3 (Jive7c3) multipart upload broken? The examples below will fail with an "We're sorry but a serious error has occurred in the system." error message.

     

    Content Creation

    Create a public document

    $CURL ...

     

    Create a private document for users A, B and me

    $CURL ...

     

    Create a private document with tags

    $CURL '{"visibility": "hidden", "content": {"type": "text/html", "text": "<body><p>Here comes the document body.</p></body>"},"subject": "My private document", "tags": [one, two, three] ,"type": "document"}' "https://sandbox.jiveon.com/api/core/v3/contents"


    Create a private document with an attachment

    !! Discussions with attachments require JIVE-20794

    curl -v -u Username:Password --header "Content-Type: multipart/form-data; boundary=SNIP" -d $'--SNIP\r\nContent-Type: application/json\r\n\r\n{"type": "document", "subject": "New Document", "content":{ "type": "text/html", "text": "<body><p>Some interesting text</p></body>"}}\r\n--SNIP\r\nContent-Disposition: form-data; filename="filename.txt"\r\nContent-Type: text/html\r\n\r\nCONTENT\r\n--SNIP--\r\n'  "https://sandbox.jiveon.com/api/core/v3/contents"

    !! "filename" and the "Content-Type" of the attachment are required.

     

    Create a public document with an attachment in a space

    curl -v -u Username:Password --header "Content-Type: multipart/form-data; boundary=SNIP" -d $'--SNIP\r\nContent-Type: application/json\r\n\r\n{"visibility": "place", "parent": "https://sandbox.jiveon.com/api/core/v3/places/99999", "type": "document", "subject": "New Document", "content":{ "type": "text/html", "text": "<body><p>Some interesting text</p></body>"}}\r\n--SNIP\r\nContent-Disposition: form-data; filename="filename.txt"\r\nContent-Type: text/html\r\n\r\nCONTENT\r\n--SNIP--\r\n'  "https://sandbox.jiveon.com/api/core/v3/contents"

     

    Create a private document with an attachment from a public URL

    $CURL '{"visibility": "people", "content": {"type": "text/html", "text": "<body><p>Here comes the document body.</p></body>"},"subject": "My private document with attachment", "type": "document", "attachments": [{ "doUpload": true, "url": "https://community.jivesoftware.com/people/it2000/avatar/46.png" } ] }' "https://sandbox.jiveon.com/api/core/v3/contents"

     

    Create a document with an attachment from a public URL

    $CURL '{ "visibility": "place", "content": {"type": "text/html", "text": "<body><p>Here comes the document body.</p></body>"}, "subject": "Document with attachment", "type": "file", "attachments": [ { "doUpload": true, "url": "https://community.jivesoftware.com/people/it2000/avatar/46.png"}], "parent": "https://sandbox.jiveon.com/api/core/v3/places/1234" }' "https://sandbox.jiveon.com/api/core/v3/contents"

    According to Rest v3 File upload to place - 403 forbidden ``"type": "document",´´ does result in a 403 error.

     

    Create a private discussion

    $CURL '{"visibility": "people", "content": {"type": "text/html", "text": "<body><p>Here comes the discussion.</p></body>"},"subject": "My private discussion", "tags": [one, two, three], "type": "discussion"}'  "https://sandbox.jiveon.com/api/core/v3/contents"


    Reply to a discussion

    $CURL ...

     

    Update the status / Write a microblog

    $CURL '{"type": "update", "content": {"type": "text/html", "text": "<body><p>My micro blog update text.</p></body>"} }' "https://sandbox.jiveon.com/api/core/v3/contents"

     

    Direct Messages (DMS)

    Retrieve a list of all DMS

    Jive REST API v3.0 &rarr; Inbox service

     

    Mark DMS as (un)read

    Jive REST API v3.0 &rarr; DirectMessage service

     

    Retrieval of place IDs (Blog, Group, Space, Project)

    The URLs can also be used in browser after manual login. Nothing is posted, a simple HTTP GET works fine. The ID of a place is needed to create content in it.

    https://sandbox.jiveon.com/api/core/v3/places?sort=dateCreatedAsc&filter=type%28blog%29

    https://sandbox.jiveon.com/api/core/v3/places?sort=dateCreatedAsc&filter=type%28project%29

    https://sandbox.jiveon.com/api/core/v3/places?sort=dateCreatedAsc&filter=type%28space%29

    https://sandbox.jiveon.com/api/core/v3/places?sort=dateCreatedAsc&filter=type%28group%29

    Reference: Jive REST API v3.0 → Place service

    People

    Getting the active people is very easy: https://sandbox.jiveon.com/api/core/v3/people

    There seems to be a bug in 6.0.?, sometimes the "next" link is missing: Issue with API v3, when getting people?

    Therefore I loop over the users (startIndex=0,25,50,...) until I get an empty user list.

    Getting disabled users

    The feature actually exists, but is not (yet?) listed in the docs:

    https://sandbox.jiveon.com/api/core/v3/people?filter=include-disabled(true)&fields=jive

     

    Retrieving Information

    Suppressing Metadata/Resources/Fields in API Response