MENU

Akerun Developersへようこそ。

Akerun Developersは「Akerun入退室管理システム」を利用する開発者に向けて、Akerun APIについての情報を提供しています。

はじめに

Akerun APIでは、Akerunでの入退室履歴の取得合鍵の発行遠隔からの施錠・解錠など、Akerunの様々な機能を使うことができます。

Akerun APIを使って、Akerunをさらに便利に使いこなしましょう。

APIバージョン

このページではAkerun API (v3)の仕様について説明しています。

以前のバージョンのAkerun API (v2)については、こちらをご覧ください。

お申し込み

API利用をご希望の方は営業担当までお問い合わせください。

リダイレクトURIについて

リダイレクトURIは、OAuth2.0のアクセストークンを発行するフローで必要となります。 詳しくはOAuth 2.0の仕様をご覧ください。

また、プロトコルはhttpsのみに制限していますので予めご了承下さい。

スコープについて

スコープ一覧から、OAuthアプリケーションに必要なスコープのリストをお送りください。通信暗号化方式はTLS1.2以降に対応しています。

指定するAkerun IDについて

各機器には固有の「ID」が割り振られています。Akerun Proの場合は「A〜」から始まるIDを、Akerun コントローラーの場合は「R〜」から始まるIDを指定してください。IDの確認方法はこちらをご覧ください。

リクエスト

Akerun API へのリクエストの文字エンコーディングはUTF-8のみに対応しています。

レスポンス

Akerun API のレスポンスはJSONオブジェクトを返しています。 文字エンコーディングはUTF-8です。

認証

Akerun API v3はOAuth 2.0の仕様に準拠しています。

認証コードの取得

認証コード取得URL

https://api.akerun.com/oauth/authorize/?client_id=851a5415a3df3fcfc634364b947c5f3c6949683669625c4a4264b83a18981e27&redirect_uri=https://akerun.com/&response_type=code

申込時に指定したredirect_uriと、弊社から送付されたclient_idを使い認証コード取得URLにアクセスし、表示されるログインフォームにて、Akerunアカウントでログインを行ってください。

ログイン後にredirect_uriに付与されるクエリパラメーターのcodeはアクセストークンの取得時に必要となります。 認証コードの有効期間は発行から30分です。有効期間が過ぎた場合、再度発行してください。

HTTP リクエスト

GET https://api.akerun.com/oauth/authorize/?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code

アクセストークンの作成

Example Request

curl -X POST "https://api.akerun.com/oauth/token" \
     -d grant_type=authorization_code \
     -d client_id=851a5415a3df3fcfc634364b947c5f3c6949683669625c4a4264b83a18981e27 \
     -d client_secret=2b3d5efe93c135a87f49a0b8440d523d160e9a5f8b008d9969a13e40191017da \
     -d code=c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252 \
     -d redirect_uri=https://akerun.com/

Example Response

{
  "access_token": "a8e144f4bac98c33814407999e5b1216b898b67605ae691f35beac7fb24ad39f",
  "token_type": "bearer",
  "refresh_token": "14ba1946cf8a3dg1fd3de49c4b2efe9e9c24d44efa64762bbc36e71edbffb424",
  "expires_in": 7776000,
  "created_at": 1500953017
}

API の利用にはアクセストークンが必要です。 Example Requestを参考にアクセストークンの作成を行なってください。

HTTP リクエスト

POST https://api.akerun.com/oauth/token

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
grant_type*Stringauthorization_code
client_id*StringOAuthアプリケーションのクライアントID
client_secret*StringOAuthアプリケーションのクライアントシークレット
code*StringAkerunアカウントにログイン後redirect_uriに付与されていた認証コード
redirect_uri*StringOAuthアプリケーションに設定されたredirect_uri

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
access_tokenStringアクセストークン
token_typeStringアクセストークンの種類
refresh_tokenStringアクセストークンを再発行する時に必要なトークン
expires_inStringアクセストークンが無効化されるまでの秒数
created_atStringアクセストークン が作成された日時

エラーレスポンス

CodeHTTP Status CodeDescription
unsupported_grant_type400grant_typeが不正
invalid_grant400code、client_id、client_secret、redirect_uriを使った認証に失敗

アクセストークンの再発行

Example Request

curl -X POST "https://api.akerun.com/oauth/token" \
     -d grant_type=refresh_token \
     -d client_id=851a5415a3df3fcfc634364b947c5f3c6949683669625c4a4264b83a18981e27 \
     -d client_secret=2b3d5efe93c135a87f49a0b8440d523d160e9a5f8b008d9969a13e40191017da \
     -d refresh_token=e6621710f55da19012bf7412a7675e654ca44351bd8659af41726c559d0cf848

Example Response

{
  "access_token": "56937ebdd4489cf705d4ec3be38c72d7d6789c0591e8c0c34a2ddcc75e8cd295",
  "token_type": "bearer",
  "refresh_token": "872eb483a170e2ecfeee9eea2db31543785cf48cfc4f39838238c94f363d582b",
  "expires_in": 7776000,
  "created_at": 1500953017
}

アクセストークンを再発行します。

アクセストークンの有効期間は発行から90日間です。期限が過ぎると、そのアクセストークンではAPIを利用することができなくなりますが、同時に発行されたリフレッシュトークンを使ってアクセストークンを再発行することができます。リフレッシュトークンの有効期限はありません。

アクセストークンの再発行は、アクセストークンの期限切れ前でも期限切れ後でも可能です。再発行したアクセストークンの有効期間は再発行した時点から90日間です。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/oauth/token

パラメータ

(* 必須)

ParameterTypeDescription
grant_type*Stringrefresh_token
client_id*StringOAuthアプリケーションのクライアントID
client_secret*StringOAuthアプリケーションのクライアントシークレット
refresh_token*Stringアクセストークンを更新する時に使うリフレッシュトークン

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
access_tokenStringアクセストークン
token_typeStringアクセストークンの種類
refresh_tokenStringアクセストークンを更新する時に使うリフレッシュトークン
expires_inStringアクセストークンが無効化されるまでのcreated_atから数えた秒数
created_atStringアクセストークン が作成された日時

エラーレスポンス

CodeHTTP Status CodeDescription
unsupported_grant_type400grant_typeが不正
invalid_grant400client_idclient_secretrefresh_tokenを使った認証に失敗

アクセストークンの無効化

Example Request

curl -X POST "https://api.akerun.com/oauth/revoke" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d client_id=851a5415a3df3fcfc634364b947c5f3c6949683669625c4a4264b83a18981e27 \
     -d client_secret=2b3d5efe93c135a87f49a0b8440d523d160e9a5f8b008d9969a13e40191017da \
     -d token=c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252

アクセストークンを無効化します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/oauth/revoke

パラメータ

(* 必須)

ParameterTypeDescription
client_id*StringOAuthアプリケーションのクライアントID
client_secret*StringOAuthアプリケーションのクライアントシークレット
token*String無効化したいアクセストークンまたはリフレッシュトークン

成功レスポンス

HTTP STATUS CODE: 200

無し

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_client401ヘッダーに指定されたアクセストークンが不正、client_id、client_secretを使った認証に失敗

アクセストークンの情報を取得

Example Request

curl -X GET "https://api.akerun.com/oauth/token/info" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "application_name": "OAuth Application 1",
  "access_token": "45379971b810636443c20dcd7d06814e36bd4e100626f531184068af13fcc574",
  "refresh_token": "e6621710f55da19012bf7412a7675e654ca44351bd8659af41726c559d0cf848",
  "created_at": "2017-9-08T13:52:48Z",
  "expires_at": "2017-12-08T13:52:48Z"
}

アクセストークン の情報を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/oauth/token/info

パラメータ

無し

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
application_nameStringアプリケーションの名前
tokenString自分のアクセストークン
refresh_tokenStringアクセストークンの更新に使うリフレッシュトークン
created_atStringアクセストークン が作成された日時
expires_atStringアクセストークン の期限が切れる日時

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_request401ヘッダーに指定されたアクセストークンが不正

OAuth スコープ

スコープについて

Photosynthがアプリケーションごとにアクセストークンを発行する際、お客様が申請されたスコープは全て有効状態となっています。必要なスコープはAPIのエンドポイントごとに異なり、不足している場合はエラーとなります。

スコープの一覧

API v3で使用されているスコープの一覧です。

スコープDescription
account:organization:readトークンオーナーが所属している事業所の読み込み権限
organization:read事業所情報の読み込み権限
organization:akerun:read事業所に属するAkerunの読み込み権限
organization:akerun:write事業所に属するAkerunの書き込み権限
organization:user:read事業所のユーザーの読み込み権限
organization:user:write事業所のユーザーの書き込み権限
organization:key:read事業所に属するAkerunの合鍵の読み込み権限
organization:key:write事業所に属するAkerunの合鍵の書き込み権限
organization:nfc:write事業所に属するICカードの書き込み権限
organization:access:read事業所に属するAkerunの入退室履歴の読み込み権限
organization:akerun:lock事業所に属するAkerunの施錠・解錠
organization:akerun:state事業所に属するAkerunの状態取得
organization:akerun:setting事業所に属するAkerunの設定変更
organization:akerun_group:read事業所に属するAkerunグループの読み込み権限
organization:akerun_group:write事業所に属するAkerunグループの書き込み権限
organization:user_group:read事業所に属するユーザーグループの読み込み権限
organization:user_group:write事業所に属するユーザーグループの書き込み権限
organization:key_group:read事業所に属するグループ合鍵の読み込み権限
organization:key_group:write事業所に属するグループ合鍵の書き込み権限

スコープの設定

アクセストークンのスコープの設定は、アプリ連携を行った本人のみが行えます。

手順

  1. Akerun Connectの「アカウント設定」ページから、アクセストークンを選択します。

アクセストークン選択

  1. アクセストークンに紐付いているアカウントと事業所一覧が表示されるので、スコープの操作をしたいアカウント、もしくは事業所の右側の「設定」を選択します。

アクセストークン選択

  1. 許可されたスコープにはチェックが入っております。もしチェックを外して「設定を更新する」を押すと対象のスコープは許可されなくなります。

設定選択

設定選択

事業所

事業所一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "organizations": [
    {
      "id": "O-ab345-678ij"
    },
    {
      "id": "O-78924-45268"
    },
    {
      "id": "O-16542-60849"
    }
  ]
}

トークンオーナーが属する事業所IDを一覧で取得します。

事業所ID一覧はToken オーナーが事業所に属した順で返ります。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations

必要なスコープ

