CropPath cho nhà phát triển

Tài liệu API

alarms

5 thao tác

GET /v1/alarms

List the company's alarms

Xác thực: cookie · listAlarms

Chỉ dùng phiên đăng nhập — API token và ứng dụng OAuth không gọi được

#361 (ADR 0015). The selected company's alarms: state=open (the default: every alarm not closed, shelved ones included) in attention order, urgent, then warning, then notice, the oldest first within a priority (then by id), or closed, newest first (by id), optionally of one priority, growing area or device. An operator sees only the alarms of devices in their facilities. counts gives the open alarms by priority over every page (null for closed). under is computed on read (a zone alarm of a controller with an open controller_offline alarm is shown under it). At most 4 statements per page, through the alarms' indexes. no-store. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); an alarm is acknowledged and shelved by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

Tham số

TênVị tríKiểuMô tả
state
không bắt buộc
query"open" | "closed"

open (the default) or closed.

priority
không bắt buộc
query"urgent" | "warning" | "notice"

Only alarms of this priority.

area
không bắt buộc
querystring

Only alarms of this growing area (its code).

device
không bắt buộc
querystring

Only alarms of this device.

cursor
không bắt buộc
querystring

The previous page's next_cursor.

limit
không bắt buộc
queryinteger

At most this many items (1 to 100; 50 by default).

Phản hồi

Mã trạng tháiKiểuMô tả
200AlarmPage
application/json

A page of alarms.

400Error
application/json

