APIを利用したデバイス登録
APIを利用することで、Agentcraft™の画面を操作することなくデバイスID・トークンの発行が行えます。
また、APIによるデバイス登録だけでなく、Agentcraft™の設定タグにてGUI上でもデバイスID発行やトークン発行・更新が可能です。
GUIの設定方法については、デバイスとの紐付け方法をご覧下さい。
APIドメインURL
APIにアクセスする際のドメインURLです。
https://api-agentcraft.sebastien.ai/
エンドポイント
エンドポイント一覧
− デバイス
デバイス
デバイスID追加
エージェントに新たなデバイスを追加する。
Endpoint | POST /devices | |||
---|---|---|---|---|
Request header | Content-Type | (String) | 必須 | “application/json” |
Query parameter | client_secret | (String) | 必須 | クライアントシークレット |
Response | OK | 201 + inline_response_201_2 | ||
<inline_response_201_2> { id(String) } |
デバイスID |
|||
NG | 401 / 409 |
Example
curl -X POST -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices?client_secret={:client_secret}"
{
"device_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
デバイストークン生成
デバイスにデバイストークンを生成する。
Endpoint | POST /devices/token | |||
---|---|---|---|---|
Request header | Content-Type | (String) | 必須 | “application/json” |
Query parameter | device_id | (String) | 必須 | デバイスID |
Response | OK | 201 + ApiPublicDeviceToken | ||
<ApiPublicDeviceToken> { device_token(String), refresh_token(String) } |
デバイストークン リフレッシュトークン |
|||
NG | 404 / 409 |
Example
curl -X POST -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices/token?device_id={:device_id}"
{
"device_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
"refresh_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
デバイス削除
デバイスIDを削除する。
Endpoint | DELETE /devices/{:id} | |||
---|---|---|---|---|
Path parameter | id | (String) | 必須 | デバイスID |
Request header | Content-Type | (String) | 必須 | “application/json” |
Response | OK | 204 | ||
NG | 400 |
Example
curl -X DELETE -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices/{:id}"
デバイス情報取得
デバイス情報を取得する。
Endpoint | GET /devices/{:id} | |||
---|---|---|---|---|
Path parameter | id | (String) | 必須 | デバイスID |
Request header | Content-Type | (String) | 必須 | “application/json” |
Response | OK | 200 + inline_response_200 | ||
<inline_response_200> { device_token(String), refresh_token(String) } |
デバイストークン リフレッシュトークン |
|||
NG | 400 / 404 |
Example
curl -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices/{:id}"
{
"device_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
"refresh_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
デバイストークンステータス取得
デバイストークンのステータス情報を取得する。
Endpoint | GET /devices/token/status | |||
---|---|---|---|---|
Request header | Content-Type | (String) | 必須 | “application/json” |
Query parameter | device_token | (String) | 必須 | デバイストークン |
Response | OK | 200 + inline_response_200_1 | ||
<inline_response_200_1> ・デバイストークン有効 { shadow_id(String), status(String) } ・デバイストークン期限切れ { reason(String), status(String) } |
シャドウID ステータス(”valid”) メッセージ(”require update device token”) ステータス(”expired”) |
|||
NG | 400 |
Example
curl -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices/token/status?device_token={:device_token}"
{
"shadow_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
"status" : "valid / invalid"
}
デバイストークン更新
デバイストークンを更新する。
Endpoint | POST /devices/token/refresh | |||
---|---|---|---|---|
Request header | Content-Type | (String) | 必須 | “application/json” |
Query parameter | refresh_token | (String) | 必須 | リフレッシュトークン |
Response | OK | 200 + ApiPublicDeviceToken | ||
<ApiPublicDeviceToken> { device_token(String), refresh_token(String) } |
デバイストークン リフレッシュトークン |
|||
NG | 401 |
Example
curl -X POST -H "Content-Type:application/json" "https://api-agentcraft.sebastien.ai/devices/token/refresh?refresh_token={:refresh_token}"
{
"device_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
"refresh_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}