Surdoc-api/v1-1.0Beta

The REST API is the underlying interface for our official SDKs. It’s the most direct way to access the API. This reference document is designed for those interested in developing for platforms not supported by the SDKs or for those interested in exploring API features in detail.

General Notes

SSL Only

We require that all requests are done over SSL.

Date format

All dates in the API are strings in the following ISO8601 format:

"2013-05-13T02:48:13.934Z"

UTF-8 encoding

Every string passed to and from the SurDoc API needs to be UTF-8 encoded.

Example Requests

Sample API calls are provided next to each method using cURL, a standard command line tool. All you need to do is drop in your specific parameters, and you can test the calls from the command line. Here is a great tutorial on using cURL with APIs. If the command line isn’t your preference, a great alternative is POSTMAN, an easy-to-use Chrome extension for making HTTP requests.

Input/Output Format

Both request body data and response data are formatted as JSON.

Error handling

Errors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted. Error codes not listed here are in the REST API methods listed below.

Standard API errors

Code Description
400 Bad input parameter. Error message should indicate which one and why.
401 Bad or expired token. This can happen if the user or SurDoc revoked or expired an access token. To fix, you should re-authenticate the user.
403 Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…).
404 File or folder not found at the specified path.
405 Request method not expected
409 There is already a folder or file with the same name at the given destination.
5xx Server error.

Sample Error Response

{
    errors: [{
       "domain": "global",
       "reason": "notFound",
       "message": "File not found"
    }],
    "code": 404,
    "message": "File not found"
}
Example

Java

try {
    ClientFolder clientFolder = surDoc.folders().update("folder id", "new name of the folder").execute();
} catch (SurDocJsonResponseException ex) {
    RestError error = ex.getError();
    int errorCode = error.getCode();
    String errorMessage = error.getMessage();
    List<ErrorInfo> errors = error.getErrors();
    if (error != null) {
       for (ErrorInfo errorInfo : errors) {
         String msg = errorInfo.getMessage();
         String domain = errorInfo.getDomain();
         String reason = errorInfo.getReason();
       }
    }
}

Rest Server URL

The resource_server returned with an Access Token, is the base path of the API URL you need to use, which is ending with a slash /.
Example:

https://api.surdoc.net/

The actural rest api url looks like this:

https://api.surdoc.net/api/v1/files/102563

UserInfo

DESCRIPTION
Retrieves information about the user’s account.
URL Structure
api/v1/space
METHOD
GET
curl
curl https://server/api/v1/space \
-H “Authorization: Bearer ACCESS_TOKEN”
Returns

User account information.

Sample JSON response

{
    "allSpace" : 107374182400,
    "creator" : "fu89ufsuf9sdf90sdu8f9sd",
    "usedSpace" : 512000,
    "rootDirId" : "HSDDS"
}

Return value definitions

Field Types Description
allSpace long The user’s total available space amount in bytes
creator string creator
usedSpace long The amount of space in use by the user
rootDirId string The id of the user’s root directory

Folders

Folder Object

Attributes Types Description
type string For folders is 'folder'
id string The folder’s ID
name string The name of the folder
createTime string The time the folder was created(ISO8601)
modifiedTime string The time the folder or its contents were last modified (ISO8601)
creator string The user who created this folder
parent Folder object The folder that contains this one
itemCollection ItemCollection object A collection of file and folder objects contained in this folder
itemCollection.totalCount integer The total count of file and folder objects contained in this folder
itemCollection.entries List The list of file and folder objects contained in this folder
itemCollection.limit integer The number of items to return (default=100, max=1000)
itemCollection.offset integer The item at which to begin the response(default=0)

Retrieves Folder Metadata

DESCRIPTION
Retrieves the full metadata about a folder, including information about when it was last updated as well as the files and folders contained in it. The root folder of a SurDoc account is always represented by the id ‘0’.
URL Structure

api/v1/folders/{folderId}

  • folderId The folder’s ID(The root folder is represented by the id ‘0’)
METHOD
GET
curl
curl https://server/api/v1/folders/FOLDER_ID \
-H “Authorization: Bearer ACCESS_TOKEN”
Returns

A full folder object is returned,An error is thrown if the folder does not exist or if the user does not have access to it.

