انتقل إلى المحتوى
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المسارنعممعلمة مسار مطلوبة.

الحد هو 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
        }
    ]
}
POST/api/v1/properties/{id}/smartlocker/codes

إنشاء رمز Smartlocker

يضيف رمزًا جديدًا لمعرف محدد ويزامنه مع القفل.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.
identifierstringالمحتوىنعممعرف الرمز المضبوط للعقار.vendor
modestringالمحتوىلاوضع توليد الرمز: random أو manual.manual
codestringالمحتوىلامطلوب في وضع manual: من 4 إلى 10 أرقام بين 1 و7، مرسلة كسلسلة نصية.123456
labelstringالمحتوىلاتسمية اختيارية لرمز الدخول.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": []
}
DELETE/api/v1/properties/{id}/smartlocker/codes/{identifier}

حذف رمز Smartlocker

يزيل رمزًا من العقار ويحذفه من القفل الذكي.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.
identifierstringالمسارنعممعلمة مسار مطلوبة.

الحد هو 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": []
}
PUTPATCH/api/v1/properties/{id}/smartlocker/codes/{identifier}

تحديث رمز Smartlocker

يحدث تسمية رمز موجود أو قيمته ويزامن القفل.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.
identifierstringالمسارنعممعلمة مسار مطلوبة.
modestringالمحتوىلاوضع توليد الرمز: random أو manual.manual
codestringالمحتوىلامطلوب في وضع manual: من 4 إلى 10 أرقام بين 1 و7، مرسلة كسلسلة نصية.123456
labelstringالمحتوىلاتسمية اختيارية لرمز الدخول.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": []
}
POST/api/v1/properties/{id}/smartlocker/codes/{identifier}/reset

إعادة تعيين رمز Smartlocker

يولد رمزًا جديدًا للمعرف المستهدف ويحدث القفل.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.
identifierstringالمسارنعممعلمة مسار مطلوبة.
modestringالمحتوىلاوضع توليد الرمز: random أو manual.manual
codestringالمحتوىلامطلوب في وضع manual: من 4 إلى 10 أرقام بين 1 و7، مرسلة كسلسلة نصية.123456
labelstringالمحتوىلاتسمية اختيارية لرمز الدخول.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": []
}
POST/api/v1/properties/{id}/smartlocker/door/close

قفل باب عقار

ينفذ إجراء القفل على القفل الذكي المتصل بالعقار.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.

الحد هو 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
}
POST/api/v1/properties/{id}/smartlocker/door/open

فتح باب عقار

ينفذ إجراء فتح القفل على القفل الذكي المتصل بالعقار.

المعلمات

المعلمةالنوعالموقعمطلوبالتفاصيل
idstringالمسارنعممعلمة مسار مطلوبة.

الحد هو 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
}