account:organization:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
limitInteger取得件数(1から1,000の数字)100
id_afterStringデータ取得の開始位置
id_beforeStringデータ取得の終了位置

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
organizationsArray[Organizaiton Object]事業所オブジェクトの配列
organizations >
id
String事業所のID

エラーレスポンス

Error CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない

事業所詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "organization": {
    "id": "O-ab345-678ij",
    "name": "Photosynth"
  }
}

事業所の詳細情報を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}

必要なスコープ

organization:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
organizationsArray[Organizaiton Object]事業所オブジェクトの配列
organizations >
id
String事業所のID
organizations >
name
String事業所の名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403トークンオーナーが事業所のマネージャー、またはスーパーマネージャーではない
organization_not_found404指定した事業所が存在しない

ドア(Akerun)

ドア一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d limit=100 \
     -d akerun_ids[]=A1030001 \
     -d akerun_ids[]=A1030002 \
     -d akerun_ids[]=A1030004 \
     -d id_after=A1030001 \
     -d id_before=A1030004

Example Response

{
  "akeruns": [
    {
      "id": "A1030002",
      "name": "執務室表口",
      "image_url": "https://akerun.com/akerun_example1.jpg",
      "open_door_alert": true,
      "open_door_alert_second": 30,
      "push_button": false,
      "normal_sound_volume": 50,
      "alert_sound_volume": 100,
      "battery_percentage": 100,
      "autolock": true,
      "autolock_off_schedule": {
        "start_time": "10:00+09:00",
        "end_time": "19:00+09:00",
        "days_of_week": [1,2,3,4,5]
      },
      "akerun_remote": {
        "id": "TG11100002"
      },
      "nfc_reader_inside": {
        "id": "NP0000001",
        "battery_percentage": 100
      },
      "nfc_reader_outside": {
        "id": "NP0000002",
        "battery_percentage": 100
      },
      "door_sensor": {
        "id": "W0000001",
        "battery_percentage": 100
      }
    }
  ]
}

事業所に属するAkerunの一覧を取得します。事業所に属した順で返ります。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns

必要なスコープ

organization:akerun:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
limitInteger取得件数(1から1,000の数字)100
akerun_idsArray[String]絞り込みたいAkerun ID
id_afterStringデータ取得の開始位置
id_beforeStringデータ取得の終了位置

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
akerunsArray[Akerun Object]Akerunオブジェクトの配列
akeruns >
id
StringAkerun ID
akeruns >
name
StringAkerunの名前
akeruns >
image_url
String/NULLAkerunの画像
akeruns >
open_door_alert
Booleanドア開けっ放し警告(true=有効,false=無効)
akeruns >
open_door_alert_second
Integerドア開けっ放し警告までの秒数(30,60,180のいずれか)
akeruns >
push_button
Booleanプッシュボタンでの施錠・解錠(true=有効,false=無効)
akeruns >
normal_sound_volume
Integer操作音(0から100の数字)
akeruns >
alert_sound_volume
Integer警告音(0から100の数字)
akeruns >
battery_percentage
Integer電池残量(0から100の数字)
akeruns >
autolock
Booleanオートロック
akeruns >
autolock_off_schedule
Object/NULLオートロックオフスケジュール
akeruns >
autolock_off_schedule >
start_time
Integerオートロックオフ開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
akeruns >
autolock_off_schedule >
end_time
Integerオートロックオフ終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
akeruns >
autolock_off_schedule >
days_of_week
Array[Integer]オートロックオフ曜日(0=日曜日..6=土曜日)
akeruns >
akerun_remote
Remote ObjectAkerun Remote
akeruns >
akerun_remote > id
IntegerAkerun RemoteのID
akeruns >
nfc_reader_inside
ICCard Reader Inside Object内側のICカードリーダー
akeruns >
nfc_reader_inside >
id
String内側のICカードリーダーのID
akeruns >
nfc_reader_inside >
battery_percentage
Integer内側のICカードリーダーの電池残量
akeruns >
nfc_reader_outside
ICCard Reader Outside Object外側のICカードリーダー
akeruns >
nfc_reader_outside >
id
String外側のICカードリーダーのID
akeruns >
nfc_reader_outside >
battery_percentage
Integer外側のICカードリーダーの電池残量
akeruns >
door_sensor
Door Sensor Objectドアセンサー
akeruns >
door_sensor >
id
StringドアセンサーのID
akeruns >
door_sensor >
battery_percentage
Integerドアセンサーの電池残量

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404id_after,id_beforeで指定したAkerunが事業所に存在しない

ドア詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "akerun": {
    "id": "A1030001",
    "name": "執務室表口",
    "image_url": "https://akerun.com/akerun_example1.jpg",
    "open_door_alert": true,
    "open_door_alert_second": 30,
    "push_button": false,
    "normal_sound_volume": 50,
    "alert_sound_volume": 100,
    "battery_percentage": 100,
    "autolock": true,
    "autolock_off_schedule": {
      "start_time": "10:00+09:00",
      "end_time": "19:00+09:00",
      "days_of_week": [1,2,3,4,5]
    },
    "akerun_remote": {
      "id": "TG11100001"
    },
    "nfc_reader_inside": {
      "id": "NP0000001",
      "battery_percentage": 100
    },
    "nfc_reader_outside": {
      "id": "NP0000002",
      "battery_percentage": 100
    },
    "door_sensor": {
      "id": "W0000001",
      "battery_percentage": 100
    }
  }
}

事業所のAkerunの情報を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}

必要なスコープ

organization:akerun:read

パラメータ

(* 必須)

ParameterTypeDescription
organization_id*String事業所のID
akerun_id*StringAkerun ID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescriptionDefault
akerunAkerun ObjectAkerunオブジェクト
akerun >
id
StringAkerun ID
akerun >
name
StringAkerunの名前
akerun >
image_url
String/NULLAkerunの画像
akerun >
open_door_alert
Booleanドア開けっ放し警告(true=有効,false=無効)
akerun >
open_door_alert_second
Integerドア開けっ放し警告までの秒数(30,60,180のいずれか)
akerun >
push_button
Booleanプッシュボタンでの施錠・解錠(true=有効,false=無効)
akerun >
normal_sound_volume
Integer操作音(0から100の数字)
akerun >
alert_sound_volume
Integer警告音(0から100の数字)
akerun >
battery_percentage
Integer電池残量(0から100の数字)
akerun >
autolock
Booleanオートロック
akerun >
autolock_off_schedule
Object/NULLオートロックオフスケジュール
akerun >
autolock_off_schedule >
start_time
Integerオートロックオフ開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
akerun >
autolock_off_schedule >
end_time
Integerオートロックオフ終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
akerun >
autolock_off_schedule >
days_of_week
Array[Integer]オートロックオフ曜日(0=日曜日..6=土曜日)
akerun >
akerun_remote
Remote ObjectAkerun Remote
akerun >
akerun_remote > id
IntegerAkerun RemoteのID
akeruns >
nfc_reader_inside
ICCard Reader Inside Object内側のICカードリーダー
akeruns >
nfc_reader_inside >
id
String内側のICカードリーダーのID
akeruns >
nfc_reader_inside >
battery_percentage
Integer内側のICカードリーダーの電池残量
akeruns >
nfc_reader_outside
ICCard Reader Outside Object外側のICカードリーダー
akeruns >
nfc_reader_outside >
id
String外側のICカードリーダーのID
akeruns >
nfc_reader_outside >
battery_percentage
Integer外側のICカードリーダーの電池残量
akeruns >
door_sensor
Door Sensor Objectドアセンサー
akeruns >
door_sensor >
id
StringドアセンサーのID
akeruns >
door_sensor >
battery_percentage
Integerドアセンサーの電池残量

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

ドア更新

Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -F akerun_name=執務室表口 \
     -F akerun_image=@/path/to/image.jpg

Example Response

{
  "akerun": {
    "id": "A1030001",
    "name": "執務室表口",
    "image_url": "https://akerun.com/akerun_example1.jpg",
    "open_door_alert": true,
    "open_door_alert_second": 30,
    "push_button": false,
    "normal_sound_volume": 50,
    "alert_sound_volume": 100,
    "battery_percentage": 100,
    "autolock": true,
    "autolock_off_schedule": {
      "start_time": "10:00+09:00",
      "end_time": "19:00+09:00",
      "days_of_week": [1,2,3,4,5]
    },
    "akerun_remote": {
      "id": "TG11100001"
    },
    "nfc_reader_inside": {
      "id": "NP0000001",
      "battery_percentage": 100
    },
    "nfc_reader_outside": {
      "id": "NP0000002",
      "battery_percentage": 100
    },
    "door_sensor": {
      "id": "W0000001",
      "battery_percentage": 100
    }
  }
}

事業所のAkerunの情報を更新します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}

必要なスコープ

organization:akerun:write

パラメータ

(* 必須)

ParameterTypeDescription
organization_id*String事業所のID
akerun_id*StringAkerun ID
akerun_nameStringAkerunの名前(50文字以内)
akerun_imageFileAkerunの画像(空文字送信でデフォルト画像に更新)

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescriptionDefault
akerunAkerun ObjectAkerunオブジェクト
akerun >
id
StringAkerun ID
akerun >
name
StringAkerunの名前
akerun >
image_url
String/NULLAkerunの画像
akerun >
open_door_alert
Booleanドア開けっ放し警告(true=有効,false=無効)
akerun >
open_door_alert_second
Integerドア開けっ放し警告までの秒数(30,60,180のいずれか)
akerun >
push_button
Booleanプッシュボタンでの施錠・解錠(true=有効,false=無効)
akerun >
normal_sound_volume
Integer操作音(0から100の数字)
akerun >
alert_sound_volume
Integer警告音(0から100の数字)
akerun >
battery_percentage
Integer電池残量(0から100の数字)
akerun >
autolock
Booleanオートロック
akerun >
autolock_off_schedule
Object/NULLオートロックオフスケジュール
akerun >
autolock_off_schedule >
start_time
Integerオートロックオフ開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
akerun >
autolock_off_schedule >
end_time
Integerオートロックオフ終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
akerun >
autolock_off_schedule >
days_of_week
Array[Integer]オートロックオフ曜日(0=日曜日..6=土曜日)
akerun >
akerun_remote
Remote ObjectAkerun Remote
akerun >
akerun_remote >
id
IntegerAkerun RemoteのID
akeruns >
nfc_reader_inside
ICCard Reader Inside Object内側のICカードリーダー
akeruns >
nfc_reader_inside >
id
String内側のICカードリーダーのID
akeruns >
nfc_reader_inside >
battery_percentage
Integer内側のICカードリーダーの電池残量
akeruns >
nfc_reader_outside
ICCard Reader Outside Object外側のICカードリーダー
akeruns >
nfc_reader_outside >
id
String外側のICカードリーダーのID
akeruns >
nfc_reader_outside >
battery_percentage
Integer外側のICカードリーダーの電池残量
akeruns >
door_sensor
Door Sensor Objectドアセンサー
akeruns >
door_sensor >
id
StringドアセンサーのID
akeruns >
door_sensor >
battery_percentage
Integerドアセンサーの電池残量

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

