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

APIリファレンス

Customers

Interventions

2 エンドポイントREST / JSON

概要

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

ベースURL

https://api.stayclean.io

認証

Authorization: Basic YOUR_API_TOKEN

GET/api/v1/interventions

作業一覧を取得する

すべての清掃作業を返します。

パラメータ

パラメータ型場所必須詳細
pageintegerクエリいいえページ番号(既定1)。1
limitintegerクエリいいえ1ページの結果数(上限100)。25
sortstringクエリいいえ作業日時の並び順(ascまたはdesc、既定desc)。desc

API認証が必要です。

リクエスト制限:60 / 分1200 / 時間4800 / 日

リクエスト例 · GET

cURL

curl --request 'GET' 'https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc", {
    "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/interventions?page=1&limit=25&sort=desc');
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/interventions?page=1&limit=25&sort=desc", data=data, headers=headers, method="GET")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "metadata": {
        "page": 1,
        "limit": 25,
        "total_items": 120,
        "total_pages": 5,
        "sort": "desc"
    },
    "nodes": [
        {
            "id": "6dfc7a2e-8f9a-4a0f-9bd0-3f5a7d123456",
            "status": "pending",
            "scheduled_at": "2024-06-01T08:00:00+10:00",
            "property": {
                "id": "6dfc7a2e-8f9a-4a0f-9bd0-3f5a7d123456",
                "name": "Villa Moana"
            },
            "is_started": false,
            "booking": {
                "id": "e9d3a5c2-04bf-4a76-9f79-8db3bfc69f8e",
                "guest": "Jane Doe"
            },
            "invoice": {
                "id": "f6a9c1f2-5d7b-4a2d-b1b2-0a7c0d61bcd1"
            },
            "live": {
                "status": "pending",
                "is_done": false,
                "is_validated": false,
                "started_at": null,
                "ended_at": null,
                "is_paid": false
            },
            "accounting": {
                "amount": null,
                "paid_at": null
            }
        }
    ]
}
GET/api/v1/interventions/{id}

作業を取得する

特定の作業の詳細を返します。

パラメータ

パラメータ型場所必須詳細
idstringパスはい必須のパスパラメータ。
purgestringクエリいいえ指定すると、この識別子のRedisキャッシュを消去してからレスポンスを再計算します。1

レスポンスは60秒間キャッシュされます。

リクエスト制限:60 / 分1200 / 時間4800 / 日

リクエスト例 · GET

cURL

curl --request 'GET' 'https://api.stayclean.io/api/v1/interventions/00000000-0000-4000-8000-000000000000?purge=1' \
  --header 'Authorization: Basic YOUR_API_TOKEN' \
  --header 'Accept: application/json'

JavaScript

const response = await fetch("https://api.stayclean.io/api/v1/interventions/00000000-0000-4000-8000-000000000000?purge=1", {
    "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/interventions/00000000-0000-4000-8000-000000000000?purge=1');
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/interventions/00000000-0000-4000-8000-000000000000?purge=1", data=data, headers=headers, method="GET")
with urlopen(request) as response:
    result = json.load(response)

レスポンス例

{
    "id": "6dfc7a2e-8f9a-4a0f-9bd0-3f5a7d123456",
    "status": "validated",
    "scheduled_at": "2024-06-01T08:00:00+10:00",
    "property": {
        "id": "6dfc7a2e-8f9a-4a0f-9bd0-3f5a7d123456",
        "name": "Villa Moana",
        "location": {
            "id": "1c3b6f9d-59c7-4b2b-91f8-9a6f8c01d7c2",
            "address": "PK 5, Route de Temae",
            "address_extend": null,
            "formated_address": "PK 5, Route de Temae, Moorea",
            "city": "Moorea",
            "latitude": "-17.5000",
            "longitude": "-149.8500",
            "landmark": null,
            "created_at": "2024-01-01 08:00:00",
            "updated_at": null,
            "zipcode": "98728",
            "island": {
                "id": "0d2d5e7f-0f8a-4c0f-9fb5-7b31f4a3a2df",
                "name": "Moorea"
            }
        },
        "indoor_area": 120,
        "outdoor_area": 80,
        "bedrooms": 3,
        "bathrooms": 2,
        "guests_capacity": 6,
        "wifi_ssid": "VillaMoana",
        "wifi_password": "secret",
        "wifi_protocol": 2,
        "door_code": "A-1234-B - 5678",
        "parking": "Parking privé"
    },
    "is_started": true,
    "booking": {
        "id": "e9d3a5c2-04bf-4a76-9f79-8db3bfc69f8e",
        "guest": "Jane Doe"
    },
    "invoice": {
        "id": "f6a9c1f2-5d7b-4a2d-b1b2-0a7c0d61bcd1"
    },
    "live": {
        "status": "validated",
        "is_done": true,
        "is_validated": true,
        "started_at": "2024-06-01T08:05:00+10:00",
        "ended_at": "2024-06-01T11:45:00+10:00",
        "is_paid": true
    },
    "accounting": {
        "amount": 15000,
        "paid_at": "2024-06-01T11:45:00+10:00"
    }
}