Download OpenAPI specification:Download
アクセストークンおよびリフレッシュトークンを発行する。
引数の値がない場合、引数自体の省略とみなす。この他のパラメータは無視される。パラメータの重複は許可されない。
リクエストパラメータ及びエラーを含むレスポンスパラメータはRFC 6749 - The OAuth 2.0 Authorization Frameworkに準拠している。
grant_type required | string Value: "client_credentials" client_credentials固定 |
grant_type=client_credentials
{- "access_token": "0123456...",
- "token_type": "bearer",
- "expires_in": 3600,
- "refresh_token": "0123456..."
}
指定IDのディレクトリ直下の項目の一覧を取得する
required | string or string ディレクトリID |
limit | integer <int64> 取得する一覧件数の上限 |
offset | integer <int64> 取得する一覧の開始位置 |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://GigaCCのFQDN/webapi/directories/1/items") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/directories/1/items")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/directories/1/items") .get() .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.get("https://GigaCCのFQDN/webapi/directories/1/items") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
{- "items": [
- {
- "type": "file",
- "id": 123456,
- "name": "ファイル名",
- "parent_folder": {
- "id": 123456
}, - "parent_directory": {
- "id": 123456
}, - "size": 123456,
- "creator": {
- "id": 123456,
- "name": "登録者氏名"
}, - "is_locked": false,
- "is_checked_out": false,
- "has_password": false,
- "used_by_note": false,
- "used_by_access_url": false,
- "available_in": {
- "since": "2019-08-24T14:15:22Z",
- "until": "2019-08-24T14:15:22Z"
}, - "description": "説明",
- "createdd_at": "2019-08-24T14:15:22Z",
- "content_created_at": "2019-08-24T14:15:22Z",
- "content_modified_at": "2019-08-24T14:15:22Z"
}
], - "total_count": 10
}
指定IDのフォルダ直下の項目の一覧を取得する
id required | number <int64> フォルダID |
limit | integer <int64> 取得する一覧件数の上限 |
offset | integer <int64> 取得する一覧の開始位置 |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://GigaCCのFQDN/webapi/folders/1/items") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/folders/1/items")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/folders/1/items") .get() .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.get("https://GigaCCのFQDN/webapi/folders/1/items") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
{- "items": [
- {
- "type": "file",
- "id": 123456,
- "name": "ファイル名",
- "parent_folder": {
- "id": 123456
}, - "parent_directory": {
- "id": 123456
}, - "size": 123456,
- "creator": {
- "id": 123456,
- "name": "登録者氏名"
}, - "is_locked": false,
- "is_checked_out": false,
- "has_password": false,
- "used_by_note": false,
- "used_by_access_url": false,
- "available_in": {
- "since": "2019-08-24T14:15:22Z",
- "until": "2019-08-24T14:15:22Z"
}, - "description": "説明",
- "createdd_at": "2019-08-24T14:15:22Z",
- "content_created_at": "2019-08-24T14:15:22Z",
- "content_modified_at": "2019-08-24T14:15:22Z"
}
], - "total_count": 10
}
フォルダを作成する
Request bodyのparentはフォルダを直下に作成する項目IDで、typeにfileは指定不可
name required | string フォルダ名 |
required | object (ItemRef) 項目参照 |
description | string 説明 |
{- "name": "フォルダ名",
- "parent": {
- "type": "directory",
- "id": 123456
}, - "description": "説明"
}
{- "type": "folder",
- "id": 123456,
- "name": "フォルダ名"
}
指定IDのフォルダを指定の場所に移動する
Request bodyのparent.typeにfileは指定不可
id required | integer <int64> フォルダID |
required | object (ItemRef) 項目参照 |
name_conflict_behavior required | string Enum: "skip" "overwrite" "rename" 名前衝突時解決方法 |
{- "parent": {
- "type": "directory",
- "id": 123456
}, - "name_conflict_behavior": "skip"
}
[- {
- "id": 123456,
- "name": "名前"
}
]
指定IDのフォルダの指定された要素を更新する
id required | integer <int64> フォルダID |
name required | string フォルダ名 |
{- "name": "フォルダ名"
}
{- "type": "folder",
- "id": 123456,
- "name": "フォルダ名"
}
指定IDのフォルダを削除する
id required | integer <int64> フォルダID |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("DELETE", "https://GigaCCのFQDN/webapi/folders/1") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/folders/1")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("DELETE", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/folders/1") .delete(null) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.delete("https://GigaCCのFQDN/webapi/folders/1") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
[- {
- "type": "エラー種別",
- "error": "OAuth2トークン発行のエラー種別",
- "error_description": "メッセージ",
- "parameter_names": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_values": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_range": {
- "min": 0,
- "max": 0
}, - "item": {
- "id": 123456,
- "name": "名前"
}
}
]
指定IDのフォルダを指定の場所にコピーする。
id required | integer <int64> フォルダID |
required | object (ItemRef) 項目参照 |
name_conflict_behavior required | string (NameConflictBehavior) Enum: "skip" "overwrite" "rename" 名前衝突時解決方法 |
{- "parent": {
- "type": "directory",
- "id": 123456
}, - "name_conflict_behavior": "skip"
}
[- {
- "type": "エラー種別",
- "error": "OAuth2トークン発行のエラー種別",
- "error_description": "メッセージ",
- "parameter_names": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_values": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_range": {
- "min": 0,
- "max": 0
}, - "item": {
- "id": 123456,
- "name": "名前"
}
}
]
指定IDのファイルの詳細を取得する
id required | integer <int64> ファイルID |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://GigaCCのFQDN/webapi/files/1") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/files/1")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/files/1") .get() .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.get("https://GigaCCのFQDN/webapi/files/1") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
{- "type": "file",
- "id": 123456,
- "name": "ファイル名",
- "parent_folder": {
- "id": 123456
}, - "parent_directory": {
- "id": 123456
}, - "size": 123456,
- "creator": {
- "id": 123456,
- "name": "登録者氏名"
}, - "is_locked": false,
- "is_checked_out": false,
- "has_password": false,
- "used_by_note": false,
- "used_by_access_url": false,
- "meta_info": [
- {
- "template": {
- "name": "名称",
- "type": "string",
- "comment": "コメント"
}, - "value": "値"
}
], - "available_in": {
- "since": "2019-08-24T14:15:22Z",
- "until": "2019-08-24T14:15:22Z"
}, - "description": "説明",
- "created_at": "2019-08-24T14:15:22Z",
- "content_created_at": "2019-08-24T14:15:22Z",
- "content_modified_at": "2019-08-24T14:15:22Z"
}
指定IDのファイルの指定された要素を更新する
id required | integer <int64> ファイルID |
name required | string ファイル名 |
{- "name": "ファイル名"
}
{- "type": "file",
- "id": 123456,
- "name": "ファイル名"
}
指定IDのファイルを削除する
id required | integer <int64> ファイルID |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("DELETE", "https://GigaCCのFQDN/webapi/files/1") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/files/1")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("DELETE", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/files/1") .delete(null) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.delete("https://GigaCCのFQDN/webapi/files/1") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
{- "type": "エラー種別",
- "error": "OAuth2トークン発行のエラー種別",
- "error_description": "メッセージ",
- "parameter_names": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_values": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_range": {
- "min": 0,
- "max": 0
}, - "item": {
- "id": 123456,
- "name": "名前"
}
}
指定IDのファイルをダウンロードする
id required | integer <int64> ファイルID |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://GigaCCのFQDN/webapi/files/1/content") .setHeader("Accept", "application/octet-stream, application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/files/1/content")) .header("Accept", "application/octet-stream, application/json") .header("Authorization", "Bearer 123") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/files/1/content") .get() .addHeader("Accept", "application/octet-stream, application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.get("https://GigaCCのFQDN/webapi/files/1/content") .header("Accept", "application/octet-stream, application/json") .header("Authorization", "Bearer 123") .asString();
{- "type": "エラー種別",
- "error": "OAuth2トークン発行のエラー種別",
- "error_description": "メッセージ",
- "parameter_names": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_values": [
- "パラメータ名1",
- "パラメータ名2"
], - "valid_range": {
- "min": 0,
- "max": 0
}, - "item": {
- "id": 123456,
- "name": "名前"
}
}
指定のファイルをアップロードする
required | object メタデータ |
required | string <binary> |
String path = "C:\\Users\\test\\testdata.txt"; byte[] file = new byte[1024]; FileInputStream fs = new FileInputStream(path); BufferedInputStream bis = new BufferedInputStream(fs); // ファイルを読み込む bis.read(file); bis.close(); // バイナリからStringに変換する String strFile = new String(file); // AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("POST", "https://GigaCCのFQDN/webapi/files") .setHeader("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\n\r\n{ \"parent\": { \"id\": 1, \"type\": \"directory\" }, \"description\": \"説明\", \"name_conflict_behavior\": \"skip\" }\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"upload.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n" + strFile + "\r\n-----011000010111000001101001--\r\n") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/files")) .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\n\r\n{ \"parent\": { \"id\": 1, \"type\": \"directory\" }, \"description\": \"説明\", \"name_conflict_behavior\": \"skip\" }\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"upload.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n" + strFile + "\r\n-----011000010111000001101001--\r\n")) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001"); RequestBody body = RequestBody.create("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\n\r\n{ \"parent\": { \"id\": 1, \"type\": \"directory\" }, \"description\": \"説明\", \"name_conflict_behavior\": \"skip\" }\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"upload.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n" + strFile + "\r\n-----011000010111000001101001--\r\n", mediaType); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/files") .post(body) .addHeader("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string()); // Unirest HttpResponse<String> response = Unirest.post("https://GigaCCのFQDN/webapi/files") .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\n\r\n{ \"parent\": { \"id\": 1, \"type\": \"directory\" }, \"description\": \"説明\", \"name_conflict_behavior\": \"skip\" }\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"upload.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n" + strFile + "\r\n-----011000010111000001101001--\r\n") .asString(); System.out.println(response.getBody());
{- "type": "file",
- "id": 123456,
- "name": "ファイル名",
- "parent_folder": {
- "id": 123456
}, - "parent_directory": {
- "id": 123456
}, - "size": 123456,
- "creator": {
- "id": 123456,
- "name": "登録者氏名"
}, - "is_locked": false,
- "is_checked_out": false,
- "has_password": false,
- "used_by_note": false,
- "used_by_access_url": false,
- "available_in": {
- "since": "2019-08-24T14:15:22Z",
- "until": "2019-08-24T14:15:22Z"
}, - "description": "説明",
- "createdd_at": "2019-08-24T14:15:22Z",
- "content_created_at": "2019-08-24T14:15:22Z",
- "content_modified_at": "2019-08-24T14:15:22Z"
}
指定IDのファイルを指定の場所に移動する
id required | integer <int64> ファイルID |
required | object (ItemRef) 項目参照 |
name_conflict_behavior required | string (NameConflictBehavior) Enum: "skip" "overwrite" "rename" 名前衝突時解決方法 |
{- "parent": {
- "type": "directory",
- "id": 123456
}, - "name_conflict_behavior": "skip"
}
{- "type": "file",
- "id": 123456,
- "name": "ファイル名"
}
指定IDのファイルを指定の場所にコピーする
Request bodyのparent.typeにfileは指定不可
id required | integer <int64> ファイルID |
required | object (ItemRef) 項目参照 |
name_conflict_behavior required | string (NameConflictBehavior) Enum: "skip" "overwrite" "rename" 名前衝突時解決方法 |
{- "parent": {
- "type": "directory",
- "id": 123456
}, - "name_conflict_behavior": "skip"
}
{- "type": "file",
- "id": 123456,
- "name": "ファイル名"
}
指定IDのディレクトリまたはフォルダ配下のファイルおよびフォルダを検索する
ancestor_id required | integer <int64> ディレクトリIDまたはフォルダID |
ancestor_type required | string Enum: "directory" "folder" directory: ディレクトリ |
keyword | string キーワード |
create_time_at_range | Array of strings <date-time> [ items <date-time > ] 登録期間。以下に例を示す |
limit | integer <int64> 取得する一覧件数の上限 |
offset | integer <int64> 取得する一覧の開始位置 |
// AsyncHttp AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://GigaCCのFQDN/webapi/search?ancestor_id=1&ancestor_type=directory") .setHeader("Accept", "application/json") .setHeader("Authorization", "Bearer 123") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); // NetHttp HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://GigaCCのFQDN/webapi/search?ancestor_id=1&ancestor_type=directory")) .header("Accept", "application/json") .header("Authorization", "Bearer 123") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); // OkHttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://GigaCCのFQDN/webapi/search?ancestor_id=1&ancestor_type=directory") .get() .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer 123") .build(); Response response = client.newCall(request).execute(); // Unirest HttpResponse<String> response = Unirest.get("https://GigaCCのFQDN/webapi/search?ancestor_id=1&ancestor_type=directory") .header("Accept", "application/json") .header("Authorization", "Bearer 123") .asString();
[- {
- "type": "file",
- "id": 123456,
- "name": "ファイル名",
- "parent_folder": {
- "id": 123456
}, - "parent_directory": {
- "id": 123456
}, - "size": 123456,
- "creator": {
- "id": 123456,
- "name": "登録者氏名"
}, - "is_locked": false,
- "is_checked_out": false,
- "has_password": false,
- "used_by_note": false,
- "used_by_access_url": false,
- "available_in": {
- "since": "2019-08-24T14:15:22Z",
- "until": "2019-08-24T14:15:22Z"
}, - "description": "説明",
- "createdd_at": "2019-08-24T14:15:22Z",
- "content_created_at": "2019-08-24T14:15:22Z",
- "content_modified_at": "2019-08-24T14:15:22Z"
}
]