API Documentation
|
The Cocoon Data API's interaction with specific files and folders relies heavily on submitting requests to the API using the ID values of these items.
If your application does not store these items' IDs, information about a specific subset of all items recorded on the Cocoon Data Platform (matching specific/memorable criteria and scoped within a specific organisation to which the items belong) can be retrieved as a list. Such criteria could be a 'search' substring that matches a property of the item, such as the name of the item or its owner's name, or an enum value defining the sharing/ownership status of the item.
From this manageable list of items retrieved from an organisation, the required items' IDs can be obtained.
This page describes how to use the Cocoon Data API to retrieve a list of information about:
This page also describes how to sort, order and paginate any list of items retrieved using these procedures.
Notes:
- Before retrieving a list of files and folders, your application must have a valid access token obtained by authenticating and authorizing a Cocoon Data user to the Cocoon Data Platform, where this user is either:
Also, for more information about authenticating and authorizing Cocoon Data users to the Cocoon Data Platform, see Initiating authentication and authorization on the Authentication and authorization page of this guide and the Configuring client applications page of the SafeShare Administrator's Guide.
- the owner of these items (i.e. items which they have created - see Initializing a new 'Incomplete' file object and Creating a folder to manage items for more information) or
- a collaborator on these items, which other users have shared with them - see Sharing items for more information.
- The Supported roles (and conditions) section of each API endpoint page (accessible from the relevant procedures throughout this Developer's Guide) contains details about the roles a Cocoon Data user requires and the conditions they must meet, for requests to these endpoints (which would include a valid access token representing the user's authenticated session) to succeed.
Information about immediate child items (i.e. both files and folders) of a common parent can be retrieved as a list from the Cocoon Data Platform. This common parent can be either a parent folder of these child items, or the logical root level.
To retrieve this list of information about all immediate child items of a common parent, make a GET
method request to this API endpoint:
with the collectionId URL parameter whose value is either:
0
to specify items located at the logical root level.The value of {orgId}
in the URL path of the request is the ID of the organisation from which the items will be retrieved.
If the request was successful, a JSON object is returned in the response containing an items member whose value is an array of elements, where each element contains information about one of the retrieved files or folders.
Information about all items whose name or owner's email address/first name/last name contains a specified string, irrespective of an item's location or ownership, can be retrieved as a list from the Cocoon Data Platform. (This is effectively a text search feature.)
To retrieve a list of information about all items whose name or owner's email address/first name/last name contains a specified string, make a GET
method request to the following API endpoint:
with the searchText URL parameter whose value contains the specified string itself. Be aware that it is not possible to specify both the searchText and collectionId (above) URL parameters in the same request.
The value of {orgId}
in the URL path of the request is the ID of the organisation from which the items will be retrieved.
If the request was successful, a JSON object is returned in the response containing an items member whose value is an array of elements, where each element contains information about one of the retrieved files or folders.
For a given organisation, the Cocoon Data Platform can retrieve a list of information about all items at a given location which:
OR
information about every item which this user has shared.
To retrieve this list of information about items based on these criteria, make a GET
method request to the following API endpoint:
and specify the view URL parameter with an enum value of:
owned-by-me
to retrieve all items owned by a given Cocoon Data user * ,shared-with-me
to retrieve all items that other Cocoon Data users have shared with a given Cocoon Data user * ,sharing
to retrieve all items that a given Cocoon Data user * has shared with other people, orall
to retrieve all items that a given Cocoon Data user * can access.Tip: The view URL parameter can be used in conjunction with both the collectionId and searchText parameters (above) for additional filtering.
* In each case, this Cocoon Data user is determined by a valid access token (representing this user) passed in the header of the request.
The value of {orgId}
in the URL path of the request is the ID of the organisation from which the items will be retrieved.
If the request was successful, a JSON object is returned in the response containing an items member whose value is an array of elements, where each element contains information about one of the retrieved files or folders.
To retrieve information about all ancestral folders (back to the logical root level) of an item, make a GET
method request to the following API endpoint:
The value of {itemId}
in the URL path of the request is the ID of the file or folder from which all ancestral folders (through to the logical root level) will be retrieved in the response.
If the request was successful, a JSON object is returned in the response containing a single array of elements, where each element contains information about an ancestral folder (in hierarchical order from the logical root level).
The list of information about all retrieved items from a common parent, filtered by text search or based on ownership or sharing status can be sorted, ordered and paginated (when making a GET
method request to the following API endpoint):
by specifying the following additional URL parameters:
NAME
- the item's name (which is the default value if this parameter is omitted),OWNER
- the item's owner,MODIFIED
- the date when the item was last modified, orCREATED
- the date when the item was created.ASC
- for ascending alphanumeric or chronological order (which is the default value if this parameter is omitted), orDESC
- for descending alphanumeric or chronological order.10
by default.0
by default.For more information about the limit and offset URL parameters for paginating items returned in the response, see Optional parameters (of <access-service>/api/v1/organisations/{orgId}/items).
If the request was successful, a JSON object is returned in the response containing an items member whose value is an array of elements, where each element contains information about one of the retrieved files or folders.