TeraCLOUD REST API V2(Muramasa)

Top / Developers / TeraCLOUD REST API V2(Muramasa)

This page is automatically translated.

REST API overview

By using the REST API, application developers can perform various management tasks, such as obtaining information on user's accommodating servers, contract size, etc., obtaining file information, controlling file sharing and publishing functions, creating DATASET as a dedicated area for apps, creating and deleting snapshots, etc.

Based on the authentication method, there are two versions of this API, OAUTH2 certified version and BASIC certified version, the OAUTH2 certified version can use all the functions, while the BASIC certified version is a subset.

If you use OAUTH2 certified version, you need to exchange sessions via REST API, and WebDAV accesses need to use the same sessions. If your WebDAV application was already built using BASIC authentication, you may have to add new code, and if it is a CLI program, there are aspects of it that make session management difficult.

Therefore, there are two possible directions for adapting an application to TeraCLOUD.

  1. Plan to support TeraCLOUD without changing the code of existing WebDAV applications
  2. The policy of using the full functionality of TeraCLOUD

In case 1, we will use a subset version of the API with BASIC authentication, and in case 2, we will use a full-functional version of the API with OAUTH2.

TeraCLOUD-enabled Best Practices for Apps

In common with both BASIC and OAUTH2 certified versions, the general best practices for app TeraCLOUD support are as follows.

Otherwise, the REST API has become what is needed if you want to use TeraCLOUD's own features.


Note that there are two main types of servers that accept REST APIs. For more information, see Server Types. Also, see the reference manual.

Also, application developers generally access the API in the following way.

Here, we use "FEF5078EA41D182EEF89A21E034BD680" as the API key for testing.

However, if you want to publish your product in some way, please apply for a special key for it separately.

When you use this API-KEY for the first time, 50GB/year bonus capacity will be automatically given to the user who uses it. The additional capacity can be used freely, but this API-KEY is for developer's benefit.

If you do only basic authentication

Good API when accessing for initial registration

  1. Access the user resource of the API server (GET). Acquire a different node server (WebDAV URL) for each user.
  2. From the acquired return value, obtain the WebDAV URL to be connected.
  3. If access to the data set is necessary, request to the node server.

When the user first creates an account of TeraCLOUD, the user's node server automatically determines the accommodation destination and thereafter will not change as a rule after that. Therefore, it is possible for the application to cache the acquired node server once and continue using it.

Also, the node system server operates independently including the BASIC authentication credentials. Therefore, even if the API system or web server is down, even if the node server is running, it is designed to be able to continue WebDAV service.

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}%

In this way, with JSON, you can refer to node and webdav_url and get it. In the above example, the server called ise is the accommodating server.

node

Node server. Sending a REST API to this server. / backup To access the following, create a URL from this host name.

webdav_url

In general, the URL of WebDAV users are using. If you want to use general access area, use here. For very early users this URL may be "not present".

For details, refer to the reference getUser.

When done with OAUTH2 certification

A good API to access during the initial registration(*)

  1. Output the SSO URL and prompt the user to access the authentication server (first time only).
  2. Obtain the AuthCode and access (GET) it to the user resource in the API (first time only).
  3. Store different node server URLs and authorization information for each user in the app (first time only). Connect to the dataset API for each user using the authorization information and node server URLs. Get the WebDAV URL to connect to.
  4. If access to the dataset is needed, access the REST API dataset resource on the node server as in 2.

The user's node server is automatically housed when the user first creates a TeraCLOUD account and does not change in principle after that. Therefore, once an application gets the URL of a node server, it can continue to use it and save it.

As of now, access to OAUTH2 is not available, the actual access method is omitted.

A good API to access at the start of use (every time you start an application)(*)

Capacity etc.

You don't have to do anything if there is no particular need for the implementation of the application.

For now, the actual access to OAUTH2 is not available, so the actual access method is omitted.

A good API to access on a per WebDAV access(*)

At this time, the access in OAUTH2 is private, so the actual 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
datasetPerform 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

On getting image file thumbnails

When accessing an image file via WebDAV, you can specify the width and height in the GET parameter to obtain a scaled-down thumbnail on the server side. However, this process is very heavy and slow for the first time, so you should follow the guidelines below.

Since these guidelines are provisional, the specifications for requests other than 1/2n are not yet determined.

Reference Manual

See here for reference.