バイナリファイルを扱うためのAPIです。
Upload File
バイナリファイルをアップロードして、新規登録または更新を行います。
URL
- 新規登録の場合、POSTメソッドを利用します
http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/files (Upload file)
- 更新処理の場合、PUTメソッドを利用します
http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/files/{oldFileName} (Upload file)
Authentication
ユーザー認証が完了している必要があります。
Header
Content-Type: application/json
apppot-token: token
Name | Data Format | Description |
---|---|---|
apppot-token | String | (Required) Login APIの結果得られたユーザートークン |
Request parameters
Name | Type | Description |
---|---|---|
file | application/octet-stream | (Required) File will be uploaded |
entity | application/json | (Required) Contain name - file name |
Capture body request example
------WebKitFormBoundaryd1H6KYiJkSSJ7PTC
Content-Disposition: form-data; name="entity"
{"name":"AddNewData.txt"}
------WebKitFormBoundaryd1H6KYiJkSSJ7PTC
Content-Disposition: form-data; name="file"; filename="AddNewData.txt"
Content-Type: text/plain
------WebKitFormBoundaryd1H6KYiJkSSJ7PTC--
Response example
{
"status":"OK",
"errCode":0,
"description":null,
"results":{
"name":"c0738d51-1a29-440a-929f-919f02e42415_AddNewData.txt",
"url":"http://samplehost:8080/apppot/api/files/c0738d51-1a29-440a-929f-919f02e42415_AddNewData.txt"
}
}
Response properties
Name | Data Format | Description |
---|---|---|
errCode | int | Response error code: 0, 105, 120, 121, 122, 600, 601, 603, 605 |
status | String | OK or error |
results | UploadResponseItem | Response results |
description | String | Detail response description |
Get File
指定したファイルのバイナリファイルがレスポンスとして返ります。
URL
- GET
http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/files/{fileName}?userToken=xxx
Authentication
ユーザー認証が完了している必要があります。
Header
Content-Type: application/json
Request parameters
Name | Data Format | Description |
---|---|---|
fileName | String | (Required) file name |
Response example
Binary file
Response properties
Name | Data Format | Description |
---|---|---|
status | String | OK or error |
errCode | int | Response error code: 0, 120, 121, 122, 131, 605 |
results | UploadResponseItem | Response results, include: id (file id), name (file name), url (file url) - if url from amazon, it will expired in a predefined time (can set in stew.properties) |
description | String | Detail response description |
Delete File
Delete file with fileId
URL
- DELETE
http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/files/{fileName}
Authentication
ユーザー認証が完了している必要があります。
Header
Content-Type: application/json
apppot-token: token
Name | Data Format | Description |
---|---|---|
apppot-token | String | (Required) user token |
Request parameters
Name | Data Format | Description |
---|---|---|
fileName | String | (Required) file name |
Response example
{
"description": null,
"errCode":0,
"status":"OK"
}
Response properties
Name | Data Format | Description |
---|---|---|
status | String | OK or error |
errCode | int | Response error code: 0, 120, 121, 122, 131, 605 |
description | String | Detail response description |