ドア(Akerun)グループ

ドアグループ一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "akerun_groups": [
    {
      "id": "AG-12345-67890-09876",
      "name": "執務室",
      "memo": "カフェ側と廊下側の入り口をまとめています"
    },
    {
        "id": "AG-54321-09876-12345",
      "name": "会議室",
      "memo": "会議室をまとめています"
    }
  ]
}

事業所のAkerunグループ一覧を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/

必要なスコープ

organization:akerun_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
akerun_groupsArray[Akerun Group Object]Akerunグループオブジェクトの配列
akerun_groups >
id
StringAkerunグループのID
akerun_groups >
name
StringAkerunグループの名前
akerun_groups >
memo
StringAkerunグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない

ドアグループ詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/AG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "akerun_group": {
    "id": "AG-12345-67890-09876",
    "name": "執務室",
    "memo": "カフェ側と廊下側の入り口をまとめています",
    "akeruns": [
      {
        "id": "A1030001",
        "name": "執務室表口",
        "image_url": "https://akerun.com/akerun_example1.jpg"
      }
    ]
  }
}

事業所のAkerunグループの詳細を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/{AKERUN_GROUP_ID}

必要なスコープ

organization:akerun_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_group_id*StringAkerunグループのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
akerun_groupArray[Akerun Group Object]Akerunグループオブジェクトの配列
akerun_group >
id
StringAkerunグループのID
akerun_group >
name
StringAkerunグループの名前
akerun_group >
memo
StringAkerunグループのメモ
akerun_group >
akeruns
Array[Akerun Object]Akerunオブジェクトの配列
akerun_group >
akeruns >
id
StringAkerun ID
akerun_group >
akeruns >
name
StringAkerunの名前
akerun_group >
akeruns >
image_url
String/NULLAkerunの画像

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない

ドアグループ作成

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d name="執務室" \
     -d memo="カフェ側と廊下側の入り口をまとめています"

Example Response

{
  "akerun_group": {
      "id": "AG-12345-67890-09876",
      "name": "執務室",
      "memo": "カフェ側と廊下側の入り口をまとめています"
  }
}

事業所にAkerunグループを作成します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups

必要なスコープ

organization:akerun_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
nameStringAkerunグループ名
memoStringメモ
""

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
akerun_groupAkerun Group ObjectAkerunグループオブジェクト
akerun_group >
id
StringAkerunグループのID
akerun_group >
name
StringAkerunグループの名前
akerun_group >
memo
StringAkerunグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
invalid_params404リクエストパラメータが不正

ドアグループ更新

Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/AG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d name="執務室" \
     -d memo="カフェ側と廊下側の入り口をまとめています"

事業所のAkerunグループを更新します。

Example Response

{
  "akerun_group": {
      "id": "AG-12345-67890-09876",
      "name": "執務室",
      "memo": "カフェ側と廊下側の入り口をまとめています"
  }
}

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/{AKERUN_GROUP_ID}

必要なスコープ

organization:akerun_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_group_id*StringAkerunグループのID
nameStringAkerunグループ名
memoStringメモ
""

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
akerun_groupAkerun Group ObjectAkerunグループオブジェクト
akerun_group >
id
StringAkerunグループのID
akerun_group >
name
StringAkerunグループの名前
akerun_group >
memo
StringAkerunグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない
invalid_params404リクエストパラメータが不正

ドアグループ削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/AG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

事業所のAkerunグループを削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/{AKERUN_GROUP_ID}

必要なスコープ

organization:akerun_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_group_id*StringAkerunグループのID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない

ドア追加

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/AG-12345-67890-09876/akeruns" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d akerun_ids[]=A1030001 \
     -d akerun_ids[]=A1030002

Example Response

{
  "akerun_group": {
      "id": "AG-12345-67890-09876",
      "name": "執務室",
      "memo": "カフェ側と廊下側の入り口をまとめています",
      "akeruns": [
          {
              "id": "A1030001",
              "name": "執務室カフェ側",
              "image_url": "https://akerun.com/akerun_example1.jpg"
          },
          {
              "id": "A1030002",
              "name": "執務室廊下側",
              "image_url": "https://akerun.com/akerun_example2.jpg"
          }
      ]
  }
}

事業所にAkerunグループにAkerunを追加します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/{AKERUN_GROUP_ID}/akeruns

必要なスコープ

organization:akerun_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_group_id*StringAkerunグループのID
akerun_ids*Array[String]Akerun IDの配列

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
akerun_groupAkerun Group ObjectAkerunグループオブジェクト
akerun_group >
id
StringAkerunグループのID
akerun_group >
name
StringAkerunグループの名前
akerun_group >
memo
StringAkerunグループのメモ
akerun_group >
akeruns
Array[Akerun Object]Akerunオブジェクトの配列
akerun_group >
akeruns >
id
StringAkerun ID
akerun_group >
akeruns >
name
StringAkerunの名前
akerun_group >
akeruns >
image_url
StringAkerunの画像

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない
not_allowed403登録可能なAkerunの上限を超えている
invalid_params404リクエストパラメータが不正

ドア削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/akerun_groups/AG-12345-67890-09876/akeruns" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d akerun_ids[]=A1030001 \
     -d akerun_ids[]=A1030002

事業所のAkerunグループにAkerunを削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akerun_groups/{AKERUN_GROUP_ID}/akeruns

必要なスコープ

organization:akerun_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_group_id*StringAkerunグループのID
akerun_ids*Array[String]Akerun IDの配列

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない
invalid_params404リクエストパラメータが不正

ユーザー

ユーザー一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d limit=100 \
     -d id_after=U-ab345-678ij \
     -d id_before=U-678ij-ab345 \
     -d user_code=1001 \
     -d include_datetime=true

Example Response

{
  "users": [
    {
      "id": "U-47891-98710",
      "name": "Photosynth太郎",
      "mail": "taro@akerun.com",
      "image_url": "https://akerun.com/user_example1.jpg",
      "authority": "manager",
      "code": "1001",
      "created_at": "2022-08-01T03:50:13Z",
      "updated_at": "2022-08-01T03:50:13Z",
      "nfcs": [
        {
          "id": "NA101010",
          "name": "アケルン太郎のICカード"
        }
      ]
    },
    {
      "id": "U-12562-69142",
      "name": "Photosynth太郎",
      "mail": "taro@akerun.com",
      "image_url": "https://akerun.com/user_example2.jpg",
      "authority": "manager",
      "code": "1001",
      "created_at": "2022-08-01T03:50:13Z",
      "updated_at": "2022-08-01T03:50:13Z",
      "nfcs": [
        {
          "id": "NA101010",
          "name": "Photosynth太郎のICカード"
        }
      ]
    }
  ]
}

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d limit=100 \
     -d id_after=U-ab345-678ij \
     -d id_before=U-678ij-ab345 \
     -d user_mail=taro@akerun.com

Example Response

{
  "users": [
    {
      "id": "U-47891-98710",
      "name": "Photosynth太郎",
      "mail": "taro@akerun.com",
      "image_url": "https://akerun.com/user_example1.jpg",
      "authority": "manager",
      "code": "1001",
      "nfcs": [
        {
          "id": "NA101010",
          "name": "アケルン太郎のICカード"
        }
      ]
    }
  ]
}

事業所に属するユーザーの一覧を取得します。

ユーザー一覧は事業所に属した順で返ります。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users

必要なスコープ

organization:user:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所の ID
limitInteger取得件数(1 から 1,000 の数字)100
id_afterStringデータ取得の開始位置
id_beforeStringデータ取得の終了位置
user_codeStringユーザーの事業所におけるユーザーコードで絞り込み(完全一致)
user_mailStringユーザーのメールアドレスで絞り込み(完全一致)
include_datetimeBooleanユーザーの作成日時・更新日時を取得するか

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
usersArray[User Object]ユーザーオブジェクトの配列
users >
id
Stringユーザーの ID
users >
name
Stringユーザーの名前
users >
mail
String/NULLユーザーのメールアドレス
users >
image_url
String/NULLユーザー画像
users >
authority
Stringユーザーの事業所における権限レベル
users >
code
String/NULLユーザーの事業所におけるユーザーコード
users >
created_at
Stringユーザーの作成日時(ISO 8601形式)
users >
updated_at
Stringユーザーの更新日時(ISO 8601形式) (注)
users >
nfcs
Array[ICCard Object]/NULLIC カードオブジェクトの配列
users >
nfcs >
id
StringIC カードの ID
users >
nfcs >
name
StringIC カードの名前

(注)「更新日時」はユーザー名・ユーザーコード・メールアドレス・電話番号が更新された際やユーザーがAkerun Connectにログインした際に最新になります。

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定された OAuth スコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_id で指定した事業所が存在しない
user_not_found404id_after、id_before で指定したユーザーが事業所に存在しない

ユーザー詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/users/U-ab345-678ij" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "user": {
    "id": "U-ab345-678ij",
    "name": "Photosynth太郎",
    "mail": "taro@akerun.com",
    "image_url": "https://akerun.com/user_example1.jpg",
    "authority": "manager",
    "code": "1001",
    "nfcs": [
      {
        "id": "NA101010",
        "name": "Photosynth太郎のICカード"
      }
    ]
  }
}

事業所に属するユーザーの詳細を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users/{USER_ID}

必要なスコープ

organization:user:read

パラメータ

(* 必須)

ParameterDescriptionDefault
organization_id*事業所のID
user_id*ユーザーのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
userUser Objectユーザーオブジェクト
user >
id
StringユーザーのID
user >
name
Stringユーザーの名前
user >
mail
String/NULLユーザーのメールアドレス
user >
image_url
String/NULLユーザー画像
user >
authority
Stringユーザーの事業所における権限レベル
user >
code
String/NULLユーザーの事業所におけるユーザーコード
user >
nfcs
Array[ICCard Object]/NULLICカードオブジェクトの配列
user >
nfcs >
id
StringICカードのID
user >
nfcs >
name
StringICカードの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない

新規ユーザー追加

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -F user_name=Photosynth太郎 \
     -F user_mail=taro@akerun.com \
     -F user_image=@/path/to/image.jpg \
     -F user_authority=manager \
     -F user_code='Akerun123'

Example Response

{
  "user": {
    "id": "U-ab345-678ij",
    "name": "Photosynth太郎",
    "mail": "taro@akerun.com",
    "image_url": "https://akerun.com/user_example1.jpg",
    "authority": "manager",
    "code": "Akerun123",
    "nfcs": [
      {
        "id": "NA101010",
        "name": "Photosynth太郎のICカード"
      }
    ]
  }
}

事業所に新規ユーザーを追加します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users

必要なスコープ

organization:user:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_name*String追加するユーザーの名前
user_mailString追加するユーザーのメールアドレス
user_imageString追加するユーザーの画像
user_authorityString追加するユーザーの事業所権限(manager,memberのどちらか)member
user_codeString追加するユーザーの事業所におけるユーザーコード

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
userUser Objectユーザーオブジェクト
user >
id
StringユーザーのID
user >
name
Stringユーザーの名前
user >
mail
String/NULLユーザーのメールアドレス
user >
image_url
String/NULLユーザーの画像
user >
authority
Stringユーザーの事業所における権限
user >
code
String/NULLユーザーの事業所におけるコード
user >
nfcs
Array[ICCard Object]/NULLICカードオブジェクトの配列
user >
nfcs >
id
StringICカードのID
user >
nfcs >
name
StringICカードの名前

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
not_allowed403許可されていない行為
insufficient_scope403指定されたOAuthスコープを持っていない
not_in_organization403事業所に属していない
insufficient_authority403トークンオーナーがマネージャー、もしくはスーパーマネージャでない
organization_not_found404organization_idで指定した事業所が存在しない

既存ユーザー追加

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -F user_mail=taro@akerun.com \
     -F user_image=@/path/to/image.jpg \
     -F user_authority=manager \
     -F user_code='Akerun123'

Example Response

{
  "user": {
    "id": "U-ab345-678ij",
    "name": "Photosynth太郎",
    "mail": "taro@akerun.com",
    "image_url": "https://akerun.com/user_example1.jpg",
    "authority": "manager",
    "code": "Akerun123",
    "nfcs": [
      {
        "id": "NA101010",
        "name": "Photosynth太郎のICカード"
      }
    ]
  }
}

事業所に既存ユーザーを追加します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users

必要なスコープ

organization:user:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_idString追加するユーザーのID(user_id、user_mailどちらか片方は必須)
user_mailString追加するユーザーのメールアドレス(user_id、user_mailどちらか片方は必須)
user_imageString追加するユーザーの画像
user_authorityString追加するユーザーの事業所権限(manager,memberのどちらか)member
user_codeString追加するユーザーの事業所におけるユーザーコード

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
userUser Objectユーザーオブジェクト
user >
id
StringユーザーのID
user >
name
Stringユーザーの名前
user >
mail
String/NULLユーザーのメールアドレス
user >
image_url
String/NULLユーザーの画像
user >
authority
Stringユーザーの事業所における権限
user >
code
String/NULLユーザーの事業所におけるコード
user >
nfcs
Array[ICCard Object]/NULLICカードオブジェクトの配列
user >
nfcs >
id
StringICカードのID
user >
nfcs >
name
StringICカードの名前

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
not_allowed403許可されていない行為
insufficient_scope403指定されたOAuthスコープを持っていない
not_in_organization403事業所に属していない
insufficient_authority403トークンオーナーがマネージャー、もしくはスーパーマネージャでない
organization_not_found404organization_idで指定した事業所が存在しない
user_not_found404user_idで指定したユーザーが存在しない

ユーザー更新

Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/users/U-ab345-678ij" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -F user_name=Photosynth太郎 \
     -F user_mail=taro@akerun.com \
     -F user_image=@/path/to/image.jpg \
     -F user_authority=manager \
     -F user_code='Akerun456'

Example Response

{
  "user": {
    "id": "U-ab345-678ij",
    "name": "Photosynth太郎",
    "mail": "taro@akerun.com",
    "image_url": "https://akerun.com/user_example1.jpg",
    "authority": "manager",
    "code": "Akerun456",
    "nfcs": [
      {
        "id": "NA101010",
        "name": "Photosynth太郎のICカード"
      }
    ]
  }
}

事業所のユーザーの情報を更新します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users/{USER_ID}

必要なスコープ

organization:user:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_id*String更新するユーザーのID
user_nameString更新するユーザーの名前
user_mailString更新するユーザーのメールアドレス
user_imageString更新するユーザーの画像
user_authorityString更新するユーザーの事業所権限(manager,memberのどちらか)
user_codeString更新するユーザーの事業所におけるユーザーコード

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
userUser Objectユーザーオブジェクト
user >
id
StringユーザーのID
user >
name
Stringユーザーの名前
user >
mail
String/NULLユーザーのメールアドレス
user >
image_url
String/NULLユーザーの画像
user >
authority
Stringユーザーの事業所における権限
user >
code
String/NULLユーザーの事業所におけるコード
user >
nfcs
Array[ICCard Object]/NULLICカードオブジェクトの配列
user >
nfcs >
id
StringICカードのID
user >
nfcs >
name
StringICカードの名前

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
not_allowed403許可されていない行為
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない、スーパーマネージャー以外のユーザーが権限更新を行なっている、またはマネージャー同しがユーザーの更新を行なっている
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない

ユーザー退出

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/users/U-ab345-678ij" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

事業所に属しているユーザーを退出させます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users/{USER_ID}

必要なスコープ

organization:user:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_id*String退出させるユーザーのID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
not_allowed403許可されていない行為
insufficient_scope403指定されたOAuthスコープを持っていない
not_in_organization403事業所に属していない
insufficient_authority403トークンオーナーがマネージャー、もしくはスーパーマネージャでない
organization_not_found404organization_idで指定した事業所が存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない

ユーザーグループ

ユーザーグループ一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "user_groups": [
    {
      "id": "UG-12345-67890-09876",
      "name": "開発部",
      "memo": "開発部のユーザーをまとめています"
    },
    {
        "id": "UG-54321-09876-12345",
      "name": "営業部",
      "memo": "営業部のユーザーをまとめています"
    }
  ]
}

事業所のユーザーグループ一覧を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/

必要なスコープ

organization:user_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
user_groupsArray[User Group Object]ユーザーグループオブジェクトの配列
user_groups >
id
StringユーザーグループのID
user_groups >
name
Stringユーザーグループの名前
user_groups >
memo
Stringユーザーグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない

ユーザーグループ詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/UG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "user_group": {
    "id": "UG-12345-67890-09876",
    "name": "開発部",
    "memo": "開発部のユーザーをまとめています",
    "users": [
      {
        "id": "U-47891-98710",
        "name": "Photosynth太郎",
        "image_url": "https://akerun.com/user_example1.jpg"
      }
    ]
  }
}

事業所のユーザーグループの詳細を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/{USER_GROUP_ID}

必要なスコープ

organization:user_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_group_id*StringユーザーグループのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
user_groupArray[User Group Object]ユーザーグループオブジェクトの配列
user_group >
id
StringユーザーグループのID
user_group >
name
Stringユーザーグループの名前
user_group >
memo
Stringユーザーグループのメモ
user_group >
users
Array[User Object]ユーザーオブジェクトの配列
user_group >
users >
id
StringユーザーのID
user_group >
users >
name
Stringユーザーの名前
user_group >
users >
image_url
String/NULLユーザーの画像

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_group_not_found404user_group_idで指定したユーザーグループが存在しない

ユーザーグループ作成

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d name="開発部" \
     -d memo="開発部のユーザーをまとめています"

Example Response

{
  "user_group": {
      "id": "UG-12345-67890-09876",
      "name": "開発部",
      "memo": "開発部のユーザーをまとめています"
  }
}

事業所にユーザーグループを作成します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups

必要なスコープ

organization:user_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
nameStringユーザーグループ名
memoStringメモ""

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
user_groupUser Group Objectユーザーグループオブジェクト
user_group >
id
StringユーザーグループのID
user_group >
name
Stringユーザーグループの名前
user_group >
memo
Stringユーザーグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
invalid_params404リクエストパラメータが不正

ユーザーグループ更新

Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/UG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d name="開発部" \
     -d memo="開発部のユーザーをまとめています"

事業所のユーザーグループを更新します。

Example Response

{
  "user_group": {
      "id": "AG-12345-67890-09876",
      "name": "開発部",
      "memo": "開発部のユーザーをまとめています"
  }
}

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/{USER_GROUP_ID}

必要なスコープ

organization:user_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_group_id*StringユーザーグループのID
nameStringユーザーグループ名
memoStringメモ""

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
user_groupUser Group ObjectUserグループオブジェクト
user_group >
id
StringUserグループのID
user_group >
name
StringUserグループの名前
user_group >
memo
StringUserグループのメモ

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_group_not_found404user_group_idで指定したユーザーグループが存在しない
invalid_params404リクエストパラメータが不正

ユーザーグループ削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/UG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

事業所のユーザーグループを削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/{USER_GROUP_ID}

必要なスコープ

organization:user_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_group_id*StringユーザーグループのID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_group_not_found404user_group_idで指定したユーザーグループが存在しない

ユーザー追加

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/UG-12345-67890-09876/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_ids[]=U-47891-98710 \
     -d user_ids[]=U-12562-69142

Example Response

{
  "user_group": {
      "id": "UG-12345-67890-09876",
      "name": "開発部",
      "memo": "開発部のユーザーをまとめています",
      "users": [
        {
          "id": "U-47891-98710",
          "name": "Photosynth太郎",
          "image_url": "https://akerun.com/user_example1.jpg"
        },
        {
          "id": "U-12562-69142",
          "name": "Photosynth太郎",
          "image_url": "https://akerun.com/user_example2.jpg"
        }
      ]
  }
}

事業所のユーザーグループにユーザーを追加します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/{USER_GROUP_ID}/users

必要なスコープ

organization:user_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_group_id*StringユーザーグループのID
user_ids*Array[String]ユーザー IDの配列

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
user_groupUser Group Objectユーザーグループオブジェクト
user_group >
id
StringユーザーグループのID
user_group >
name
Stringユーザーグループの名前
user_group >
memo
Stringユーザーグループのメモ
user_group >
users
Array[User Object]Userオブジェクトの配列
user_group >
users >
id
StringUserのID
user_group >
users >
name
StringUserの名前
user_group >
users >
image_url
StringUserの画像

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_group_not_found404user_group_idで指定したUserグループが存在しない
not_allowed403登録可能なUserの上限を超えている
invalid_params404リクエストパラメータが不正