{
    "type":"folder",
    "id":"10025678"
    "name":"Pictures",
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Lucy Rose",
    "parent":{
        "type":"folder",
        "id":"0",
        "name":"All Files"
    },
    "itemCollection":{
        "totalCount":1,
        "entries":[
           {
               "type":"file",
               "id":"10239876",
               "name":"cat.jpg"
           }
        ],
        "offset":0,
        "limit":100
    }
}
ERRORS
404 The folder with the gaven id doesn’t exist.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

// Get a Folder metadata
ClientFolder clientFolder = surDoc.folders().get("10025678").execute();

Create a new Folder

DESCRIPTION
Used to create a new empty folder. The new folder will be created inside of the specified parent folder
URL Structure
api/v1/folders
METHOD
POST
curl
curl https://server/api/v1/folders\
-H “Authorization: Bearer ACCESS_TOKEN” \
-d '{“name”:“Folder Name!”,“type”:“folder”, “parent”: {“id”: “0”,“type”:“folder”}}' \
-X POST
Request Body

JSON data

{
    "name" : "Folder Name!",
    "type" : "folder",
    "parent" : {
       "id" : "0",
       "type" : "folder"
    }
}
  • type required For folders is 'folder'
  • parent.type required For folders is 'folder'
  • name optional The name of the folder
  • parent.id optional The ID of the parent folder
Returns

A full folder object is returned if the parent folder ID is valid and if no name collisions occur.

{
    "type":"folder",
    "id":"10025678"
    "name":"Pictures",
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Lucy Rose",
    "parent":{
       "type":"folder",
       "id":"0",
       "name":"All Files"
    },
    "itemCollection":{
        "totalCount":0,
        "entries":[ ],
        "offset":0,
        "limit":100
    }
}
ERRORS

404 The parent folder with the gaven id doesn’t exist.

409 There is already a folder with the same name at the given destination.

EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

// Create a new Folder
ClientFolder newClientFolder = surDoc.folders().insert("name of the folder", "id of the parent folder").execute();

Update metadata about a folder

DESCRIPTION
Used to update metadata about the folder. To move a folder, update the ID of its parent. To rename a folder, update the name of its.
URL Structure

api/v1/folders/{folderId}

  • folderId required The folder’s ID(The root folder is represented by the id '0')
METHOD
PUT
curl
curl https://server/api/v1/folders/FOLDER_ID \
-H “Authorization: Bearer ACCESS_TOKEN” \
-d '{“name”:“New Folder Name!”,“type”:“folder”, “parent”: {“id”: “0”,“type”:“folder”}}' \
-X PUT
Request Body

JSON data

{
    "name" : "New Folder Name!",
    "type" : "folder",
    "parent" : {
       "id" : "0",
       "type" : "folder"
    }
}
  • type required For folders is 'folder'
  • parent.type required For folders is 'folder'
  • name optional The name of the folder
  • parent.id optional The ID of the parent folder
Returns

A full folder object is returned if the parent folder ID is valid and if no name collisions occur.

{
    "type":"folder",
    "id":"10025678"
    "name":"New Folder Name!",
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Lucy Rose",
    "parent":{
       "type":"folder",
       "id":"0",
       "name":"All Files"
    },
    "itemCollection":{
       "totalCount":0,
       "entries":[ ],
       "offset":0,
       "limit":100
    }
}
ERRORS

404 The folder with the gaven id doesn’t exist.

409 There is already a folder with the same name at the given destination.

EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

// Create a new Folder
ClientFolder clientFolder = surDoc.folders().update("folder id", "new name of the folder", "id of the parent folder").execute();

Retrieve a Folder’s items

DESCRIPTION
Retrieves the files and/or folders contained within this folder without any other metadata about the folder. Paginated results can be retrieved using the limit and offset parameters.
URL Structure

api/v1/folders/{folderId}/items?limit=2&offset=0

  • folderId required The folder’s ID(The root folder is represented by the id '0')
  • limit optional The number of items to return (default=100, max=1000)
  • offset optional The item at which to begin the response (default=0)
METHOD
GET
curl
curl https://server/api/v1/folders/FOLDER_ID/items?limit=LIMIT&offset=OFFSET \
-H “Authorization: Bearer ACCESS_TOKEN”
Returns

An collection of items contained in the folder is returned. An error is thrown if the folder does not exist, or if any of the parameters are invalid.

