Difference between revisions of "StorageHub REST API"

From Gcube Wiki
Jump to: navigation, search
(Maven coordinates)
m (Key features)
Line 16: Line 16:
  
 
= Key features =
 
= Key features =
Users must use the personal to access the REST interface. They can access just their own files and the folders shared with them.
+
Users must use the personal token to access the REST interface. They can access just their own files and the folders shared with them.
  
 
'''StorageHub REST interface''' supports the following operations:
 
'''StorageHub REST interface''' supports the following operations:

Revision as of 19:13, 12 November 2018

Overview

The StorageHub APIs provide a simple access (via Java or REST) to SH features.

Dependencies

Maven coordinates

<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
<version>[1.0.0,2.0.0)</version>
</dependency>

Key features

Users must use the personal token to access the REST interface. They can access just their own files and the folders shared with them.

StorageHub REST interface supports the following operations:

  • Retrieve WS: to retrieve the user Workspace;
  • Folder Listing: to list the content of a folder;
  • Retrieve VRE Folder: to retrieve the VREFolder related to the token;
  • Delete: to remove a file or a folder (including subfolders);
  • Download: to download a file or a folder in ZIP format;
  • Get Public Link: to get a public link of a file;
  • Create Folder: to create a folder in the given parent folder;
  • Unzip: to upload a zip file in a specific folder;
  • Upload file: to upload a file in a folder.

API

Retrieve Workspace

Returns the Item representing the workspace of the user retrieved by the token used for the call.

Java

 StorageHubClient shc = new StorageHubClient();
 FolderContainer rootContianer = shc.getWSRoot()

REST API

GET /workspace/?gcube-token={user-token}

responses

200 The workspace root item (in json format) is returned.

400 The error is specified in the body of the response message

Folder Listing

Returns the content of a Folder

Java

StorageHubClient shc = new StorageHubClient();
FolderContainer folderContainer = shc.open("{folderIdentifier}").asFolder();
List<? extends Item> items = folderContainer.list().getItems();

REST API

GET /workspace/items/{itemIdentifier}/?gcube-token={userToken}

parameters

{itemIdentifier} the identifier of the item to list the content

responses

200 the list of the Items (in JSON format)

400 The error is specified in the body of the response message

Retrieve VRE Folder

Return the Item representing the root of the VRE folder related to the user token.

Java

 StorageHubClient shc = new StorageHubClient();
 FolderContainer rootContainer = shc.openVREFolder();

REST API

GET /workspace/vrefolder?gcube-token={user-token}

responses

200 The VRE folder root item (in json format) is returned.

400 The error is specified in the body of the response message