ユーザー削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/user_groups/UG-12345-67890-09876/users" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_ids[]=U-47891-98710 \
     -d user_ids[]=U-12562-69142

事業所のユーザーグループからユーザーを削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/user_groups/{USER_GROUP_ID}/users

必要なスコープ

organization:user_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_group_id*StringユーザーグループのID
user_ids*Array[String]ユーザー IDの配列

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_group_not_found404user_group_idで指定したUserグループが存在しない
invalid_params404リクエストパラメータが不正

合鍵

合鍵一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d akerun_id=A1030001 \
     -d limit=100 \
     -d id_after=K-ab345-678ij \
     -d id_before=K-678ij-ab345

Example Response

{
  "keys": [
    {
      "id": "K-47891-98710-12mno",
      "role": "guest",
      "schedule_type": "recurring",
      "temporary_schedule": null,
      "recurring_schedule": {
        "days_of_week": [0, 1, 2, 3, 4, 5, 6],
        "start_time": "06:37+09:00",
        "end_time": "16:37+09:00"
      },
      "key_url": {
        "url": "https://keyurl.akerun.com/.....",
        "password_protected": true
      },
      "akerun": {
        "id": "A1030001",
        "name": "執務室表口"
      },
      "user": {
        "id": "U-ab345-678ij",
        "name": "アケルン太郎"
      }
    },
    {
      "id": "K-12562-69142",
      "role": "guest",
      "schedule_type": "temporary",
      "temporary_schedule": {
        "start_datetime": "2017-09-20T09:30+09:00",
        "end_datetime": "2017-09-22T18:00+09:00"
      },
      "recurring_schedule": null,
      "key_url": {
        "url": "https://keyurl.akerun.com/.....",
        "password_protected": true
      },
      "akerun": {
        "id": "A1030001",
        "name": "執務室表口"
      },
      "user": {
        "id": "U-678ij-ab345",
        "name": "Photosynth太郎"
      }
    }
  ]
}

事業所に属する合鍵の一覧を取得します。

合鍵一覧は発行した順で返ります。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/keys

必要なスコープ

organization:key:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_idString絞り込みたいユーザーのID
akerun_idString絞り込みたいAkerun ID
limitString取得件数(1から1,000の数字)100
id_afterStringデータ取得の開始位置
id_beforeStringデータ取得の終了位置

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
keysArray[Key Object]合鍵オブジェクトの配列
keys >
id
String合鍵のID
keys >
role
StringユーザーのAkerunに対しての権限(guest,admin,ownerのいずれか)
keys >
schedule_type
String合鍵の日時設定タイプ(always,temporary,recurringのいずれか)
keys >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
keys >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
keys >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
keys >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
keys >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
keys >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
keys >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
keys >
key_url
Object/NULLURL合鍵詳細オブジェクト
keys >
key_url >
url
StringURL合鍵のURL
keys >
key_url >
password_protected
BooleanURL合鍵にパスワードが設定されているか
keys >
akerun
Akerun Objectユーザーの名前
keys >
akerun >
id
StringAkerun ID
keys >
akerun >
name
StringAkerunの名前
keys >
user
User Objectユーザーオブジェクト
keys >
user >
id
StringユーザーのID
keys >
user >
name
Stringユーザーの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない
key_not_found404id_after,id_beforeで指定した合鍵が存在しない

合鍵詳細

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys/K-ab345-678ij-12mno" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "key": {
    "id": "K-ab345-678ij-12mno",
    "role": "admin",
    "schedule_type": "recurring",
    "temporary_schedule": null,
    "recurring_schedule": {
      "days_of_week": [0, 1, 2, 3, 4, 5, 6],
      "start_time": "06:37+09:00",
      "end_time": "16:37+09:00"
    },
    "key_url": {
      "url": "https://keyurl.akerun.com/.....",
      "password_protected": true
    },
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

事業所・ユーザー・Akerunの合鍵の一覧を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/keys/{KEY_ID}

必要なスコープ

organization:key:read

パラメータ

(* 必須)

ParameterDescriptionDefault
organization_id*事業所のID
key_id合鍵のID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
keyKey Object合鍵オブジェクトの配列
key >
id
String合鍵のID
key >
role
StringユーザーのAkerunに対しての権限(guest,admin,ownerのいずれか)
key >
schedule_type
String合鍵の日時設定タイプ(always,temporary,recurringのいずれか)
key >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
key_url
Object/NULLURL合鍵詳細オブジェクト
key >
key_url >
url
StringURL合鍵のURL
key >
key_url >
password_protected
BooleanURL合鍵にパスワードが設定されているか
key >
akerun
Akerun Objectユーザーの名前
key >
akerun >
id
StringAkerun ID
key >
akerun >
name
StringAkerunの名前
key >
user
User Objectユーザーオブジェクト
key >
user >
id
StringユーザーのID
key >
user >
name
Stringユーザーの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
key_not_found404key_idで指定した合鍵が存在しない

合鍵作成

Temporary Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_id=U-ab345-678ij \
     -d akerun_id=A1030001 \
     -d schedule_type=temporary \
     --data-urlencode temporary_schedule[start_datetime]=2017-09-13T12:30+09:00 \
     --data-urlencode temporary_schedule[end_datetime]=2017-09-20T12:30+09:00 \
     -d role=guest

Temporary Schedule Example Response

