TeraCLOUD REST API V2(Muramasa)

Top / Developers / TeraCLOUD REST API V2(Muramasa)

REST API overview

Use of the REST API grants application developers access to information such as the user's lodging server and contract size, file metadata, control file sharing and publishing functions, create DATASET as an application-specific region, and generate and/or remove snapshots.

Depending on the chosen authentication method, this API has an OAUTH2-authenticated version and a BASIC-authenticated version. Only a few functions listed above are available in the BASIC-authenticated version, while all functions are available in the OAUTH2-authenticated version.

Sessions must be transferred over the REST API and WebDAV access must use the same session when applying the OAUTH2 authentication version. New code would likely need to be introduced if the WebDAV application was previously created using BASIC authentication. Session management might also face challenges in the case of CLI programs.

As a result, application compatibility with TeraCLOUD can be achieved in either of the next two ways.

  1. Policy to support TeraCLOUD with as little modification to the current WebDAV application code as possible. (BASIC-authentication version)
    • Use of a subset API version that uses BASIC authentication.
  2. Use of TeraCLOUD and its full functionality. (OUATH2-authentication version)
    • Use of a full function API version that uses OAUTH2 authentication.

TeraCLOUD-enabled Best Practices for Apps

A general best practice for TeraCLOUD compliant apps that is also applicable to both BASIC and OAUTH2 authentication versions is as follows.

Enabling TeraCLOUD's unique features (listed in the REST API overview) requires the use of extra REST APIs.


The REST API is supported by two main types of servers. More information on the types of servers can be found here.

The API implementation that is displayed below is one that application developers frequently use.

For example, the API key "FEF5078EA41D182EEF89A21E034BD680" can be utilized as a benefit or advantage for both users and developers since new users will receive free capacity with a time limit (50GB/one year) upon activation.The provided capacity does not constitute a paid subscription, and parameters can be changed to better suit a developer's ideal situation.

The API-key above is non-functioning. Applications must be made in order to receive a functioning key for their product.

 

When using BASIC authentication only

APIs that should be used to complete initial registration

  1. Access (GET) the ba/user resource on the API server. Obtain a different node server (WebDAV URL) for each user.
  2. From the return value, get the WebDAV URL that needs to be connected to.
  3. To access the data set, a request to the node server can be made.

When a TeraCLOUD account is created, the node server for the user is automatically selected. After then, the node server stays the same.

As a result, by caching the obtained node server, the program can continue to use it.

Node servers also operate independently, including when it comes to credentials for BASIC authentication. Even if the API system or web server is down, as long as the node server is running, the WebDAV service is designed to continue.

 

Example request by Curl:

curl -X GET --user Your ID -H "X-TeraCLOUD-API-KEY: FEF5078EA41D182EEF89A21E034BD680" https://api.teracloud.jp/v2/api/ba/user
Enter host password for user 'Your ID': Enter Apps password

Return example:

{"result": 0, "node": "ise.teracloud.jp", "webdav_url": "https://ise.teracloud.jp/dav/", "api_key": {"note": "jpc api "introduction_code_bonus_for_inviter": 2, "introduce_code_bonus_for_invitee": 5 "test", "vendor": "justplayer", "activated_time": "2018-12-06 12: 29: 41.0", "name": "jpc api test"} , "user": "your user name", "introduce_code": "your referral code", "capacity": your contracted capacity, "revision": 2020111801}%

The node and webdav_url can be referred to and retrieved using JSON in this manner. The host server in the aforementioned example is labelled as the ise server.

node

webdav_url

 

When using OAUTH2 authentication only

APIs that should be used to complete initial registration

  1. Provide the SSO URL and prompt the user to access the authentication server (first time only).
  2. Acquire AuthCode and access (GET) the user resource of the API (first time only). Save each user's authorization details and various node server URLS in the app (first time only).
  3. To access to the dataset API for each user, use their authorization details and node server URL. Obtain the necessary WebDAV connection URL.
  4. If you require access to the dataset, follow the second and third points to go to the node server's REST API dataset resource.

When a TeraCLOUD account is created, the node server for the user is automatically selected. After then, the node server stays the same.

As a result, once acquired by the application, the URL of the node server can be saved and used continuously.

At this time, OAUTH2 access is not open to the public. Therefore, an access method is omitted.

API that should be accessed at the start of use (every time the application is started)

There is no need to take any action if there is no specific need for application implementation.

At this time, OAUTH2 access is not open to the public. Therefore, an access method is omitted.

API that should be accessed for each WebDAV access

At this time, OAUTH2 access is not open to the public. Therefore, an access method is omitted.

API that can be accessed at any time

File-related APIs

 

Main REST API

ResourceRoleREST target server
userManipulate information related to users.Account API server api.teracloud.jp
dat asetPerform operations related to the data set.Each node server (*) * .teracloud.jp
snapshotCreates and deletes a snapshot of the data set.Each node server (*) * .teracloud.jp
filepropertiesGet property of fileproperties file. Includes media information.Each node server (*) * .teracloud.jp

Image file thumbnail acquisition

When requesting WebDAV image files, the width and height can be specified in the GET parameters to retrieve thumbnails that have been scaled down on the server.The directions below are strongly encouraged as the procedure is demanding and time consuming.

  1. Use the API fileproperties to retrieve the JPEG image pixels.
    • A directory's contents can be fetched in batches if you need to analyze several files there.
  2. For each file, request for 1/2ⁿ of the image's pixel size.
  3. The image will be resized to fit the size that the client or the browser actually requires.

These are preliminary guidelines. Specifications for requests other than 1/2ⁿ have yet to be determined.

Reference Manual

Click here for TeraCLOUD's API reference manual.

 
Create My Account (10GB Free)

Easy one-minute registration! Start backing up today!
Works online, Windows, Mac, iOS and Android