コンテンツに移動
stayclean
ドキュメントのナビゲーション
API docsSmartlocker

APIリファレンス

Smartlocker

Codes · Door

7 エンドポイントREST / JSON

概要

以下のパスとメソッドを使用してください。サンプルの識別子とYOUR_API_TOKENを、ご自身の権限に基づく値に置き換えてください。このページはサンプルを実行しません。

ベースURL

https://api.stayclean.io

認証

Authorization: Basic YOUR_API_TOKEN

GET/api/v1/properties/{id}/smartlocker/codes

物件のSmartlockerコード一覧を取得する

設定済みのすべてのコードと同期状態を返します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · GET

cURL

curl --request 'GET' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", {
    "method": "GET",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json"
    }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", data=data, headers=headers, method="GET")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "property_id": "uuid",
    "definitions": [
        {
            "identifier": "vendor",
            "label": "Code prestataire",
            "description": "Code utilisé par l’équipe de nettoyage."
        }
    ],
    "codes": [
        {
            "identifier": "vendor",
            "label": "Code prestataire",
            "description": "Code utilisé par l’équipe de nettoyage.",
            "code": 123456,
            "code_formatted": "123456",
            "configured": true,
            "synced": true
        }
    ]
}
POST/api/v1/properties/{id}/smartlocker/codes

Smartlockerコードを作成する

指定した識別子に新しいコードを追加し、ロックと同期します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。
identifierstring本文はい物件に設定されたコードの識別子。vendor
modestring本文いいえコード生成モード:randomまたはmanual。manual
codestring本文いいえmanualモードで必須:1から7の数字を4〜10桁、文字列で送信します。123456
labelstring本文いいえアクセスコードの任意のラベル。Cleaning access

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)。

想定する本文:identifier(string)、mode("random"|"manual")、code(string、mode = manualの場合は必須)、label(任意のstring)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · POST

cURL

curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "identifier": "vendor",
    "mode": "manual",
    "code": "123456",
    "label": "Code ménage"
}'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", {
    "method": "POST",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    "body": "{\n    \"identifier\": \"vendor\",\n    \"mode\": \"manual\",\n    \"code\": \"123456\",\n    \"label\": \"Code ménage\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
  2 => 'Content-Type: application/json',
),
    CURLOPT_POSTFIELDS => '{
    "identifier": "vendor",
    "mode": "manual",
    "code": "123456",
    "label": "Code ménage"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json",
    "Content-Type": "application/json"
}
payload = json.loads("{\n    \"identifier\": \"vendor\",\n    \"mode\": \"manual\",\n    \"code\": \"123456\",\n    \"label\": \"Code ménage\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", data=data, headers=headers, method="POST")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "entry": {
        "identifier": "vendor",
        "label": "Code ménage",
        "code": 123456,
        "configured": true,
        "synced": true
    },
    "codes": []
}
DELETE/api/v1/properties/{id}/smartlocker/codes/{identifier}

Smartlockerコードを削除する

物件からコードを削除し、スマートロックからも削除します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。
identifierstringパスはい必須のパスパラメータ。

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)、{identifier}(コード識別子)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · DELETE

cURL

curl --request 'DELETE' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", {
    "method": "DELETE",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json"
    }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", data=data, headers=headers, method="DELETE")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "codes": []
}
PUTPATCH/api/v1/properties/{id}/smartlocker/codes/{identifier}

Smartlockerコードを更新する

既存コードのラベルまたは値を更新し、ロックを同期します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。
identifierstringパスはい必須のパスパラメータ。
modestring本文いいえコード生成モード:randomまたはmanual。manual
codestring本文いいえmanualモードで必須:1から7の数字を4〜10桁、文字列で送信します。123456
labelstring本文いいえアクセスコードの任意のラベル。Cleaning access

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)、{identifier}(コード識別子)。

想定する本文:mode("random"|"manual")、code(string、mode = manualの場合は必須)、label(任意のstring)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · PUT

cURL

curl --request 'PUT' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "mode": "manual",
    "code": "654321",
    "label": "Code ménage (soir)"
}'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", {
    "method": "PUT",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    "body": "{\n    \"mode\": \"manual\",\n    \"code\": \"654321\",\n    \"label\": \"Code ménage (soir)\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
  2 => 'Content-Type: application/json',
),
    CURLOPT_POSTFIELDS => '{
    "mode": "manual",
    "code": "654321",
    "label": "Code ménage (soir)"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json",
    "Content-Type": "application/json"
}
payload = json.loads("{\n    \"mode\": \"manual\",\n    \"code\": \"654321\",\n    \"label\": \"Code ménage (soir)\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", data=data, headers=headers, method="PUT")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "entry": {
        "identifier": "vendor",
        "label": "Code ménage (soir)",
        "code": 654321,
        "configured": true,
        "synced": true
    },
    "codes": []
}
POST/api/v1/properties/{id}/smartlocker/codes/{identifier}/reset

Smartlockerコードをリセットする

対象の識別子に新しいコードを生成し、ロックを更新します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。
identifierstringパスはい必須のパスパラメータ。
modestring本文いいえコード生成モード:randomまたはmanual。manual
codestring本文いいえmanualモードで必須:1から7の数字を4〜10桁、文字列で送信します。123456
labelstring本文いいえアクセスコードの任意のラベル。Cleaning access

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)、{identifier}(コード識別子)。

想定する本文:mode("random"|"manual")、code(string、mode = manualの場合は必須)、label(任意のstring)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · POST

cURL

curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "mode": "random"
}'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset", {
    "method": "POST",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    "body": "{\n    \"mode\": \"random\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
  2 => 'Content-Type: application/json',
),
    CURLOPT_POSTFIELDS => '{
    "mode": "random"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json",
    "Content-Type": "application/json"
}
payload = json.loads("{\n    \"mode\": \"random\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset", data=data, headers=headers, method="POST")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "entry": {
        "identifier": "vendor",
        "code": 765432,
        "configured": true,
        "synced": true
    },
    "codes": []
}
POST/api/v1/properties/{id}/smartlocker/door/close

物件のドアを施錠する

物件に接続されたスマートロックを施錠します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · POST

cURL

curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close", {
    "method": "POST",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json"
    }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close", data=data, headers=headers, method="POST")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "door_open": true,
    "door_busy": true
}
POST/api/v1/properties/{id}/smartlocker/door/open

物件のドアを解錠する

物件に接続されたスマートロックを解錠します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。

1分あたり10件、1時間あたり100件、1日あたり500件に制限されます。

パスパラメータ:{id}(物件UUID)。

リクエスト制限:10 / 分100 / 時間500 / 日

リクエスト例 · POST

cURL

curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open", {
    "method": "POST",
    "headers": {
        "Authorization": "Basic YOUR_API_TOKEN",
        "Accept": "application/json"
    }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();

PHP

<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array (
  0 => 'Authorization: Basic YOUR_API_TOKEN',
  1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

PYTHON

import json
from urllib.request import Request, urlopen

headers = {
    "Authorization": "Basic YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open", data=data, headers=headers, method="POST")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "success": true,
    "door_open": false,
    "door_busy": true
}