{
    "totalCount":24,
    "entries":[
       {
         "type":"folder",
         "id":"10023645",
         "name":"Documents"
       },
       {
         "type":"file",
         "id":"10056894",
         "name":"horse.jpg"
       }
    ],
    "offset":0,
    "limit":2
}
ERRORS
404 The folder with the gaven id doesn’t exist.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Retrieve a Folder's items
ClientFolder.ItemCollection itemCollection = surDoc.folders().list("folder id").setLimit(2).setOffset(0).execute();

Delete a folder

DESCRIPTION
Used to delete a folder. A recursive parameter must be included in order to delete folders that have items inside of them.
URL Structure

api/v1/folders/{folderId}?recursive=true

  • folderId required The folder’s ID(The root folder is represented by the id '0')
  • recursive optional Whether to delete this folder if it has items inside of it
METHOD
DELETE
curl
curl https://server/api/v1/folders/FOLDER_ID?recursive=true \
-H “Authorization: Bearer ACCESS_TOKEN” \
-X DELETE
Returns
An empty 204 response will be returned upon successful deletion. An error is thrown if the folder is not empty and the recursive parameter is not included.
ERRORS
304 The folder is not empty and the recursive parameter is not included.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Delete a folder
surDoc.folders().delete("folder id").setRecursive(true).execute();

Files

File Object

Attributes Types Description
type string For files is 'file'
id string The file’s ID
name string The name of the file
createTime string When this file was created on SurDoc’s servers (ISO8601)
modifiedTime string When this file was last updated on the SurDoc’s servers (ISO8601)
creator string The user who first created file
parent Folder object The folder this file is contained in
size long Size of this file in bytes

Upload a file

DESCRIPTION

Use the Uploads API to allow users to add a new file. The user can then upload a file by specifying the destination folder for the file. If the user provides a file name that already exists in the destination folder, the user will receive an error.

https://server/api/v1/files/content handles uploads. This API uses the multipart post method to complete all upload tasks.

URL Structure
api/v1/files/content
METHOD
POST
curl
curl https://server/api/v1/files/content \
-H “Authorization: Bearer ACCESS_TOKEN” \
-F file=@FILEPATH_ON_DISK \
-F parentId=PARENT_FOLDER_ID
Form Elements

elements in this multipart post

  • file required The file on the user’s disk
  • parentId optional The ID of folder where this file should be uploaded
Returns

A full file object is returned if the parentId is valid and if the upload is successful. An error is thrown when a name collision occurs.

{
    "type":"file",
    "id":"10036578",
    "name":"cat.jpg"
    "size":954623,
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Tom Lee",
    "parent":{
       "type":"folder",
       "id":"10036454",
       "name":"Pictures"
    }
}
ERRORS

404 The folder with the gaven id doesn’t exist.

409 There is already a file with the same name at the given destination.

EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Upload a file
File file = new File("cat.jpg");
ClientFile clientFile = (ClientFile) new ClientFile().setParent(newClientFolder).setName(file.getName());
ClientFile newClientFile = surDoc.files().insert(clientFile, file).execute();

Download a file

DESCRIPTION
Retrieves the actual data of the file.
URL Structure

api/v1/files/{fileId}/content

  • fileId required The folder’s ID(The root folder is represented by the id '0')
METHOD
GET
curl
curl -L https://server/api/v1/files/FILE_ID/content \
-H “Authorization: Bearer ACCESS_TOKEN”
Returns
If the file is available to be downloaded, The raw data of the file is returned unless the file ID is invalid or the user does not have access to it.
ERRORS
404 The file with the gaven id doesn’t exist.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Download a file
InputStreaminputStream = null;
FileOutputStreamfileOutputStream = null;
try {
    inputStream = surDoc.files().download("file id").execute();
    fileOutputStream = new FileOutputStream("file name from `api/v1/files/{fileId}`");
    //Buffer setup,system property
    //"com.sun.jersey.core.util.ReaderWriter.BufferSize"
    ReaderWriter.writeTo(inputStream, fileOutputStream);
} finally {
    if (null != fileOutputStream) {
        fileOutputStream.close();
    }
    if (null != inputStream) {
        inputStream.close();
    }
}

Get metadata about a file

DESCRIPTION
Used to retrieve the metadata about a file.
URL Structure

api/v1/files/{fileId}

  • fileId required the file’s id