{
  "key": {
    "id": "K-ab345-678ij-12mno",
    "role": "guest",
    "schedule_type": "temporary",
    "temporary_schedule": {
      "start_datetime": "2017-09-13T12:30+09:00",
      "end_datetime": "2017-09-20T12:30+09:00"
    },
    "recurring_schedule": null,
    "key_url": null,
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

Recurring Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_id=U-ab345-678ij \
     -d akerun_id=A1030001 \
     -d schedule_type=recurring \
     --data-urlencode recurring_schedule[start_time]=10:00+09:00 \
     --data-urlencode recurring_schedule[end_time]=19:00+09:00 \
     -d recurring_schedule[days_of_week][]=1 \
     -d recurring_schedule[days_of_week][]=2 \
     -d recurring_schedule[days_of_week][]=3 \
     -d recurring_schedule[days_of_week][]=4 \
     -d recurring_schedule[days_of_week][]=5 \
     -d role=guest

Recurring Schedule Example Response

{
  "key": {
    "id": "K-ab345-678ij",
    "role": "guest",
    "schedule_type": "recurring",
    "temporary_schedule": null,
    "recurring_schedule": {
      "days_of_week": [1,2,3,4,5],
      "start_time": "10:00+09:00",
      "end_time": "19:00+09:00"
    },
    "key_url": null,
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

Always Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_id=U-ab345-678ij \
     -d akerun_id=A1030001 \
     -d schedule_type=always \
     -d role=guest

Always Schedule Example Response

{
  "keys": {
    "id": "K-ab345-678ij",
    "role": "guest",
    "schedule_type": "always",
    "temporary_schedule": null,
    "recurring_schedule": null,
    "key_url": {
      "url": "https://keyurl.akerun.com/.....",
      "password_protected": true
    },
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

事業所のユーザーの合鍵を作成します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/keys

必要なスコープ

organization:key:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_id*StringユーザーのID
akerun_id*StringAkerun ID
schedule_typeString合鍵の日時設定タイプ
(always,temporary,recurringのいずれか)
always
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時
ISO 8601形式)
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時
ISO 8601形式)
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻
(時刻とタイムゾーン ex: 12:30+09:00)
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻
(時刻とタイムゾーン ex: 14:30+09:00)
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
enable_key_urlBooleanURL合鍵の有効無効
key_url_passwordStringURL合鍵のパスワード
(4桁の数字)
roleStringユーザーのAkerunに対しての権限(guest,admin)guest

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
keyKey Object合鍵オブジェクト
key >
id
String合鍵のID
key >
role
StringユーザーのAkerunに対しての権限(guest,admin)
key >
schedule_type
String合鍵の日時設定タイプ(always,temporary,recurringのいずれか)
key >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
key_url
Object/NULLURL合鍵詳細オブジェクト
key >
key_url >
url
StringURL合鍵のURL
key >
key_url >
password_protected
BooleanURL合鍵にパスワードが設定されているか
key >
akerun
Akerun Objectユーザーの名前
key >
akerun >
id
StringAkerun ID
key >
akerun >
name
StringAkerunの名前
key >
user
User Objectユーザーオブジェクト
key >
user >
id
StringユーザーのID
key >
user >
name
Stringユーザーの名前

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない

合鍵更新

Temporary Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys/K-ab345-678ij-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=temporary \
     --data-urlencode temporary_schedule[start_datetime]=2017-09-13T12:30+09:00 \
     --data-urlencode temporary_schedule[end_datetime]=2017-09-20T12:30+09:00 \
     -d role=guest

Temporary Schedule Example Response

{
  "key": {
    "id": "K-ab345-678ij",
    "role": "guest",
    "schedule_type": "temporary",
    "temporary_schedule": {
      "start_datetime": "2017-09-13T12:30+09:00",
      "end_datetime": "2017-09-20T12:30+09:00"
    },
    "recurring_schedule": null,
    "key_url": null,
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

Recurring Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys/K-ab345-678ij-12mno" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=recurring \
     --data-urlencode recurring_schedule[start_time]=10:00+09:00 \
     --data-urlencode recurring_schedule[end_time]=19:00+09:00 \
     -d recurring_schedule[days_of_week][]=1 \
     -d recurring_schedule[days_of_week][]=2 \
     -d recurring_schedule[days_of_week][]=3 \
     -d recurring_schedule[days_of_week][]=4 \
     -d recurring_schedule[days_of_week][]=5 \
     -d role=guest

Recurring Schedule Example Response

{
  "key": {
    "id": "K-ab345-678ij-12mno",
    "role": "guest",
    "schedule_type": "recurring",
    "temporary_schedule": null,
    "recurring_schedule": {
      "days_of_week": [1,2,3,4,5],
      "start_time": "10:00+09:00",
      "end_time": "19:00+09:00"
    },
    "key_url": null,
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

Always Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys/K-ab345-678ij-12mno" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=always \
     -d role=admin

Always Schedule Example Response

{
  "key": {
    "id": "K-ab345-678ij",
    "role": "admin",
    "schedule_type": "always",
    "temporary_schedule": null,
    "recurring_schedule": null,
    "key_url": {
      "url": "https://keyurl.akerun.com/.....",
      "password_protected": true
    },
    "akerun": {
      "id": "A1030001",
      "name": "執務室表口"
    },
    "user": {
      "id": "A1030001",
      "name": "アケルン太郎"
    }
  }
}

事業所のユーザーの合鍵を更新します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/keys/{KEY_ID}

必要なスコープ

organization:key:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
key_id*String合鍵のID
schedule_type*String合鍵の日時設定タイプ
(always,temporary,recurringのいずれか)
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時
ISO 8601形式)
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時
ISO 8601形式)
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻
(時刻とタイムゾーン ex: 12:30+09:00)
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻
(時刻とタイムゾーン ex: 14:30+09:00)
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
enable_key_urlBooleanURL合鍵の有効無効
key_url_passwordStringURL合鍵のパスワード
(4桁の数字)
roleStringユーザーのAkerunに対しての権限(guest,admin)

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
keyKey Object合鍵オブジェクト
key >
id
String合鍵のID
key >
role
StringユーザーのAkerunに対しての権限(guest,admin)
key >
schedule_type
String合鍵の日時設定タイプ(always,temporary,recurringのいずれか)
key >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key >
key_url
Object/NULLURL合鍵詳細オブジェクト
key >
key_url >
url
StringURL合鍵のURL
key >
key_url >
password_protected
BooleanURL合鍵にパスワードが設定されているか
key >
akerun
Akerun Objectユーザーの名前
key >
akerun >
id
StringAkerun ID
key >
akerun >
name
StringAkerunの名前
key >
user
User Objectユーザーオブジェクト
key >
user >
id
StringユーザーのID
key >
user >
name
Stringユーザーの名前

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400リクエストパラメータが不正
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
key_not_found404key_idで指定した合鍵が存在しない

合鍵削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/keys/K-ab345-678ij-12mno" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

事業所のユーザーの合鍵を削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/keys/{KEY_ID}

必要なスコープ

organization:key:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*StringString事業所のID
key_id*StringString合鍵のID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
key_not_found404key_idで指定した合鍵が存在しない
not_allowed404許可されていない行為

グループ合鍵

グループ合鍵一覧

Example Response

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "key_groups": [
    {
      "id": "KG-hijkl-mnopq-123456",
      "role": "guest",
      "schedule_type": "temporary",
      "temporary_schedule": {
        "start_datetime": "2017-09-13T12:30+09:00",
        "end_datetime": "2017-09-20T12:30+09:00"
      },
      "recurring_schedule": null,
      "user_group": {
        "id": "UG-hijkl-mnopq-123456",
        "name": "開発部"
      },
      "akerun_group": {
        "id": "AG-hijkl-mnopq-123456",
        "name": "執務室"
      }
    },
    {
      "id": "KG-rstu12-34567-8901",
      "role": "guest",
      "schedule_type": "recurring",
      "temporary_schedule": null,
      "recurring_schedule": {
        "days_of_week": [1, 2, 3, 4, 5],
        "start_time": "10:00+09:00",
        "end_time": "19:00+09:00"
      },
      "user_group": {
        "id": "UG-rstu12-34567-8901",
        "name": "開発部"
      },
      "akerun_group": {
        "id": "AG-rstu12-34567-8901",
        "name": "執務室"
      }
    },
    {
      "id": "KG-qwe12-asdf345-zxc567",
      "role": "guest",
      "schedule_type": "always",
      "temporary_schedule": null,
      "recurring_schedule": null,
      "user_group": {
        "id": "UG-qwe12-asdf345-zxc567",
        "name": "開発部"
      },
      "akerun_group": {
        "id": "AG-qwe12-asdf345-zxc567",
        "name": "執務室"
      }
    }
  ]
}

事業所に属するグループ合鍵一覧を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/key_groups

必要なスコープ

organization:key_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所の ID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
key_groupsKey Group Object合鍵オブジェクト
key_groups >
id
Stringグループ合鍵の ID
key_groups >
schedule_type
Stringグループ合鍵の日時設定タイプ(always,temporary,recurring のいずれか)
key_groups >
role
Stringユーザーの Akerun に対しての権限(guest)
key_groups >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key_groups >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key_groups >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key_groups >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key_groups >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key_groups >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_groups >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_groups >
user_group
User Objectユーザーグループオブジェクト
key_groups >
user_group >
id
Stringユーザーグループの ID
key_groups >
user_group >
name
Stringユーザーグループの名前
key_groups >
akerun_group
Akerun ObjectAkerun グループの名前
key_groups >
akerun_group >
id
StringAkerun グループの ID
key_groups >
akerun_group >
name
StringAkerun グループの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定された OAuth スコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_id で指定した事業所が存在しない

グループ合鍵詳細

Example Response

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups/KG-abcde-fghij12-34567" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "key_group": {
    "id": "KG-abcde-fghij12-34567",
    "role": "guest",
    "schedule_type": "recurring",
    "temporary_schedule": null,
    "recurring_schedule": {
      "days_of_week": [1, 2, 3, 4, 5],
      "start_time": "10:00+09:00",
      "end_time": "19:00+09:00"
    },
    "user_group": {
      "id": "UG-abcde-fghij12-34567",
      "name": "開発部"
    },
    "akerun_group": {
      "id": "AG-abcde-fghij12-34567",
      "name": "執務室"
    }
  }
}

事業所に属するグループ合鍵一覧を取得します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/key_groups/{KEY_GROUP_ID}

必要なスコープ

organization:key_group:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所の ID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
key_groupKey Group Object合鍵オブジェクト
key_group >
id
Stringグループ合鍵の ID
key_group >
schedule_type
Stringグループ合鍵の日時設定タイプ(always,temporary,recurring のいずれか)
key_group >
role
Stringユーザーの Akerun に対しての権限(guest)
key_group >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key_group >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key_group >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key_group >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key_group >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key_group >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
user_group
User Objectユーザーグループオブジェクト
key_group >
user_group >
id
Stringユーザーグループの ID
key_group >
user_group >
name
Stringユーザーグループの名前
key_group >
akerun_group
Akerun ObjectAkerun グループの名前
key_group >
akerun_group >
id
StringAkerun グループの ID
key_group >
akerun_group >
name
StringAkerun グループの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定された OAuth スコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_id で指定した事業所が存在しない
key_group_not_found404key_group_id で指定した グループ合鍵が存在しない

グループ合鍵作成

Temporary Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_group_id=UG-12345-67890-09876 \
     -d akerun_group_id=AG-12345-67890-09876 \
     -d schedule_type=temporary \
     --data-urlencode temporary_schedule[start_datetime]=2017-09-13T12:30+09:00 \
     --data-urlencode temporary_schedule[end_datetime]=2017-09-20T12:30+09:00

Temporary Schedule Example Response

{
  "key_group": {
      "id": "KG-12345-67890-09876",
      "role": "guest",
      "schedule_type": "temporary",
      "temporary_schedule": {
          "start_datetime": "2017-09-13T12:30+09:00",
          "end_datetime": "2017-09-20T12:30+09:00"
      },
      "recurring_schedule": null,
      "user_group": {
          "id": "UG-12345-67890-09876",
          "name": "開発部"
      },
      "akerun_group": {
          "id": "AG-12345-67890-09876",
          "name": "執務室"
      }
  }
}

Recurring Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_group_id=UG-12345-67890-09876 \
     -d akerun_group_id=AG-12345-67890-09876 \
     -d schedule_type=recurring \
     --data-urlencode recurring_schedule[start_time]=10:00+09:00 \
     --data-urlencode recurring_schedule[end_time]=19:00+09:00 \
     -d recurring_schedule[days_of_week][]=1 \
     -d recurring_schedule[days_of_week][]=2 \
     -d recurring_schedule[days_of_week][]=3 \
     -d recurring_schedule[days_of_week][]=4 \
     -d recurring_schedule[days_of_week][]=5

Recurring Schedule Example Response

{
  "key_group": {
      "id": "KG-12345-67890-09876",
      "role": "guest",
      "schedule_type": "recurring",
      "temporary_schedule": null,
      "recurring_schedule": {
          "days_of_week": [1,2,3,4,5],
          "start_time": "10:00+09:00",
          "end_time": "19:00+09:00"
      },
      "user_group": {
          "id": "UG-12345-67890-09876",
          "name": "開発部"
      },
      "akerun_group": {
          "id": "AG-12345-67890-09876",
          "name": "執務室"
      }
  }
}

Always Schedule Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d user_group_id=UG-12345-67890-09876 \
     -d akerun_group_id=AG-12345-67890-09876 \
     -d schedule_type=always

Always Schedule Example Response

{
  "key_group": {
    "id": "KG-12345-67890-09876",
    "role": "guest",
    "schedule_type": "always",
    "temporary_schedule": null,
    "recurring_schedule": null,
    "user_group": {
      "id": "UG-12345-67890-09876",
      "name": "開発部"
    },
    "akerun_group": {
      "id": "AG-12345-67890-09876",
      "name": "執務室"
    }
  }
}

事業所にグループ合鍵を作成します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/key_groups

必要なスコープ

organization:key_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所の ID
user_group_id*Stringユーザーグループの ID
akerun_group_id*StringAkerun グループの ID
schedule_type*String合鍵の日時設定タイプ
(always,temporary,recurring のいずれか)
always
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時
ISO 8601形式)
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時
ISO 8601形式)
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻
(時刻とタイムゾーン ex: 12:30+09:00)
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻
(時刻とタイムゾーン ex: 14:30+09:00)
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
key_groupKey Group Object合鍵オブジェクト
key_group >
id
Stringグループ合鍵の ID
key_group >
schedule_type
Stringグループ合鍵の日時設定タイプ(always,temporary,recurring のいずれか)
key_group >
role
Stringユーザーの Akerun に対しての権限(guest)
key_group >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key_group >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key_group >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key_group >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key_group >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key_group >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
user_group
User Objectユーザーグループオブジェクト
key_group >
user_group >
id
Stringユーザーグループの ID
key_group >
user_group >
name
Stringユーザーグループの名前
key_group >
akerun_group
Akerun ObjectAkerun グループの名前
key_group >
akerun_group >
id
StringAkerun グループの ID
key_group >
akerun_group >
name
StringAkerun グループの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
invalid_params404リクエストパラメータが不正
akerun_group_not_found404akerun_group_idで指定したAkerunグループが存在しない
user_group_not_found404user_group_idで指定したユーザーグループが存在しない

グループ合鍵更新

Temporary Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups/KG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=temporary \
     --data-urlencode temporary_schedule[start_datetime]=2017-09-13T12:30+09:00 \
     --data-urlencode temporary_schedule[end_datetime]=2017-09-20T12:30+09:00

Temporary Schedule Example Response

{
  "key_group": {
      "id": "KG-12345-67890-09876",
      "role": "guest",
      "schedule_type": "temporary",
      "temporary_schedule": {
          "start_datetime": "2017-09-13T12:30+09:00",
          "end_datetime": "2017-09-20T12:30+09:00"
      },
      "recurring_schedule": null,
      "user_group": {
          "id": "UG-12345-67890-09876",
          "name": "開発部"
      },
      "akerun_group": {
          "id": "AG-12345-67890-09876",
          "name": "執務室"
      }
  }
}

Recurring Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups/KG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=recurring \
     --data-urlencode recurring_schedule[start_time]=10:00+09:00 \
     --data-urlencode recurring_schedule[end_time]=19:00+09:00 \
     -d recurring_schedule[days_of_week][]=1 \
     -d recurring_schedule[days_of_week][]=2 \
     -d recurring_schedule[days_of_week][]=3 \
     -d recurring_schedule[days_of_week][]=4 \
     -d recurring_schedule[days_of_week][]=5

Recurring Schedule Example Response

{
  "key_group": {
      "id": "KG-12345-67890-09876",
      "role": "guest",
      "schedule_type": "recurring",
      "temporary_schedule": null,
      "recurring_schedule": {
          "days_of_week": [1,2,3,4,5],
          "start_time": "10:00+09:00",
          "end_time": "19:00+09:00"
      },
      "user_group": {
          "id": "UG-12345-67890-09876",
          "name": "開発部"
      },
      "akerun_group": {
          "id": "AG-12345-67890-09876",
          "name": "執務室"
      }
  }
}

Always Schedule Example Request

curl -X PUT "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups/KG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d schedule_type=always

Always Schedule Example Response

{
  "key_group": {
    "id": "KG-12345-67890-09876",
    "role": "guest",
    "schedule_type": "always",
    "temporary_schedule": null,
    "recurring_schedule": null,
    "user_group": {
      "id": "UG-12345-67890-09876",
      "name": "開発部"
    },
    "akerun_group": {
      "id": "AG-12345-67890-09876",
      "name": "執務室"
    }
  }
}

事業所のグループ合鍵を更新します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

PUT https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/key_groups/{KEY_GROUP_ID}

必要なスコープ

organization:key_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所の ID
key_group_id*Stringグループ合鍵の ID
schedule_type*Stringグループ合鍵の日時設定タイプ
(always,temporary,recurring のいずれか)
always
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時
ISO 8601形式)
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時
ISO 8601形式)
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻
(時刻とタイムゾーン ex: 12:30+09:00)
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻
(時刻とタイムゾーン ex: 14:30+09:00)
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
key_groupKey Group Object合鍵オブジェクト
key_group >
id
Stringグループ合鍵の ID
key_group >
schedule_type
Stringグループ合鍵の日時設定タイプ(always,temporary,recurring のいずれか)
key_group >
role
Stringユーザーの Akerun に対しての権限(guest)
key_group >
temporary_schedule
Object/NULL一時利用合鍵詳細オブジェクト
key_group >
temporary_schedule >
start_datetime
String一時利用合鍵の開始日時(ISO 8601形式)
key_group >
temporary_schedule >
end_datetime
String一時利用合鍵の終了日時(ISO 8601形式)
key_group >
recurring_schedule
Object/NULL繰り返し合鍵詳細オブジェクト
key_group >
recurring_schedule >
days_of_week
Array[Integer]繰り返し合鍵の曜日
(0=日曜日..6=土曜日)
key_group >
recurring_schedule >
start_time
String繰り返し合鍵の開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
recurring_schedule >
end_time
String繰り返し合鍵の終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
key_group >
user_group
User Objectユーザーグループオブジェクト
key_group >
user_group >
id
Stringユーザーグループの ID
key_group >
user_group >
name
Stringユーザーグループの名前
key_group >
akerun_group
Akerun ObjectAkerun グループの名前
key_group >
akerun_group >
id
StringAkerun グループの ID
key_group >
akerun_group >
name
StringAkerun グループの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定された OAuth スコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_id で指定した事業所が存在しない
invalid_params404リクエストパラメータが不正
key_group_not_found404key_group_id で指定した Akerun グループが存在しない
not_allowed403発行できる合鍵の上限を超えた