A bad state, priority, area, device, cursor or limit, or a bad X-Request-Id.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin or auditor of the company, operator of the company within its facilities, agronomist of the company for the controllers and zones of the rules bound to a sheet they signed, or platform_admin acting for it, through a signed-in session only; lab users are refused), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "items": [
    {
      "id": 815,
      "kind": "delivered_over_limit",
      "catalog_version": 1,
      "priority": "urgent",
      "state": "cleared_unacked",
      "raised_at": "2026-10-21T23:20:00Z",
      "last_active_at": "2026-10-21T23:24:00Z",
      "cleared_at": "2026-10-22T00:05:00Z",
      "closed_at": null,
      "occurrences": 1,
      "acked": null,
      "shelved": null,
      "subject": {
        "type": "zone",
        "device": "ctl-02",
        "zone": 1,
        "area": "VN-LDG-VT02"
      },
      "detail": {
        "command_id": "0b9a8c7d-6e5f-4a3b-9c2d-1e0f9a8b7c6d",
        "litres": 2150,
        "max_volume_l": 2000
      },
      "response_anchor": "delivered_over_limit",
      "under": null
    },
    {
      "id": 812,
      "kind": "command_refused_site",
      "catalog_version": 1,
      "priority": "warning",
      "state": "active_unacked",
      "raised_at": "2026-10-22T05:12:00Z",
      "last_active_at": "2026-10-22T07:31:00Z",
      "cleared_at": null,
      "closed_at": null,
      "occurrences": 1,
      "acked": null,
      "shelved": null,
      "subject": {
        "type": "zone",
        "device": "ctl-03",
        "zone": 3,
        "area": "VN-LDG-VT03"
      },
      "detail": {
        "command_id": "6f1d2c3b-8a4e-4f0b-9c7d-1e2f3a4b5c6d",
        "reason": "manual_override_active"
      },
      "response_anchor": "command_refused_site",
      "under": null
    }
  ],
  "next_cursor": null,
  "counts": {
    "urgent": 1,
    "warning": 1,
    "notice": 0,
    "shelved": 0
  }
}
Phản hồi 400 · application/json · state
{
  "error": "bad state: open or closed",
  "code": "bad_state"
}
Phản hồi 400 · application/json · priority
{
  "error": "bad priority: urgent, warning or notice",
  "code": "bad_priority"
}
Phản hồi 400 · application/json · limit
{
  "error": "bad limit: 1 to 100",
  "code": "bad_limit"
}
Phản hồi 400 · application/json · cursor
{
  "error": "bad cursor",
  "code": "bad_cursor"
}
Phản hồi 400 · application/json · area
{
  "error": "bad area: a growing area code",
  "code": "bad_area"
}
Phản hồi 400 · application/json · device
{
  "error": "bad device: a device id",
  "code": "bad_device"
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Phản hồi 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Phản hồi 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Phản hồi 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/alarms/{id}

Read an alarm and its history

Xác thực: cookie · getAlarm

Chỉ dùng phiên đăng nhập — API token và ứng dụng OAuth không gọi được

#361 (ADR 0015). One alarm of the selected company with its events (alarm_events, append-only): oldest first, at most the 100 newest. no-store. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); an alarm is acknowledged and shelved by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

Tham số

TênVị tríKiểuMô tả
id
bắt buộc
pathstring

The alarm id.

Phản hồi

Mã trạng tháiKiểuMô tả
200AlarmDetail
application/json

The alarm with its events.

400Error
application/json

The X-Request-Id header is present and malformed.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin or auditor of the company, operator of the company within its facilities, agronomist of the company for the controllers and zones of the rules bound to a sheet they signed, or platform_admin acting for it, through a signed-in session only; lab users are refused), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such alarm of this company within the caller's facilities: another company's, a missing one and one of a device outside an operator's facilities all answer alike.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "id": 812,
  "kind": "command_refused_site",
  "catalog_version": 1,
  "priority": "warning",
  "state": "active_acked",
  "raised_at": "2026-10-22T05:12:00Z",
  "last_active_at": "2026-10-22T07:31:00Z",
  "cleared_at": null,
  "closed_at": null,
  "occurrences": 1,
  "acked": {
    "at": "2026-10-22T07:40:00Z",
    "by": "Trần Thị Lan",
    "note": "Switch back to AUTO after the repair"
  },
  "shelved": null,
  "subject": {
    "type": "zone",
    "device": "ctl-03",
    "zone": 3,
    "area": "VN-LDG-VT03"
  },
  "detail": {
    "command_id": "6f1d2c3b-8a4e-4f0b-9c7d-1e2f3a4b5c6d",
    "reason": "manual_override_active"
  },
  "response_anchor": "command_refused_site",
  "under": null,
  "events": [
    {
      "at": "2026-10-22T05:12:00Z",
      "event": "raised",
      "actor": "system",
      "reason": null
    },
    {
      "at": "2026-10-22T07:40:00Z",
      "event": "acked",
      "actor": "Trần Thị Lan",
      "reason": null
    }
  ],
  "events_truncated": false
}
Phản hồi 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Phản hồi 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Phản hồi 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Phản hồi 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
Phản hồi 404 · application/json
{
  "error": "not found: alarm",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/alarms/{id}/ack

Acknowledge an alarm

Xác thực: cookie · acknowledgeAlarm

Chỉ dùng phiên đăng nhập — API token và ứng dụng OAuth không gọi được

#361 (ADR 0015 §2). A person records that they know of the alarm, with an optional note: an active alarm becomes active_acked, a cleared one closes. Idempotent: an alarm already acknowledged, or closed, answers 200 unchanged (no event). Audited (alarm.ack: the alarm's state before and after); the change and its alarm_events row commit together. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); an alarm is acknowledged and shelved by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

Tham số

TênVị tríKiểuMô tả
id
bắt buộc
pathstring

The alarm id.

Idempotency-Key
không bắt buộc
headerstring

Makes a retry of this request safe (#169). A client-chosen key, 1 to 255 visible ASCII characters (a UUID is a good choice), scoped to the caller's tenant and principal (session user, API token or legacy token). The first request with a key runs; when it answers 2xx, that response (status, body and headers) is stored and replayed for 24 hours to every request with the same key and the same method, path, query and body bytes, marked Idempotent-Replayed: true, without running the operation again or writing another audit row. The same key with another request is 422 idempotency_key_mismatch; while the first request still runs it is 409 idempotency_key_in_use with Retry-After. A request that fails before its operation commits releases the key, so it may be sent again (corrected) with the same key. An operation that committed is never run again under its key, even when its response could not be recorded (a 500 after the commit; a server stop or a database error between the commit and the record): the retry is 409 idempotency_key_in_use for up to 5 minutes, then 409 idempotency_key_used until the key expires. A malformed or repeated header is 400 invalid_idempotency_key.

Nội dung yêu cầu

AlarmAck (không bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "note": "Switch back to AUTO after the repair"
}

Phản hồi

Mã trạng tháiKiểuMô tả
200AlarmView
application/json

The alarm as it is now.

400Error
application/json

Invalid JSON, an unknown field, or a note over 500 characters. Or a bad X-Request-Id, or a malformed or repeated Idempotency-Key header.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, operator of the company within its facilities, or platform_admin acting for it, through a signed-in session only; auditors, agronomists and lab users are refused), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods), company read-only (SELF-2-4, #193: the company is leaving CropPath or has left).

404Error
application/json

No such alarm of this company within the caller's facilities: another company's, a missing one and one of a device outside an operator's facilities all answer alike.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

409Error
application/json

The Idempotency-Key's first request is still running, or its response cannot be replayed.

413Error
application/json

The request body is over 1 MiB.

422Error
application/json

The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id409string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id422string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "id": 812,
  "kind": "command_refused_site",
  "catalog_version": 1,
  "priority": "warning",
  "state": "active_acked",
  "raised_at": "2026-10-22T05:12:00Z",
  "last_active_at": "2026-10-22T07:31:00Z",
  "cleared_at": null,
  "closed_at": null,
  "occurrences": 1,
  "acked": {
    "at": "2026-10-22T07:40:00Z",
    "by": "Trần Thị Lan",
    "note": "Switch back to AUTO after the repair"
  },
  "shelved": null,
  "subject": {
    "type": "zone",
    "device": "ctl-03",
    "zone": 3,
    "area": "VN-LDG-VT03"
  },
  "detail": {
    "command_id": "6f1d2c3b-8a4e-4f0b-9c7d-1e2f3a4b5c6d",
    "reason": "manual_override_active"
  },
  "response_anchor": "command_refused_site",
  "under": null
}
Phản hồi 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
Phản hồi 400 · application/json · note
{
  "error": "bad note: at most 500 characters",
  "code": "bad_note"
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
Phản hồi 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Phản hồi 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Phản hồi 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Phản hồi 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
Phản hồi 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
Phản hồi 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
Phản hồi 403 · application/json · company_read_only
{
  "error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
  "code": "company_read_only"
}
Phản hồi 404 · application/json
{
  "error": "not found: alarm",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 409 · application/json
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
Phản hồi 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Phản hồi 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/alarms/{id}/shelve

Shelve an alarm until a time

Xác thực: cookie · shelveAlarm

Chỉ dùng phiên đăng nhập — API token và ứng dụng OAuth không gọi được

#361 (ADR 0015 §2). Hides an open alarm from the attention lists until until (at most 12 hours ahead for an urgent alarm, 72 hours for a warning or a notice), with a reason from the list and a note (required for other). It returns by itself at that time (event shelve_expired) or when unshelved; its condition is still evaluated meanwhile. Shelving a shelved alarm again replaces its end. Audited (alarm.shelve: the end and the reason). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); an alarm is acknowledged and shelved by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

Tham số

TênVị tríKiểuMô tả
id
bắt buộc
pathstring

The alarm id.

Idempotency-Key
không bắt buộc
headerstring

Makes a retry of this request safe (#169). A client-chosen key, 1 to 255 visible ASCII characters (a UUID is a good choice), scoped to the caller's tenant and principal (session user, API token or legacy token). The first request with a key runs; when it answers 2xx, that response (status, body and headers) is stored and replayed for 24 hours to every request with the same key and the same method, path, query and body bytes, marked Idempotent-Replayed: true, without running the operation again or writing another audit row. The same key with another request is 422 idempotency_key_mismatch; while the first request still runs it is 409 idempotency_key_in_use with Retry-After. A request that fails before its operation commits releases the key, so it may be sent again (corrected) with the same key. An operation that committed is never run again under its key, even when its response could not be recorded (a 500 after the commit; a server stop or a database error between the commit and the record): the retry is 409 idempotency_key_in_use for up to 5 minutes, then 409 idempotency_key_used until the key expires. A malformed or repeated header is 400 invalid_idempotency_key.

Nội dung yêu cầu

AlarmShelve (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "until": "2026-10-22T23:00:00Z",
  "reason": "technician_called"
}

Phản hồi

Mã trạng tháiKiểuMô tả
200AlarmView
application/json

The alarm as it is now.

400Error
application/json

Invalid JSON, an unknown field, an until that is not an RFC 3339 time in the future, an unknown reason, a missing or too long note, or an end past the priority's maximum. Or a bad X-Request-Id, or a malformed or repeated Idempotency-Key header.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, operator of the company within its facilities, or platform_admin acting for it, through a signed-in session only; auditors, agronomists and lab users are refused), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods), company read-only (SELF-2-4, #193: the company is leaving CropPath or has left).

404Error
application/json

No such alarm of this company within the caller's facilities: another company's, a missing one and one of a device outside an operator's facilities all answer alike.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

409Error
application/json

The alarm is closed. Or the Idempotency-Key's first request is still running, or its response cannot be replayed.

413Error
application/json

The request body is over 1 MiB.

422Error
application/json

The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id409string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id422string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "id": 812,
  "kind": "command_refused_site",
  "catalog_version": 1,
  "priority": "warning",
  "state": "shelved",
  "raised_at": "2026-10-22T05:12:00Z",
  "last_active_at": "2026-10-22T07:31:00Z",
  "cleared_at": null,
  "closed_at": null,
  "occurrences": 1,
  "acked": null,
  "shelved": {
    "until": "2026-10-22T23:00:00Z",
    "by": "Trần Thị Lan",
    "reason": "technician_called",
    "note": null
  },
  "subject": {
    "type": "zone",
    "device": "ctl-03",
    "zone": 3,
    "area": "VN-LDG-VT03"
  },
  "detail": {
    "command_id": "6f1d2c3b-8a4e-4f0b-9c7d-1e2f3a4b5c6d",
    "reason": "manual_override_active"
  },
  "response_anchor": "command_refused_site",
  "under": null
}
Phản hồi 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
Phản hồi 400 · application/json · until
{
  "error": "bad until: an RFC 3339 time in the future",
  "code": "bad_until"
}
Phản hồi 400 · application/json · reason
{
  "error": "bad reason: one of maintenance, technician_called, known_issue, equipment_off, other",
  "code": "bad_reason"
}
Phản hồi 400 · application/json · note
{
  "error": "bad note: 1 to 200 characters, required when the reason is other",
  "code": "bad_note"
}
Phản hồi 400 · application/json · too_long
{
  "error": "shelve too long: at most 12 h for an urgent alarm",
  "code": "shelve_too_long"
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
Phản hồi 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Phản hồi 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Phản hồi 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Phản hồi 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
Phản hồi 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
Phản hồi 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
Phản hồi 403 · application/json · company_read_only
{
  "error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
  "code": "company_read_only"
}
Phản hồi 404 · application/json
{
  "error": "not found: alarm",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 409 · application/json · alarm_closed
{
  "error": "alarm closed: a closed alarm cannot be shelved",
  "code": "alarm_closed"
}
Phản hồi 409 · application/json · idempotency_key_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
Phản hồi 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Phản hồi 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/alarms/{id}/unshelve

End an alarm's shelving

Xác thực: cookie · unshelveAlarm

Chỉ dùng phiên đăng nhập — API token và ứng dụng OAuth không gọi được

#361 (ADR 0015 §2). The alarm returns to the attention lists now. An alarm that is not shelved answers 200 unchanged (no event). Audited (alarm.unshelve). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); an alarm is acknowledged and shelved by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

Tham số

TênVị tríKiểuMô tả
id
bắt buộc
pathstring

The alarm id.

Idempotency-Key
không bắt buộc
headerstring

Makes a retry of this request safe (#169). A client-chosen key, 1 to 255 visible ASCII characters (a UUID is a good choice), scoped to the caller's tenant and principal (session user, API token or legacy token). The first request with a key runs; when it answers 2xx, that response (status, body and headers) is stored and replayed for 24 hours to every request with the same key and the same method, path, query and body bytes, marked Idempotent-Replayed: true, without running the operation again or writing another audit row. The same key with another request is 422 idempotency_key_mismatch; while the first request still runs it is 409 idempotency_key_in_use with Retry-After. A request that fails before its operation commits releases the key, so it may be sent again (corrected) with the same key. An operation that committed is never run again under its key, even when its response could not be recorded (a 500 after the commit; a server stop or a database error between the commit and the record): the retry is 409 idempotency_key_in_use for up to 5 minutes, then 409 idempotency_key_used until the key expires. A malformed or repeated header is 400 invalid_idempotency_key.

Phản hồi

Mã trạng tháiKiểuMô tả
200AlarmView
application/json

The alarm as it is now.

400Error
application/json

A bad X-Request-Id, or a malformed or repeated Idempotency-Key header.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, operator of the company within its facilities, or platform_admin acting for it, through a signed-in session only; auditors, agronomists and lab users are refused), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods), company read-only (SELF-2-4, #193: the company is leaving CropPath or has left).

404Error
application/json

No such alarm of this company within the caller's facilities: another company's, a missing one and one of a device outside an operator's facilities all answer alike.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

409Error
application/json

The Idempotency-Key's first request is still running, or its response cannot be replayed.

413Error
application/json

The request body is over 1 MiB.

422Error
application/json

The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id409string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id422string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "id": 812,
  "kind": "command_refused_site",
  "catalog_version": 1,
  "priority": "warning",
  "state": "active_unacked",
  "raised_at": "2026-10-22T05:12:00Z",
  "last_active_at": "2026-10-22T07:31:00Z",
  "cleared_at": null,
  "closed_at": null,
  "occurrences": 1,
  "acked": null,
  "shelved": null,
  "subject": {
    "type": "zone",
    "device": "ctl-03",
    "zone": 3,
    "area": "VN-LDG-VT03"
  },
  "detail": {
    "command_id": "6f1d2c3b-8a4e-4f0b-9c7d-1e2f3a4b5c6d",
    "reason": "manual_override_active"
  },
  "response_anchor": "command_refused_site",
  "under": null
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
Phản hồi 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Phản hồi 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Phản hồi 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Phản hồi 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
Phản hồi 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
Phản hồi 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
Phản hồi 403 · application/json · company_read_only
{
  "error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
  "code": "company_read_only"
}
Phản hồi 404 · application/json
{
  "error": "not found: alarm",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 409 · application/json
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
Phản hồi 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Phản hồi 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}