curljive

How to get all documents in a group, team and spaces and bulk download them using Jive rest API and CURL?


I'm new to Jive and currently in the process of migrating content from jive. I see documents uploaded in teams, groups and subspaces. I can't find a way to download document in bulk through the UI. Downloading manually each document going to each of the teams/groups is going to take lot of time. I see jive supports REST API, however I'm unable to figure out how to do get call to retrieve all the teams/groups, then get all documents in each of the teams/groups and then loop through the list to call the content service to download them. I've tried using Curl calling the content api to download a single file like this. https://example.jive.com/api/core/v3/contents/documentid/data


Solution

  • To retrieve all the places use the following:

    GET /api/core/v3/places
    

    You can then filter based on the place type (e.g. space, group, etc). Once all the places are retrieved, use the the endpoint below to retrieve all the content that belongs to that place:

    GET /api/core/v3/places/{placeId}/contents
    

    You can also filter on multiple aspects. This response has a lot of details on the content. You find more details on the API documentation.

    You can also execute requests in batch with the endpoint below as documented here:

    POST /executeBatch
    

    For the example above the following request could be used to retrieve all places and the content from all those places:

    [
         {
             "key": "places",
             "request": {
                 "method": "GET",
                 "endpoint": "/api/core/v3/places"
             }
         }, {
             "key": "content",
             "request": {
                 "method": "GET",
                 "endpoint": "${places:$.list[*].resources.contents.ref}"
             }
         }
    ]