グループ合鍵削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-ab345-678ij/key_groups/KG-12345-67890-09876" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

事業所のグループ合鍵を削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/key_groups/{KEY_GROUP_ID}

必要なスコープ

organization:key_group:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
key_group_id*Stringグループ合鍵のID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
key_group_not_found404key_group_idで指定したAkerunグループが存在しない

ICカード

ICカード登録

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-93523-73916/users/U-05746-32443/nfcs" \
     -H "Authorization: Bearer 806ec77145e054387e5be7c9e21668fd19795d63b988622a5117edce523a74e6" \
     -d nfc_chip_id=04b2a4e2b64890 \
     -d nfc_name=アケルン太郎のICカード

Example Response

{
  "nfc": {
    "id": "NC00496",
    "name": "アケルン太郎のICカード"
  }
}

事業所のユーザーにICカードを登録します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users/{USER_ID}/nfcs

必要なスコープ

organization:nfc:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_id*StringユーザーのID
nfc_chip_id*StringICカードの固有ID番号
nfc_nameStringICカードの名前(60文字以内)

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
nfcICCard ObjectICカードオブジェクト
nfc >
id
StringICカードのID
nfc >
name
StringICカードの名前

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
not_allowed403nfc_chip_idで指定したICカードが他のユーザーに使用されている、または紐付けようとしているユーザーが既にICカードを持っていた場合
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
user_not_found404user_idで指定したユーザーが事業所に存在しない
invalid_params400パラメータが不正

※Akerun Pro1台につき登録できるICカード数は、上限1,500枚となっております。1,500枚を超えた場合、"code": "not_allowed""message": "Cannot proccess the request."を返します。

ICカード削除

Example Request

curl -X DELETE "https://api.akerun.com/v3/organizations/O-93523-71934/users/U-05746-35423/nfcs/NC00496" \
     -H "Authorization: Bearer 806ec77145e054387e5be7c9e21668fd19795d63b988622a5117edce523a74e6"

事業所のユーザーのICカードを削除します。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

DELETE https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/users/{USER_ID}/nfcs/{ICCARD_ID}

必要なスコープ

organization:nfc:write

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
user_id*StringユーザーのID
nfc_id*StringICカードのID

成功レスポンス

HTTP STATUS CODE: 204

無し

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
not_allowed403nfc_idで指定したICカードのオーナーでは無い
organization_not_found404organization_idで指定した事業所が存在しない
nfc_not_found404nfc_idで指定したICカードが存在しない

履歴

履歴一覧

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/accesses" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d limit=100 \
     --data-urlencode datetime_after=2017-07-23T10:00:00+09:00 \
     --data-urlencode datetime_before=2017-07-29T19:00:00+09:00 \
     -d akerun_ids[]=A1030001 \
     -d akerun_ids[]=A1030002

Example Response

{
  "accesses": [
    {
      "id": 1234567890921123456789,
      "action": "unlock",
      "device_type": "akerun_app",
      "device_name": "iOS iPhone",
      "accessed_at": "2017-07-24T06:37:19Z",
      "akerun": {
        "id": "A1030001",
        "name": "執務室表口",
        "image_url": "https://akerun.com/akerun_example1.jpg"
      },
      "user": {
        "id": "U-ab345-678ij",
        "name": "Photosynth太郎",
        "image_url": "https://akerun.com/user_example1.jpg"
      }
    },
    {
      "id": 1234567890921123456790,
      "action": "unlock",
      "device_type": "akerun_app",
      "device_name": "iOS iPhone",
      "accessed_at": "2017-07-24T06:40:19Z",
      "akerun": {
        "id": "A1030002",
        "name": "執務室裏口",
        "image_url": "https://akerun.com/akerun_example2.jpg"
      },
      "user": {
        "id": "U-ab345-678ij",
        "name": "Photosynth太郎",
        "image_url": "https://akerun.com/user_example2.jpg"
      }
    }
  ]
}

開閉および入退室の履歴の一覧を取得します。

Akerun Proの履歴の一部は、一度Akerun Pro本体に保存された後、Akerun Remoteなどを経由してサーバーにアップロードされるため、実際の開閉から本APIで取得できるようになるまで時間差が生じます。

一度取得した履歴と履歴の間に新しい履歴が追加されることもあるため、履歴をもれなく取得する必要がある場合、datetimeではなく、サーバーへのアップロード順であるidでソートして履歴を取得してください。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/accesses

必要なスコープ

organization:access:read

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_idsStringAkerun IDの配列
user_idsStringユーザーIDの配列
limitStringレスポンスの最大件数(1から1,000の数字)100
datetime_afterString履歴を絞り込む時刻(ISO 8601形式) (注)
datetime_beforeString履歴を絞り込む時刻(ISO 8601形式)
id_beforeString履歴を絞り込むID
id_afterString履歴を絞り込むID
sort_byStringソート基準(id,datetimeのどちらか)datetime
sort_orderStringソート順(asc,descのどちらか)
asc → 昇順
desc → 降順
desc

(注)絞り込み時刻は大なり(>)または小なり(<)で条件適用されます。

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
accessesArray[Access Object]履歴オブジェクトの配列
accesses >
id
Integer履歴のID
accesses >
action
String解錠、施錠、ICカードをかざした
accesses >
device_type
String端末種別
accesses >
device_name
String端末名
accesses >
accessed_at
String開閉および入退室の時刻
accesses >
akerun
Akerun Object/NULLAkerunオブジェクト
accesses >
akerun >
id
StringAkerun ID
accesses >
akerun >
name
StringAkerunの名前
accesses >
akerun >
image_url
StringAkerunの画像
accesses >
user
User Object/NULLユーザーオブジェクト
accesses >
user >
id
StringユーザーのID
accesses >
user >
name
Stringユーザーの名前
accesses >
user >
image_url
Stringユーザー画像

action、device_type、device_nameの詳細は下記通りです。

PropertyValue
action"unlock", "lock", "none"
device_type"mobile_app", "manager", "connect", "nfc_outside", "nfc_inside", "autolock", 'hand", 'button", "key_url", "public_api", "mobile_app_remote"
device_name"オートロック", "タイムアウト", "ボタン", "手動", "オートロック設定オン", "オートロック時間開始", "NFC", "Akerun App iOS", "Akerun App Android", "Akerun WebManager", "Akerun Connect", "URL鍵", "iOSアプリ(遠隔)", "Androidアプリ(遠隔)", "API"

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400パラメータが不正
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