METHOD
GET
curl
curl https://server/api/v1/files/FILE_ID \
-H “Authorization: Bearer ACCESS_TOKEN”
Returns

A full file object is returned if the ID is valid and if the user has access to the file.

{
    "type":"file",
    "id":"100256",
    "name":"cat.jpg",
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Tom Green",
    "size":653214,
    "parent": {
        "type":"folder",
        "id":"123578",
        "name":"Pictures"
    }
}
ERRORS
404 The file with the gaven id doesn’t exist.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Get metadata about a file
ClientFile clientFile= surDoc.files().get("file id").execute();

Update a file by upload

DESCRIPTION

Update the raw data of the file. Similar to regular file uploads.

https://server/api/v1/files/{fileId}/content handles uploads. This API uses the multipart post method to complete all upload tasks.

URL Structure

api/v1/files/{fileId}/content

  • fileId required the file’s id
METHOD
POST
curl
curl https://server/api/v1/files/FILE_ID/content \
-H “Authorization: Bearer ACCESS_TOKEN” \
-F file=@FILEPATH_ON_DISK
Form Elements

elements in this multipart post

  • file required The file on the user’s disk
Returns

The updated file object will be returned. Errors may occur due to bad filenames and invalid file IDs.

{
    "type":"file",
    "id":"10036578",
    "name":"cat.jpg"
    "size":954623,
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Tom Lee",
    "parent":{
       "type":"folder",
       "id":"10036454",
       "name":"Pictures"
    }
}
ERRORS
404 The file with the gaven id doesn’t exist.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Update a file by upload
ClientFile clientFile = surDoc.files().update("id of the file", new File(“cat.jpg”)).execute();

Update metadata about a file

DESCRIPTION
Used to update individual or multiple fields in the file object, including renaming the file. To move a file, change the ID of its parent folder.
URL Structure

api/v1/files/{fileId}

  • fileId required the file’s id
METHOD
PUT
curl
curl https://server/api/v1/files/FILE_ID \
-H “Authorization: Bearer ACCESS_TOKEN” \
-d '{“name”:“new name.jpg”,“type”:“file”,“parent”:{“id”:“10036454”,“type”:“folder”}}' \
-X PUT
Request Body

JSON data

{
    "name" : "new name.jpg",
    "type" : "file",
    "parent" : {
       "id" : "10036454",
       "type" : "folder"
    }
}
  • type required For files is 'file'
  • name optional The name of the file
  • parent.id optional The ID of the parent folder
  • parent.type required For folders is 'folder'
Returns

A full file object is returned if the ID is valid and if the update is successful.

{
    "type":"file",
    "id":"10036578",
    "name":"new name.jpg"
    "size":954623,
    "createTime":"2013-05-13T02:48:13.934Z",
    "modifiedTime":"2013-05-13T02:48:13.934Z",
    "creator":"Tom Lee",
    "parent":{
       "type":"folder",
       "id":"10036454",
       "name":"Pictures"
    }
}
ERRORS

404 The file with the gaven id doesn’t exist.

409 There is already a file with the same name at the given destination.

EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Update metadata about a file
ClientFile clientFile = surDoc.files().update("id of the file", "new file name", "parent id").execute();

Delete a file

DESCRIPTION
Deletes a file.
URL Structure

api/v1/files/{fileId}

  • fileId required the file’s id
METHOD
DELETE
curl
curl https://server/api/v1/files/FILE_ID \
-H “Authorization: Bearer ACCESS_TOKEN” \
-X DELETE
Returns
An empty 204 response is sent to confirm deletion of the file.
EXAMPLE

Java

OAuthClient oauthClient = new OAuthClient("Your App Key", "Your App Secret");
//forward the user to Surdoc’s authorization page
oauthClient.setRedirectUri("https://open.surdoc.com/oauth/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_CALLBACK_URL&response_type=code");
//when success, YOUR_CALLBACK_URL?code={YOUR_PIN} will be called
//and then, you can get OAuthToken by {YOUR_PIN}
OAuthToken oAuthToken = oauthClient.getAccessTokenByAuthorizationCode("YOUR_PIN");
String rootUrl = oAuthToken.getResourceServer();
String accessToken = oAuthToken.getAccessToken();

//Initialize SurDoc Client
SurDoc surDoc = new SurDoc(rootUrl, accessToken);

//Delete a file
surDoc.files().delete("id of the file").execute();