文档导航
API 参考
Smartlocker
Codes · Door
概览
使用以下路径和方法。请将示例标识符和 YOUR_API_TOKEN 替换为您有权使用的值;本页不会执行任何示例。
基础 URL
https://api.stayclean.io身份验证
Authorization: Basic YOUR_API_TOKEN
/api/v1/properties/{id}/smartlocker/codes列出房源的 Smartlocker 代码
返回所有已配置的代码及其同步状态。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
限制为每分钟 10 次、每小时 100 次、每天 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
}
]
}/api/v1/properties/{id}/smartlocker/codes创建 Smartlocker 代码
为指定标识符新增代码,并与门锁同步。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
| identifier | string | 请求体 | 是 | 为房源配置的代码标识符。vendor |
| mode | string | 请求体 | 否 | 代码生成模式:random 或 manual。manual |
| code | string | 请求体 | 否 | manual 模式下必填:4 至 10 位介于 1 和 7 之间的数字,以字符串形式发送。123456 |
| label | string | 请求体 | 否 | 访问代码的可选标签。Cleaning access |
限制为每分钟 10 次、每小时 100 次、每天 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": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}删除 Smartlocker 代码
从房源中移除代码,并将其从智能门锁中删除。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
| identifier | string | 路径 | 是 | 必填路径参数。 |
限制为每分钟 10 次、每小时 100 次、每天 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": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}更新 Smartlocker 代码
更新现有代码的标签或值,并同步门锁。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
| identifier | string | 路径 | 是 | 必填路径参数。 |
| mode | string | 请求体 | 否 | 代码生成模式:random 或 manual。manual |
| code | string | 请求体 | 否 | manual 模式下必填:4 至 10 位介于 1 和 7 之间的数字,以字符串形式发送。123456 |
| label | string | 请求体 | 否 | 访问代码的可选标签。Cleaning access |
限制为每分钟 10 次、每小时 100 次、每天 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": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}/reset重置 Smartlocker 代码
为目标标识符生成新代码并更新门锁。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
| identifier | string | 路径 | 是 | 必填路径参数。 |
| mode | string | 请求体 | 否 | 代码生成模式:random 或 manual。manual |
| code | string | 请求体 | 否 | manual 模式下必填:4 至 10 位介于 1 和 7 之间的数字,以字符串形式发送。123456 |
| label | string | 请求体 | 否 | 访问代码的可选标签。Cleaning access |
限制为每分钟 10 次、每小时 100 次、每天 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": []
}/api/v1/properties/{id}/smartlocker/door/close锁住房源的门
触发与房源连接的智能门锁的上锁操作。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
限制为每分钟 10 次、每小时 100 次、每天 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
}/api/v1/properties/{id}/smartlocker/door/open解锁房源的门
触发与房源连接的智能门锁的解锁操作。
参数
| 参数 | 类型 | 位置 | 必填 | 详情 |
|---|---|---|---|---|
| id | string | 路径 | 是 | 必填路径参数。 |
限制为每分钟 10 次、每小时 100 次、每天 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
}