遠隔操作

施錠リクエスト

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001/jobs/lock" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "job": {
    "id": 12345678909
  }
}

事業所のAkerunで施錠を行います。 この操作はAkerun Remoteを経由して非同期で行われます。

処理の実行状況はレスポンスのjob > idを使い、施錠結果確認APIで確認することができます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}/jobs/lock

必要なスコープ

organization:akerun:lock

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_id*StringAkerun ID

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
not_allowed403現在Akerunを操作できる合鍵を持っていない
remote_not_paired403akerun_idで指定したAkerunがAkerun Remoteとペアリングされていない
duplicate_job403Akerun Remoteがまだ処理中の施錠ジョブが存在する
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

施錠結果確認

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/jobs/lock/12345678909" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Queued Lock Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "lock",
    "status": "queued",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": nil,
    "result": nil
  }
}

Finished Lock Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "lock",
    "status": "finished",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": "2017-06-26T06:38:19Z",
    "result": "succeeded"
  }
}

施錠ジョブの処理状況を確認できます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/jobs/lock/{JOB_ID}

必要なスコープ

organization:akerun:lock

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
job_id*IntegerジョブのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID
job > typeStringジョブの種類
job > statusStringジョブの実行状況
job > queued_atStringジョブが作成された時刻
job > finished_atStringジョブが実行終了した時刻
job > resultStringジョブの結果

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
job_not_found404job_idで指定したジョブが存在しない

解錠リクエスト

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001/jobs/unlock" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "job": {
    "id": 12345678909
  }
}

事業所のAkerunで解錠を行います。 この操作はAkerun Remoteを経由して非同期で行われます。

処理の実行状況はレスポンスのjob > idを使い、解錠結果確認APIで確認することができます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}/jobs/unlock

必要なスコープ

organization:akerun:lock

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_id*StringAkerun ID

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
not_allowed403現在Akerunを操作できる合鍵を持っていない
remote_not_paired403akerun_idで指定したAkerunがAkerun Remoteとペアリングされていない
duplicate_job403Akerun Remoteがまだ処理中の解錠ジョブが存在する
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

解錠結果確認

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/jobs/unlock/12345678909" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Queued Unlock Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "unlock",
    "status": "queued",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": nil,
    "result": nil
  }
}

Finished Unlock Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "unlock",
    "status": "finished",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": "2017-06-26T06:38:19Z",
    "result": "succeeded"
  }
}

解錠ジョブの処理状況を確認できます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/jobs/unlock/{JOB_ID}

必要なスコープ

organization:akerun:lock

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
job_id*IntegerジョブのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID
job > typeStringジョブの種類
job > statusStringジョブの実行状況(queued,finished)
job > queued_atStringジョブが作成された時刻
job > finished_atStringジョブが実行終了した時刻
job > resultStringジョブの結果(succeeded,failed)

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
job_not_found404job_idで指定したジョブが存在しない

状態取得リクエスト

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001/jobs/state" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Example Response

{
  "job": {
    "id": 12345678909
  }
}

事業所のAkerunの状態取得を行います。 この操作はAkerun Remoteを経由して非同期で行われます。

処理の実行状況はレスポンスのjob > idを使い、状態取得結果確認APIで確認することができます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}/jobs/state

必要なスコープ

organization:akerun:state

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_id*StringAkerun ID

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
not_allowed403現在Akerunを操作できる合鍵を持っていない
remote_not_paired403akerun_idで指定したAkerunがAkerun Remoteとペアリングされていない
duplicate_job403Akerun Remoteがまだ処理中の状態取得ジョブが存在する
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

状態取得結果確認

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/jobs/state/12345678909" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Queued State Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "state",
    "status": "queued",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": nil,
    "result": nil
  }
}

Finished State Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "state",
    "status": "finished",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": "2017-06-26T06:38:19Z",
    "result": "succeeded"
  }
}

状態取得ジョブの処理状況を確認できます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/jobs/state/{JOB_ID}

必要なスコープ

organization:akerun:state

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
job_id*IntegerジョブのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID
job > typeStringジョブの種類
job > statusStringジョブの実行状況(queued,finished)
job > queued_atStringジョブが作成された時刻
job > finished_atStringジョブが実行終了した時刻
job > resultStringジョブの結果(succeeded,failed)

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
job_not_found404job_idで指定したジョブが存在しない

設定変更リクエスト

Example Request

curl -X POST "https://api.akerun.com/v3/organizations/O-ab345-678ij/akeruns/A1030001/jobs/setting" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d autolock=true \
     --data-urlencode autolock_off_schedule[start_time]=10:00+09:00 \
     --data-urlencode autolock_off_schedule[end_time]=19:00+09:00 \
     -d autolock_off_schedule[days_of_week][]=0 \
     -d autolock_off_schedule[days_of_week][]=6 \
     -d open_door_alert=true \
     -d open_door_alert_second=30 \
     -d push_button=false \
     -d normal_sound_volume=0 \
     -d alert_sound_volume=100

Example Response

{
  "job": {
    "id": 12345678909
  }
}

事業所のAkerunの設定変更を行います。 この操作はAkerun Remoteを経由して非同期で行われます。

処理の実行状況はレスポンスのjob > idを使い、設定変更結果確認APIで確認することができます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

POST https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/akeruns/{AKERUN_ID}/jobs/setting

必要なスコープ

organization:akerun:setting

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
akerun_id*StringAkerun ID
autolockBooleanオートロック
autolock_off_schedule >
start_time
Stringオートロックオフ開始時刻(時刻とタイムゾーン ex: 12:30+09:00)
autolock_off_schedule >
end_time
Stringオートロックオフ終了時刻(時刻とタイムゾーン ex: 12:30+09:00)
autolock_off_schedule >
days_of_week
Array[Integer]オートロックオフ曜日(0=日曜日..6=土曜日)
open_door_alertBooleanドア開けっ放し警告(true=有効,false=無効)
open_door_alert_secondIntegerドア開けっ放し警告までの秒数(30,60,180のいずれか)
push_buttonBooleanプッシュボタンでの施錠・解錠(true=有効,false=無効)
normal_sound_volumeInteger操作音(1から100の数字)
alert_sound_volumeInteger警告音(1から100の数字)

成功レスポンス

HTTP STATUS CODE: 201

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID

エラーレスポンス

CodeHTTP Status CodeDescription
invalid_params400パラメータが不正
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
not_allowed403現在Akerunを操作できる合鍵を持っていない
remote_not_paired403akerun_idで指定したAkerunがAkerun Remoteとペアリングされていない
organization_not_found404organization_idで指定した事業所が存在しない
akerun_not_found404akerun_idで指定したAkerunが事業所に存在しない

設定変更結果確認

Example Request

curl -X GET "https://api.akerun.com/v3/organizations/O-ab345-678ij/jobs/setting/12345678909" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252"

Queued Setting Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "setting",
    "status": "queued",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": nil,
    "result": nil
  }
}

Finished Setting Job Example Response

{
  "job": {
    "id": 12345678909,
    "type": "setting",
    "status": "finished",
    "queued_at": "2017-06-26T06:37:19Z",
    "finished_at": "2017-06-26T06:38:19Z",
    "result": "succeeded"
  }
}

設定変更ジョブの処理状況を確認できます。

HTTP リクエストヘッダ

Authorization: Bearer {ACCESS_TOKEN}

HTTP リクエスト

GET https://api.akerun.com/v3/organizations/{ORGANIZATION_ID}/jobs/setting/{JOB_ID}

必要なスコープ

organization:akerun:setting

パラメータ

(* 必須)

ParameterTypeDescriptionDefault
organization_id*String事業所のID
job_id*IntegerジョブのID

成功レスポンス

HTTP STATUS CODE: 200

PropertyTypeDescription
jobJob Objectジョブオブジェクト
job > idIntegerジョブのID
job > typeStringジョブの種類
job > statusStringジョブの実行状況(queued,finished)
job > queued_atStringジョブが作成された時刻
job > finished_atStringジョブが実行終了した時刻
job > resultStringジョブの結果(succeeded,failed)

エラーレスポンス

CodeHTTP Status CodeDescription
unauthorized401アクセストークン不正
insufficient_scope403指定されたOAuthスコープを持っていない
insufficient_authority403マネージャー以上でない
not_in_organization403事業所に属していない
organization_not_found404organization_idで指定した事業所が存在しない
job_not_found404job_idで指定したジョブが存在しない

ページネーション

Pagination Example Request

curl -X GET "https://api.akerun.com/v3/organizations" \
     -H "Authorization: Bearer c226b89bce98ebb8f6626be1bda25fb80ac56de6a1f7b3526cbad59e0e4af252" \
     -d id_after=O-00000-00001 \
     -d id_before=O-00000-00005 \
     -d limit=2

Pagination Example Response

{
  "organizations": [
    {
      "id": "O-00000-00002"
    },
    {
      "id": "O-00000-00003"
    }
  ]
}

一覧取得系のAPIではデータの取得範囲を指定することができます。 本APIでは id_afterid_beforelimit のパラメーターを使ったカーソルベースの ページネーションを使用しています。

id_after のパラメーターを指定した場合、id_after で指定された 後のデータを返します。 id_before のパラメーターを指定した場合、id_before で指定された 前のデータを返します。

id_afterid_before 両方のパラメーターを指定した場合、 両方のパラメーターの条件を満たしたデータを返します。

利用可能なパラメータ

ParameterDescriptionDefault
id_afterid_after より1つ後のデータが開始位置になりますなし
id_beforeid_before より1つ前のデータが終了位置になりますなし
limit取得件数(1から1,000の数字)APIごとに設定されています

エラーレスポンス

V3 Example Response

{
  "code": "akerun_not_found",
  "message": "Akerun not found."
}

Authentication Example Response

{
  "error": "invalid_client",
  "error_description": "Authentication failed."
}

API リクエストでエラーが発生した場合、その原因を含むエラーレスポンスをJSONデータで返します。 code はエラーの種別を示し、message は原因の説明を示します。

OAuth認証のAPI リクエストでエラーが発生した場合、その原因を含むエラーレスポンスをJSONデータで返します。 error はエラーの種別を示し、error_description は原因の説明を示します。

リクエスト制限

本APIにはリクエスト制限が設けられています。 制限を超えたリクエストが行われた場合は、エラーが返却されます。

リクエスト制限値は、50リクエスト/分 です。 これを超える利用を行いたい場合は、 support@photosynth.co.jp までお問い合わせください。

サンプル

他サービスとの連携サンプルは随時公開します。