CropPath 开发者

API 参考

control

28 个操作

GET /v1/control/zones

List the company's irrigation zones

身份验证:cookie · listControlZones

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. The zones of the company's irrigation controllers, by controller and zone number (an operator: the controllers of its facilities). Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
可选
querystring

Only this controller's.

响应

状态码类型说明
200ControlZonePage
application/json

The zones.

400Error
application/json

A bad device. 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, auditor or operator of the company (an operator for its facilities' controllers), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "items": [
    {
      "id": 4,
      "device_id": "irr-ph7-01",
      "zone": 3,
      "growing_area": "VN-DL-SR-0123",
      "name": "Block A, row 1-8",
      "irrigated_area_m2": 2400,
      "nominal_flow_lpm": 120,
      "efficiency": 0.9,
      "max_daily_l": 30000,
      "probes": [
        {
          "device_id": "soil-ph7-03",
          "depth_cm": 30
        }
      ],
      "weather_station": null,
      "controller_utc_offset": "+07:00",
      "offset_ok": true,
      "field_capacity_pct": null,
      "wilting_point_pct": null,
      "created_by": "admin@coop.example",
      "created_at": 1790000000.5,
      "updated_by": "admin@coop.example",
      "updated_at": 1790000000.5
    }
  ]
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · device
{
  "error": "bad device: a device id",
  "code": "bad_device"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/zones

Create an irrigation zone

身份验证:cookie · createControlZone

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. A zone of an irrigation controller of the company (active, approved by CropPath, with a fixed placement in force) with its installation facts; the controller's rules are due again. Audited (control_zone.create). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
Idempotency-Key
可选
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.

请求体

ControlZoneCreate (必填)

媒体类型: application/json

请求示例 · application/json
{
  "device_id": "irr-ph7-01",
  "zone": 3,
  "name": "Block A, row 1-8",
  "irrigated_area_m2": 2400,
  "nominal_flow_lpm": 120,
  "efficiency": 0.9,
  "max_daily_l": 30000,
  "probes": [
    {
      "device_id": "soil-ph7-03",
      "depth_cm": 30
    }
  ],
  "controller_utc_offset": "+07:00"
}

响应

状态码类型说明
201ControlZone
application/json

The zone.

400Error
application/json

Invalid JSON, an unknown or missing field or a value out of its bounds, field capacity and wilting point not given together with the wilting point below it, or a probe whose profile does not produce soil.moisture (probe_not_moisture, #365). 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, or platform_admin acting for it, through a signed-in session only), 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).

405Error
application/json

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

409Error
application/json

Not an irrigation controller of the company, not approved, not placed, or the zone exists. 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.

响应头

名称状态码类型说明
X-Request-Id201string

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-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-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.

响应示例

响应 201 · application/json
{
  "id": 4,
  "device_id": "irr-ph7-01",
  "zone": 3,
  "growing_area": "VN-DL-SR-0123",
  "name": "Block A, row 1-8",
  "irrigated_area_m2": 2400,
  "nominal_flow_lpm": 120,
  "efficiency": 0.9,
  "max_daily_l": 30000,
  "probes": [
    {
      "device_id": "soil-ph7-03",
      "depth_cm": 30
    }
  ],
  "weather_station": null,
  "controller_utc_offset": "+07:00",
  "offset_ok": true,
  "field_capacity_pct": null,
  "wilting_point_pct": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · efficiency
{
  "error": "invalid efficiency: from 0.3 to 1",
  "code": "invalid_efficiency"
}
响应 400 · application/json · water_holding
{
  "error": "invalid water holding: field_capacity_pct and wilting_point_pct are given together, the wilting point below field capacity",
  "code": "invalid_water_holding"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 400 · application/json · probe_not_moisture
{
  "error": "probe not moisture: probes[0] is not a soil moisture probe",
  "code": "probe_not_moisture"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_placed
{
  "error": "controller not placed: the controller has no fixed placement in a growing area in force",
  "code": "controller_not_placed"
}
响应 409 · application/json · zone_exists
{
  "error": "zone exists: this controller already has this zone",
  "code": "zone_exists"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

PUT /v1/control/zones/{device}/{zone}

Edit an irrigation zone

身份验证:cookie · updateControlZone

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Each member given replaces it; the growing area is read again from the controller's placement and the controller's rules are due again. Audited (control_zone.update). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
必填
pathstring

The irrigation controller's device id.

zone
必填
pathstring

The zone number, 1 to 16.

Idempotency-Key
可选
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.

请求体

ControlZoneUpdate (必填)

媒体类型: application/json

请求示例 · application/json
{
  "name": "Block A, row 1-8",
  "max_daily_l": 30000
}

响应

状态码类型说明
200ControlZone
application/json

The zone.

400Error
application/json

Invalid JSON, an unknown field or a value out of its bounds, field capacity and wilting point not given together with the wilting point below it, or a probe whose profile does not produce soil.moisture (probe_not_moisture, #365). 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, or platform_admin acting for it, through a signed-in session only), 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 zone of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The controller is no longer approved or placed. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 4,
  "device_id": "irr-ph7-01",
  "zone": 3,
  "growing_area": "VN-DL-SR-0123",
  "name": "Block A, row 1-8",
  "irrigated_area_m2": 2400,
  "nominal_flow_lpm": 120,
  "efficiency": 0.9,
  "max_daily_l": 30000,
  "probes": [
    {
      "device_id": "soil-ph7-03",
      "depth_cm": 30
    }
  ],
  "weather_station": null,
  "controller_utc_offset": "+07:00",
  "offset_ok": true,
  "field_capacity_pct": null,
  "wilting_point_pct": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · probes
{
  "error": "invalid probes: a list of at most 16",
  "code": "invalid_probes"
}
响应 400 · application/json · water_holding
{
  "error": "invalid water holding: field_capacity_pct and wilting_point_pct are given together, the wilting point below field capacity",
  "code": "invalid_water_holding"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 400 · application/json · probe_not_moisture
{
  "error": "probe not moisture: probes[0] is not a soil moisture probe",
  "code": "probe_not_moisture"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: irr-ph7-01/3",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_approved
{
  "error": "controller not approved: the controller is not active and approved by CropPath",
  "code": "controller_not_approved"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

DELETE /v1/control/zones/{device}/{zone}

Delete an irrigation zone

身份验证:cookie · deleteControlZone

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. A zone no enabled rule waters. Audited (control_zone.delete). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
必填
pathstring

The irrigation controller's device id.

zone
必填
pathstring

The zone number, 1 to 16.

Idempotency-Key
可选
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.

响应

状态码类型说明
200ControlZone
application/json

The zone as it was.

400Error
application/json

A bad request. 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, or platform_admin acting for it, through a signed-in session only), 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 zone of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

An enabled rule waters the zone. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 4,
  "device_id": "irr-ph7-01",
  "zone": 3,
  "growing_area": "VN-DL-SR-0123",
  "name": "Block A, row 1-8",
  "irrigated_area_m2": 2400,
  "nominal_flow_lpm": 120,
  "efficiency": 0.9,
  "max_daily_l": 30000,
  "probes": [
    {
      "device_id": "soil-ph7-03",
      "depth_cm": 30
    }
  ],
  "weather_station": null,
  "controller_utc_offset": "+07:00",
  "offset_ok": true,
  "field_capacity_pct": null,
  "wilting_point_pct": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: irr-ph7-01/3",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · zone_in_use
{
  "error": "zone in use: an enabled rule waters this zone; disable it first",
  "code": "zone_in_use"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/rules

List the company's irrigation rules

身份验证:cookie · listControlRules

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Newest first, by controller and state (an operator: its facilities' controllers; an agronomist: the rules bound to a sheet they signed). Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
可选
querystring

Only this controller's.

state
可选
query"disabled" | "ok" | "blocked" | "fallback"

Only rules in this state.

before
可选
querystring

Only rows with a smaller id: the previous page's next_before.

limit
可选
queryinteger

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

响应

状态码类型说明
200ControlRulePage
application/json

A page of rules.

400Error
application/json

A bad device, state, before 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "items": [
    {
      "id": 12,
      "kind": "schedule",
      "name": "Block A schedule",
      "device_id": "irr-ph7-01",
      "zones": [
        3
      ],
      "sheet_id": 7,
      "windows": [
        {
          "start_local": "05:30",
          "max_duration_s": 7200
        }
      ],
      "fallback_rule_id": null,
      "approval": "required",
      "eval_interval_s": 900,
      "min_interval_s": 300,
      "peer_tolerance_pct": null,
      "min_probes": null,
      "enabled": true,
      "state": "ok",
      "state_reason": null,
      "state_at": 1790007300.5,
      "next_run_at": 1790035500,
      "last_run_at": 1790007300.5,
      "created_by": "admin@coop.example",
      "created_at": 1790000000.5,
      "updated_by": "admin@coop.example",
      "updated_at": 1790000000.5,
      "enabled_by": "admin@coop.example",
      "enabled_at": 1790007200.5,
      "auto_approval_by": null,
      "auto_approval_at": null,
      "hold_until": null,
      "sheet": {
        "id": 7,
        "series_key": "durian:Ri6:82",
        "version": 2,
        "status": "signed",
        "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
        "valid_from": "2027-01-01",
        "valid_to": "2027-06-30"
      },
      "sheet_gate": null,
      "resumed_command_id": null
    }
  ],
  "next_before": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · state
{
  "error": "invalid state: one of disabled, ok, blocked, fallback",
  "code": "invalid_state"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/rules

Create an irrigation rule

身份验证:cookie · createControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. A disabled rule: a schedule, threshold or et0_budget rule (#353; lighting is recorded but cannot be enabled yet) of one controller's zones, bound to a signed sheet of the company, with its windows. Approval is required. Audited (control_rule.create). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
Idempotency-Key
可选
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.

请求体

ControlRuleCreate (必填)

媒体类型: application/json

请求示例 · application/json
{
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ]
}

响应

状态码类型说明
201ControlRule
application/json

The rule.

400Error
application/json

Invalid JSON, an unknown or missing field, a bad window or zone list, a fallback that is not a schedule rule of the same controller and zones. 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, or platform_admin acting for it, through a signed-in session only), 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).

405Error
application/json

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

409Error
application/json

The sheet is not a signed sheet of the company. 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.

响应头

名称状态码类型说明
X-Request-Id201string

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-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-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.

响应示例

响应 201 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": false,
  "state": "disabled",
  "state_reason": null,
  "state_at": null,
  "next_run_at": null,
  "last_run_at": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": null,
  "enabled_at": null,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · windows
{
  "error": "invalid windows: two windows overlap",
  "code": "invalid_windows"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · sheet_not_signed
{
  "error": "sheet not signed: a rule binds a signed sheet of the company",
  "code": "sheet_not_signed"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/rules/{id}

Read an irrigation rule

身份验证:cookie · getControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. One rule with its bound sheet and its state. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

响应

状态码类型说明
200ControlRule
application/json

The rule.

400Error
application/json

A bad request. 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": true,
  "state": "ok",
  "state_reason": null,
  "state_at": 1790007300.5,
  "next_run_at": 1790035500,
  "last_run_at": 1790007300.5,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": "admin@coop.example",
  "enabled_at": 1790007200.5,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

PUT /v1/control/rules/{id}

Edit a disabled irrigation rule

身份验证:cookie · updateControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Each member given replaces it; an enabled rule, or the fallback of an enabled threshold rule, is never edited (409). Audited (control_rule.update). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

请求体

ControlRuleUpdate (必填)

媒体类型: application/json

请求示例 · application/json
{
  "sheet_id": 9
}

响应

状态码类型说明
200ControlRule
application/json

The rule.

400Error
application/json

Invalid JSON, an unknown field or a value out of its bounds. 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, or platform_admin acting for it, through a signed-in session only), 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 rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The rule is enabled, it is the fallback of an enabled rule, or the sheet is not signed. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": false,
  "state": "disabled",
  "state_reason": null,
  "state_at": null,
  "next_run_at": null,
  "last_run_at": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": null,
  "enabled_at": null,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · zones
{
  "error": "invalid zones: a zone given twice",
  "code": "invalid_zones"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · rule_enabled
{
  "error": "rule enabled: disable the rule before changing it",
  "code": "rule_enabled"
}
响应 409 · application/json · fallback_in_use
{
  "error": "fallback in use: an enabled threshold or et0_budget rule falls back to this rule",
  "code": "fallback_in_use"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/rules/{id}/enable

Enable an irrigation rule

身份验证:cookie · enableControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Checks the controller, the zones, the bound sheet (signed, valid today, its hash intact, its signer verified, its crop the zones' crop, complete for the kind), a threshold rule's fallback and gate parameters, an et0_budget rule's fallback, its gate parameters given together and a weather station on every zone (#353), and that no other enabled rule of the controller waters one of its zones; the rule is then due at once. Needs a recent second-factor proof. Audited (control_rule.enable). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

响应

状态码类型说明
200ControlRule
application/json

The rule.

400Error
application/json

A bad request. 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. Or a session of an account with two-step sign-in whose code was last confirmed more than 5 minutes ago, or its password more than 10 minutes ago (mfa_step_up_required, #87: confirm both with POST /v1/auth/reauth, then repeat the request; nothing was done and no audit row was written).

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, or platform_admin acting for it, through a signed-in session only), 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 rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The rule cannot be enabled now: the message says why (kind_not_available: a lighting rule). 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": true,
  "state": "ok",
  "state_reason": null,
  "state_at": 1790007300.5,
  "next_run_at": 1790035500,
  "last_run_at": 1790007300.5,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": "admin@coop.example",
  "enabled_at": 1790007200.5,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json · credentials
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 401 · application/json · step_up
{
  "error": "mfa step-up required: confirm your password and a code from your authenticator app with POST /v1/auth/reauth",
  "code": "mfa_step_up_required"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · sheet_not_usable
{
  "error": "sheet not usable: sheet_expired",
  "code": "sheet_not_usable"
}
响应 409 · application/json · zone_taken
{
  "error": "zone taken: another enabled rule of the controller waters one of these zones",
  "code": "zone_taken"
}
响应 409 · application/json · kind_not_available
{
  "error": "kind not available: this kind of rule cannot be enabled yet",
  "code": "kind_not_available"
}
响应 409 · application/json · station_missing
{
  "error": "station missing: every zone of an et0_budget rule needs a weather station",
  "code": "station_missing"
}
响应 409 · application/json · gate_parameters_incomplete
{
  "error": "gate parameters incomplete: an et0_budget rule takes peer_tolerance_pct and min_probes together",
  "code": "gate_parameters_incomplete"
}
响应 409 · application/json · already_enabled
{
  "error": "already enabled: the rule is enabled",
  "code": "already_enabled"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/rules/{id}/disable

Disable an irrigation rule

身份验证:cookie · disableControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. At once: the controller's other rules are due again, and a dispatched program still holding steps of the rule's zones to come is withdrawn (the #242 durable withdrawal). No step-up: disabling only stops water. Audited (control_rule.disable). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

响应

状态码类型说明
200ControlRule
application/json

The rule.

400Error
application/json

A bad request. 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, or platform_admin acting for it, through a signed-in session only), 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 rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The rule is not enabled. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": false,
  "state": "disabled",
  "state_reason": null,
  "state_at": null,
  "next_run_at": null,
  "last_run_at": null,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": null,
  "enabled_at": null,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_enabled
{
  "error": "not enabled: the rule is disabled",
  "code": "not_enabled"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/rules/{id}/approval

Set an irrigation rule's approval

身份验证:cookie · setControlRuleApproval

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. required (every program waits for a person) or auto, only once programs of the controller were approved by a person on at least 7 local days since the rule was created. Needs a recent second-factor proof. Audited (control_rule.auto_approval). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

请求体

ControlRuleApproval (必填)

媒体类型: application/json

请求示例 · application/json
{
  "approval": "auto"
}

响应

状态码类型说明
200ControlRule
application/json

The rule.

400Error
application/json

Invalid JSON or an approval other than required or auto. 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. Or a session of an account with two-step sign-in whose code was last confirmed more than 5 minutes ago, or its password more than 10 minutes ago (mfa_step_up_required, #87: confirm both with POST /v1/auth/reauth, then repeat the request; nothing was done and no audit row was written).

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, or platform_admin acting for it, through a signed-in session only), 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 rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

Not enough approved days yet. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "auto",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": true,
  "state": "ok",
  "state_reason": null,
  "state_at": 1790007300.5,
  "next_run_at": 1790035500,
  "last_run_at": 1790007300.5,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": "admin@coop.example",
  "enabled_at": 1790007200.5,
  "auto_approval_by": "admin@coop.example",
  "auto_approval_at": 1790700000.5,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · approval
{
  "error": "invalid approval: required or auto",
  "code": "invalid_approval"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json · credentials
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 401 · application/json · step_up
{
  "error": "mfa step-up required: confirm your password and a code from your authenticator app with POST /v1/auth/reauth",
  "code": "mfa_step_up_required"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · approval_history_short
{
  "error": "approval history short: programs of this controller need a person's approval on at least 7 days first",
  "code": "approval_history_short"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/rules/{id}/preview

Preview an irrigation rule

身份验证:cookie · previewControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. A dry run of the rule's controller as if the rule were enabled (in place of the enabled rules sharing a zone with it): every zone's decision, the health gate's decisions, the sheets cited and the set_program params a program issued now would carry. Writes and sends nothing. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

响应

状态码类型说明
200ControlPreview
application/json

The preview.

400Error
application/json

A bad request. 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 of the company, or platform_admin acting for it, through a signed-in session only), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": 1790007300.5,
  "rule_id": 12,
  "device_id": "irr-ph7-01",
  "provenance": {
    "local_date": "2027-03-02",
    "composed_at": 1790007300.5,
    "approval": "required",
    "error": null,
    "rules": [
      {
        "id": 12,
        "kind": "schedule",
        "state": "ok",
        "applied": "schedule",
        "zones": [
          3
        ]
      }
    ],
    "sheets": [
      {
        "id": 7,
        "series_key": "durian:Ri6:82",
        "version": 2,
        "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
        "attestation_id": 5,
        "signed_at": 1790000600.5,
        "valid_from": "2027-01-01",
        "valid_to": "2027-06-30"
      }
    ],
    "zones": [
      {
        "zone": 3,
        "rule_id": 12,
        "mode": "schedule",
        "litres": 216,
        "clamps": []
      }
    ],
    "plan": [
      {
        "zone": 3,
        "start_s": 19800,
        "duration_s": 1800,
        "max_volume_l": 270
      }
    ],
    "signature": "{...}",
    "replaces_program_id": null,
    "withdrew": false
  },
  "gate": [],
  "params": {
    "program": {
      "steps": [
        {
          "zone": 3,
          "start_s": 19800,
          "duration_s": 1800,
          "max_volume_l": 270
        }
      ]
    },
    "valid_until_s": 45899
  },
  "blocked_zones": []
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/programs

List the company's irrigation programs

身份验证:cookie · listControlPrograms

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Newest first, by controller, status and local dates (an operator: its facilities' controllers; an agronomist: the programs citing a sheet they signed). Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
可选
querystring

Only this controller's.

status
可选
query"proposed" | "approved" | "rejected" | "dispatched" | "superseded" | "failed" | "blocked" | "expired" | "withdrawn"

Only programs in this status.

from
可选
querystring

Only programs of this local date (Asia/Ho_Chi_Minh) or later.

to
可选
querystring

Only programs of this local date or earlier.

before
可选
querystring

Only rows with a smaller id: the previous page's next_before.

limit
可选
queryinteger

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

响应

状态码类型说明
200ControlProgramPage
application/json

A page of programs.

400Error
application/json

A bad device, status, from, to, before 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "items": [
    {
      "id": 31,
      "device_id": "irr-ph7-01",
      "local_date": "2027-03-02",
      "status": "proposed",
      "cause": "daily",
      "proposed_at": 1790007300.5,
      "expires_at": 1790053200,
      "decided_by": null,
      "decided_at": null,
      "dispatched_at": null,
      "command_id": null,
      "program_version": null,
      "error": null,
      "steps": 1,
      "litres": 216,
      "rules": [
        {
          "id": 12,
          "kind": "schedule",
          "state": "ok",
          "applied": "schedule"
        }
      ],
      "sheets": [
        {
          "id": 7,
          "version": 2,
          "series_key": "durian:Ri6:82",
          "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e"
        }
      ],
      "withdrew": false
    }
  ],
  "next_before": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · status
{
  "error": "invalid status: one of proposed, approved, rejected, dispatched, superseded, failed, blocked, expired",
  "code": "invalid_status"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/programs/{id}

Read an irrigation program

身份验证:cookie · getControlProgram

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. One program with its params, provenance (rules, sheets cited with version and SHA-256, zone decisions, the planned budget per zone and the ET0 days cited), gate decisions and the #242 command's state and replies. To an agronomist the command's issued_by and the replies' bodies are null. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

响应

状态码类型说明
200ControlProgram
application/json

The program.

400Error
application/json

A bad request. 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such program of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "id": 31,
  "device_id": "irr-ph7-01",
  "local_date": "2027-03-02",
  "status": "dispatched",
  "cause": "daily",
  "proposed_at": 1790007300.5,
  "expires_at": 1790053200,
  "decided_by": "op@coop.example",
  "decided_at": 1790010000.5,
  "dispatched_at": 1790010000.5,
  "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
  "program_version": 18,
  "error": null,
  "steps": 1,
  "litres": 216,
  "rules": [
    {
      "id": 12,
      "kind": "schedule",
      "state": "ok",
      "applied": "schedule"
    }
  ],
  "sheets": [
    {
      "id": 7,
      "version": 2,
      "series_key": "durian:Ri6:82",
      "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e"
    }
  ],
  "withdrew": false,
  "params": {
    "program": {
      "steps": [
        {
          "zone": 3,
          "start_s": 19800,
          "duration_s": 1800,
          "max_volume_l": 270
        }
      ]
    },
    "program_version": 18,
    "valid_until_s": 43199
  },
  "provenance": {
    "local_date": "2027-03-02",
    "composed_at": 1790007300.5,
    "approval": "required",
    "error": null,
    "rules": [
      {
        "id": 12,
        "kind": "schedule",
        "state": "ok",
        "applied": "schedule",
        "zones": [
          3
        ]
      }
    ],
    "sheets": [
      {
        "id": 7,
        "series_key": "durian:Ri6:82",
        "version": 2,
        "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
        "attestation_id": 5,
        "signed_at": 1790000600.5,
        "valid_from": "2027-01-01",
        "valid_to": "2027-06-30"
      }
    ],
    "zones": [
      {
        "zone": 3,
        "rule_id": 12,
        "mode": "schedule",
        "litres": 216,
        "clamps": []
      }
    ],
    "plan": [
      {
        "zone": 3,
        "start_s": 19800,
        "duration_s": 1800,
        "max_volume_l": 270
      }
    ],
    "signature": "{...}",
    "replaces_program_id": null,
    "withdrew": false
  },
  "decision_note": null,
  "withdrawal": null,
  "gate_decisions": [],
  "command": {
    "id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "status": "accepted",
    "reason": null,
    "issued_by": "op@coop.example",
    "issued_at": 1790010000.5,
    "accepted_at": 1790010002.5,
    "completed_at": null,
    "expires_at": 1790053199,
    "result": {
      "state": "accepted"
    },
    "replies": [
      {
        "received_at": 1790010002.5,
        "applied": true,
        "body": {
          "state": "accepted"
        }
      }
    ]
  }
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: 31",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/programs/{id}/approve

Approve and dispatch a proposed program

身份验证:cookie · approveControlProgram

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. Composes the controller again now (sheet gate, controller, health gate): when a decision changed since the proposal, the proposal is superseded by a new one and the approval answers 409 program_changed naming it; while a person's own set_program is in force on the controller and its rules were not resumed over it (the engine's manual override), the proposal is superseded and the approval answers 409 manual_override_active: an admin resumes the rules first; otherwise the program is approved by the caller and dispatched at once through the #242 command channel, with only its steps still to come (CropPath signs it and assigns its program version). Approving opens valves: it needs a recent second-factor proof, as enabling a rule does. Audited (control_program.approve). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

请求体

object (必填)

媒体类型: application/json

请求示例 · application/json
{}

响应

状态码类型说明
200ControlProgram
application/json

The program after its dispatch (dispatched, or failed with its error).

400Error
application/json

Invalid JSON or a body that is not empty. 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. Or a session of an account with two-step sign-in whose code was last confirmed more than 5 minutes ago, or its password more than 10 minutes ago (mfa_step_up_required, #87: confirm both with POST /v1/auth/reauth, then repeat the request; nothing was done and no audit row was written).

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, platform_admin acting for it, or an operator for the controllers of its facilities, through a signed-in session only), 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 program of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The program is not proposed, its day is over, its decisions changed, or a person's own program is in force on the controller. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 31,
  "device_id": "irr-ph7-01",
  "local_date": "2027-03-02",
  "status": "dispatched",
  "cause": "daily",
  "proposed_at": 1790007300.5,
  "expires_at": 1790053200,
  "decided_by": "op@coop.example",
  "decided_at": 1790010000.5,
  "dispatched_at": 1790010000.5,
  "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
  "program_version": 18,
  "error": null,
  "steps": 1,
  "litres": 216,
  "rules": [
    {
      "id": 12,
      "kind": "schedule",
      "state": "ok",
      "applied": "schedule"
    }
  ],
  "sheets": [
    {
      "id": 7,
      "version": 2,
      "series_key": "durian:Ri6:82",
      "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e"
    }
  ],
  "withdrew": false,
  "params": {
    "program": {
      "steps": [
        {
          "zone": 3,
          "start_s": 19800,
          "duration_s": 1800,
          "max_volume_l": 270
        }
      ]
    },
    "program_version": 18,
    "valid_until_s": 43199
  },
  "provenance": {
    "local_date": "2027-03-02",
    "composed_at": 1790007300.5,
    "approval": "required",
    "error": null,
    "rules": [
      {
        "id": 12,
        "kind": "schedule",
        "state": "ok",
        "applied": "schedule",
        "zones": [
          3
        ]
      }
    ],
    "sheets": [
      {
        "id": 7,
        "series_key": "durian:Ri6:82",
        "version": 2,
        "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
        "attestation_id": 5,
        "signed_at": 1790000600.5,
        "valid_from": "2027-01-01",
        "valid_to": "2027-06-30"
      }
    ],
    "zones": [
      {
        "zone": 3,
        "rule_id": 12,
        "mode": "schedule",
        "litres": 216,
        "clamps": []
      }
    ],
    "plan": [
      {
        "zone": 3,
        "start_s": 19800,
        "duration_s": 1800,
        "max_volume_l": 270
      }
    ],
    "signature": "{...}",
    "replaces_program_id": null,
    "withdrew": false
  },
  "decision_note": null,
  "withdrawal": null,
  "gate_decisions": [],
  "command": {
    "id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "status": "accepted",
    "reason": null,
    "issued_by": "op@coop.example",
    "issued_at": 1790010000.5,
    "accepted_at": 1790010002.5,
    "completed_at": null,
    "expires_at": 1790053199,
    "result": {
      "state": "accepted"
    },
    "replies": [
      {
        "received_at": 1790010002.5,
        "applied": true,
        "body": {
          "state": "accepted"
        }
      }
    ]
  }
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json · credentials
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 401 · application/json · step_up
{
  "error": "mfa step-up required: confirm your password and a code from your authenticator app with POST /v1/auth/reauth",
  "code": "mfa_step_up_required"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 31",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_proposed
{
  "error": "not proposed: only a proposed program is approved or rejected",
  "code": "not_proposed"
}
响应 409 · application/json · program_expired
{
  "error": "program expired: its day is over",
  "code": "program_expired"
}
响应 409 · application/json · program_changed
{
  "error": "program changed: decisions changed since it was proposed; see program 32",
  "code": "program_changed"
}
响应 409 · application/json · manual_override_active
{
  "error": "manual override active: a person's own program is in force on the controller; resume its rules before approving",
  "code": "manual_override_active"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/programs/{id}/reject

Reject a proposed program

身份验证:cookie · rejectControlProgram

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. With an optional reason; the engine proposes the same decisions again only once something changes. Audited (control_program.reject). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

请求体

ControlProgramReject (必填)

媒体类型: application/json

请求示例 · application/json
{
  "reason": "Rain expected this morning"
}

响应

状态码类型说明
200ControlProgram
application/json

The program.

400Error
application/json

Invalid JSON, an unknown field or a bad reason. 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, platform_admin acting for it, or an operator for the controllers of its facilities, through a signed-in session only), 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 program of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

The program is not proposed. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 31,
  "device_id": "irr-ph7-01",
  "local_date": "2027-03-02",
  "status": "rejected",
  "cause": "daily",
  "proposed_at": 1790007300.5,
  "expires_at": 1790053200,
  "decided_by": "op@coop.example",
  "decided_at": 1790010000.5,
  "dispatched_at": null,
  "command_id": null,
  "program_version": null,
  "error": null,
  "steps": 1,
  "litres": 216,
  "rules": [
    {
      "id": 12,
      "kind": "schedule",
      "state": "ok",
      "applied": "schedule"
    }
  ],
  "sheets": [
    {
      "id": 7,
      "version": 2,
      "series_key": "durian:Ri6:82",
      "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e"
    }
  ],
  "withdrew": false,
  "params": {
    "program": {
      "steps": [
        {
          "zone": 3,
          "start_s": 19800,
          "duration_s": 1800,
          "max_volume_l": 270
        }
      ]
    },
    "valid_until_s": 45899
  },
  "provenance": {
    "local_date": "2027-03-02",
    "composed_at": 1790007300.5,
    "approval": "required",
    "error": null,
    "rules": [
      {
        "id": 12,
        "kind": "schedule",
        "state": "ok",
        "applied": "schedule",
        "zones": [
          3
        ]
      }
    ],
    "sheets": [
      {
        "id": 7,
        "series_key": "durian:Ri6:82",
        "version": 2,
        "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
        "attestation_id": 5,
        "signed_at": 1790000600.5,
        "valid_from": "2027-01-01",
        "valid_to": "2027-06-30"
      }
    ],
    "zones": [
      {
        "zone": 3,
        "rule_id": 12,
        "mode": "schedule",
        "litres": 216,
        "clamps": []
      }
    ],
    "plan": [
      {
        "zone": 3,
        "start_s": 19800,
        "duration_s": 1800,
        "max_volume_l": 270
      }
    ],
    "signature": "{...}",
    "replaces_program_id": null,
    "withdrew": false
  },
  "decision_note": "Rain expected this morning",
  "withdrawal": null,
  "gate_decisions": [],
  "command": null
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · reason
{
  "error": "invalid reason: text of 1 to 500 characters, without control characters",
  "code": "invalid_reason"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 31",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_proposed
{
  "error": "not proposed: only a proposed program is approved or rejected",
  "code": "not_proposed"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/devices/{id}/program-withdrawal

Withdraw the program a controller holds today

身份验证:cookie · withdrawDeviceProgram

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#367 (ADR 0016). Withdraws the program the controller holds now through the durable withdrawal of the command channel (the empty retained program, re-sent until acknowledged), never a new command: the controller stops the program and its running step (its final reply aborted: cancelled); a run started by hand keeps running to its own limit. In the same transaction the control program becomes withdrawn (who, when and why), programs composed before the stop that never went out (proposed or approved) are superseded, and the engine holds the controller until the next farm-local midnight (hold_until): it proposes and sends nothing automatic before then, while a person may still approve a program by hand. The answer never waits for the broker or the controller; the controller's reports say the program stopped. A reason is required; no step-up (a withdrawal only stops equipment). Audited (device.program.withdraw, with the reason). Through a signed-in session only: an API token, an API client or the legacy token is refused (403). Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The controller's device id.

Idempotency-Key
可选
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.

请求体

ProgramWithdrawalRequest (必填)

媒体类型: application/json

请求示例 · application/json
{
  "reason": "Rain since dawn, the beds are wet",
  "control_program_id": 31
}

响应

状态码类型说明
202ProgramWithdrawal
application/json

The withdrawal is owed (and sent when the transport is up); the program is withdrawn and the engine holds the controller.

400Error
application/json

Invalid JSON, a missing or bad reason, a bad control_program_id or an unknown field. 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, platform_admin acting for it, or an operator for the controllers of its facilities, through a signed-in session only), 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 device of this company, or one outside the operator's facilities (both answer exactly like a missing one); or a control_program_id that is not one of the device's programs.

405Error
application/json

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

409Error
application/json

Nothing to stop, supersede or hold: the controller holds no program now, none is waiting to be sent, and it has no rule (or it cannot hold a program). 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.

响应头

名称状态码类型说明
X-Request-Id202string

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-Control202string

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.

响应示例

响应 202 · application/json
{
  "withdrawal": {
    "owed_at": "2027-03-02T07:35:00Z",
    "published": true
  },
  "control_program": {
    "id": 31,
    "status": "withdrawn",
    "program_version": 18
  },
  "hold_until": "2027-03-02T17:00:00Z"
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 400 · application/json · invalid_reason
{
  "error": "invalid reason: required, text of 1 to 500 characters",
  "code": "invalid_reason"
}
响应 400 · application/json · unknown_field
{
  "error": "unknown field: zone",
  "code": "unknown_field"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: irr-ph7-01",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · no_program
{
  "error": "no program: the controller holds no program, none is waiting to be sent and it has no rule",
  "code": "no_program"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/devices/{id}/program-hold/release

Release a controller's hold before its end

身份验证:cookie · releaseDeviceProgramHold

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#367 (ADR 0016). Ends the hold a withdrawal put on the controller before the next farm-local midnight and makes its enabled rules due, so the control engine composes the controller again on its next run: under required approval that compose is a proposal a person approves as usual; under automatic approval it may send water, hence the recent second-factor proof (step-up). Nothing is sent by this operation. Audited (device.program.hold_release). Through a signed-in session only: an API token, an API client or the legacy token is refused (403). Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The controller's device id.

Idempotency-Key
可选
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.

请求体

object (必填)

媒体类型: application/json

请求示例 · application/json
{}

响应

状态码类型说明
200ProgramHoldRelease
application/json

The hold is released and the controller's enabled rules are due.

400Error
application/json

Invalid JSON or a body that is not an empty object. 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. Or a session of an account with two-step sign-in whose code was last confirmed more than 5 minutes ago, or its password more than 10 minutes ago (mfa_step_up_required, #87: confirm both with POST /v1/auth/reauth, then repeat the request; nothing was done and no audit row was written).

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, platform_admin acting for it, or an operator for the controllers of its facilities, through a signed-in session only), 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 device of this company, or one outside the operator's facilities (both answer exactly like a missing one).

405Error
application/json

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

409Error
application/json

The controller has no hold in force. 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "released": {
    "hold_until": "2027-03-02T17:00:00Z",
    "released_at": "2027-03-02T09:10:00Z"
  },
  "rules_due": 1
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 400 · application/json · not_empty
{
  "error": "expected an empty JSON object",
  "code": "expected_an_empty_json_object"
}
响应 401 · application/json · credentials
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 401 · application/json · step_up
{
  "error": "mfa step-up required: confirm your password and a code from your authenticator app with POST /v1/auth/reauth",
  "code": "mfa_step_up_required"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: irr-ph7-01",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · not_held
{
  "error": "not held: the controller's engine is not held",
  "code": "not_held"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/zones/{device}/{zone}/history

A zone's water history in farm days

身份验证:cookie · getControlZoneHistory

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#365 (CP-5). For each farm day (Asia/Ho_Chi_Minh) from from to to: the litres of the zone in the day's dispatched program and those the controller reported delivered (and both over the zone's irrigated area, in mm), how the newest program of the day decided the zone, and the ET0 columns of #353 (null until it lands); the zone's runs (newest 500, truncated) and the moisture target bands of its signed sheets. Every value is null when its source is absent. An operator: its facilities' controllers; an agronomist: a zone some rule of which rests on a sheet they signed, a day's plan only when it cites one. Served from the server's cache for 60 s. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
必填
pathstring

The controller's device id.

zone
必填
pathstring

The zone number, 1 to 16.

from
可选
querystring

The first farm date. Default: 13 days before to. At most 92 dates in all.

to
可选
querystring

The last farm date. Default: today.

响应

状态码类型说明
200ControlZoneHistory
application/json

The zone's history.

400Error
application/json

A bad from or to, from after to, more than 92 dates, 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers and probes, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such zone of this company: another company's, one outside the caller's grant or an agronomist's sheets answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": "2027-03-02T03:15:00Z",
  "max_age_s": 60,
  "poll_hint_s": 60,
  "day": {
    "date": "2027-03-02",
    "starts_at": "2027-03-01T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "from": "2027-03-01",
  "to": "2027-03-02",
  "zone": {
    "device_id": "irr-ph7-01",
    "zone": 3,
    "name": "Block A",
    "area": "VN-TGOR-0387",
    "irrigated_area_m2": 120
  },
  "days": [
    {
      "date": "2027-03-01",
      "planned_l": 216,
      "applied_l": 216,
      "planned_mm": 1.8,
      "applied_mm": 1.8,
      "et0_mm": null,
      "et0_status": null,
      "kc_stage": null,
      "rain_mm": null,
      "rule": {
        "kind": "schedule",
        "applied_as": "schedule"
      },
      "program": {
        "id": 30,
        "status": "dispatched"
      }
    },
    {
      "date": "2027-03-02",
      "planned_l": null,
      "applied_l": null,
      "planned_mm": null,
      "applied_mm": null,
      "et0_mm": null,
      "et0_status": null,
      "kc_stage": null,
      "rain_mm": null,
      "rule": {
        "kind": "schedule",
        "applied_as": "blocked: no_signed_sheet"
      },
      "program": {
        "id": 31,
        "status": "blocked"
      }
    }
  ],
  "runs": [
    {
      "started_at": null,
      "ended_at": "2027-03-01T13:30:00Z",
      "litres": 216,
      "source": "program_step",
      "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f"
    }
  ],
  "moisture_series": {
    "capability": "soil.moisture",
    "depth_cm": 30,
    "grain": "hourly"
  },
  "moisture": {
    "capability": "soil.moisture",
    "grain": "hourly",
    "bucket_s": 3600,
    "probes": [
      "soil-07"
    ],
    "truncated": false,
    "series": [
      {
        "depth_cm": 30,
        "buckets": [
          {
            "bucket_start": 1803906000,
            "min": 30.7,
            "max": 31.1,
            "mean": 30.9,
            "count": 2,
            "n_total": 2,
            "n_pass": 2,
            "n_not_evaluated": 0,
            "n_suspect": 0,
            "n_fail": 0,
            "n_missing": 0
          },
          {
            "bucket_start": 1803909600,
            "min": null,
            "max": null,
            "mean": null,
            "count": 0,
            "n_total": 1,
            "n_pass": 0,
            "n_not_evaluated": 0,
            "n_suspect": 0,
            "n_fail": 1,
            "n_missing": 0
          }
        ]
      }
    ]
  },
  "bands": [],
  "truncated": false
}
响应 400 · application/json · bad_from
{
  "error": "bad from: a date YYYY-MM-DD",
  "code": "bad_from"
}
响应 400 · application/json · bad_to
{
  "error": "bad to: a date YYYY-MM-DD",
  "code": "bad_to"
}
响应 400 · application/json · bad_range
{
  "error": "bad range: from must not be after to",
  "code": "bad_range"
}
响应 400 · application/json · range_too_long
{
  "error": "range too long",
  "code": "range_too_long"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: irr-ph7-01/3",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/sensor-health

The sensor health of a growing area

身份验证:cookie · getControlSensorHealth

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#365 (CP-5). The area's probes (its field sensors placed now and every probe its zones name, at most 200): each one's link by the health gate's own freshness rule, its hourly coverage and QC counts over the last 30 days, and the enabled threshold rules that read it; and the gate decisions recorded today for the area's zones. An operator: its facilities' probes and controllers; an agronomist: the zones resting on a sheet they signed. Served from the server's cache for 300 s. Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
area
必填
querystring

The growing area's code.

响应

状态码类型说明
200ControlSensorHealth
application/json

The area's sensor health.

400Error
application/json

A missing or bad area, 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers and probes, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), tenant not allowed (X-Tenant), two-factor required (the company requires two-step sign-in).

404Error
application/json

No such growing area for this company, or none of it in the caller's scope (an operator's facilities, an agronomist's sheets): answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": "2027-03-02T03:15:00Z",
  "max_age_s": 300,
  "poll_hint_s": 300,
  "day": {
    "date": "2027-03-02",
    "starts_at": "2027-03-01T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "area": "VN-TGOR-0387",
  "probes": [
    {
      "device_id": "soil-07",
      "profile": "vn.agritrace.soil-rs485-4in1",
      "depth_cm": 30,
      "capability": "soil.moisture",
      "link": {
        "state": "stale",
        "last_obs": "2027-03-02T01:10:00Z",
        "expected_s": 900
      },
      "coverage_30d_pct": 96.1,
      "qc_30d": {
        "pass": 2710,
        "not_evaluated": 0,
        "suspect": 12,
        "fail": 3,
        "missing": 0
      },
      "used_by": [
        {
          "rule_id": 14,
          "device_id": "irr-ph7-01",
          "zones": [
            3
          ],
          "state": "fallback:stale",
          "since": "2027-03-02T02:00:00Z"
        }
      ]
    }
  ],
  "gate_decisions_today": [
    {
      "rule_id": 14,
      "device_id": "irr-ph7-01",
      "zone": 3,
      "decision": "fallback",
      "reason": "stale",
      "at": "2027-03-02T02:00:00Z"
    }
  ],
  "truncated": false
}
响应 400 · application/json · area_is_required
{
  "error": "area is required",
  "code": "area_is_required"
}
响应 400 · application/json · bad_area
{
  "error": "bad area: a growing area code",
  "code": "bad_area"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: VN-TGOR-0387",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/et0

List the weather stations' ET0 days

身份验证:cookie · listControlEt0Days

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#353. The stored reference evapotranspiration of the weather stations' local days (FAO-56 Penman-Monteith, meteorology only), by station and date, with every input, how it was found, whether it is estimated, and the equations' trace (an operator: the stations of its facilities' zones; an agronomist: those of the zones their sheets' rules water). Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
可选
querystring

Only this controller's.

from
可选
querystring

Local dates (Asia/Ho_Chi_Minh) from this one; by default 6 days before to; a year from 2000 to 2100.

to
可选
querystring

Local dates up to this one (not before from, at most 92 days after it); by default today; a year from 2000 to 2100.

响应

状态码类型说明
200ControlEt0Page
application/json

The the weather stations' ET0 days.

400Error
application/json

A bad device, from, to or span (to before from, or more than 92 days). 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "from": "2027-03-01",
  "to": "2027-03-07",
  "items": [
    {
      "device_id": "wx-ph7-01",
      "local_date": "2027-03-01",
      "seq": 1,
      "wind_height_m": 2,
      "elevation_m": 12,
      "status": "ok",
      "reason": null,
      "et0_mm": 4.8123,
      "inputs": {
        "latitude_deg": 10.82,
        "day_of_year": 60,
        "g": 0,
        "coverage": {
          "air.temperature": {
            "readings": 96,
            "coverage_h": 24,
            "truncated": false
          }
        },
        "rain": {
          "mm": 0,
          "method": "measured",
          "estimated": false
        },
        "tmax": 33.1,
        "tmin": 23.4,
        "ea": {
          "value": 2.31,
          "method": "rh_max_min",
          "rh_max": 92,
          "rh_min": 48,
          "estimated": false
        },
        "u2": {
          "value": 2,
          "method": "default_2_m_s",
          "estimated": true
        },
        "pressure": {
          "value": 101.16,
          "method": "elevation",
          "estimated": false
        },
        "rs": {
          "value": 20.4,
          "method": "measured",
          "estimated": false
        }
      },
      "trace": {
        "et0_mm": 4.8123,
        "tmean": 28.25,
        "pressure_kpa": 101.16,
        "gamma": 0.0673,
        "delta": 0.2236,
        "es": 3.4012,
        "ea": 2.31,
        "vpd": 1.0912,
        "ra": 35.2,
        "rs": 20.4,
        "rso": 26.41,
        "rns": 15.71,
        "rnl": 3.12,
        "rn": 12.59,
        "g": 0,
        "u2": 2,
        "hargreaves_mm": 5.21
      },
      "computed_at": 1790007300.5,
      "estimated": [
        "u2"
      ]
    }
  ],
  "truncated": false
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · from
{
  "error": "invalid from: a local date YYYY-MM-DD",
  "code": "invalid_from"
}
响应 400 · application/json · to
{
  "error": "invalid to: not before from",
  "code": "invalid_to"
}
响应 400 · application/json · span
{
  "error": "invalid span: at most 92 days from from to to",
  "code": "invalid_span"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/budget

List the zones' planned and applied water

身份验证:cookie · listControlBudget

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#353. Per zone of the company's controllers and local date, what the day's last program sent planned (the rule, its mode, the depth at the roots and the litres, the clamps, an ET0 zone's trace) and what the controller reported delivered (an operator: its facilities' controllers; an agronomist: the zones and days of programs citing a sheet they signed). Read-only and not audited. Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
device
可选
querystring

Only this controller's.

from
可选
querystring

Local dates (Asia/Ho_Chi_Minh) from this one; by default 6 days before to; a year from 2000 to 2100.

to
可选
querystring

Local dates up to this one (not before from, at most 92 days after it); by default today; a year from 2000 to 2100.

响应

状态码类型说明
200ControlBudgetPage
application/json

The the zones' planned and applied water.

400Error
application/json

A bad device, from, to or span (to before from, or more than 92 days). 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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "from": "2027-03-01",
  "to": "2027-03-07",
  "items": [
    {
      "device_id": "irr-ph7-01",
      "zone": 3,
      "name": "Block A, row 1-8",
      "growing_area": "VT-PH7-03",
      "local_date": "2027-03-02",
      "plan": "dispatched",
      "program_id": 31,
      "rule_id": 14,
      "mode": "et0_budget",
      "planned_mm": 3.85,
      "planned_l": 10266.667,
      "clamps": [],
      "et0": {
        "station": "wx-ph7-01",
        "date": "2027-03-01",
        "status": "ok",
        "et0_mm": 4.8123,
        "krs": null,
        "estimated": [
          "u2"
        ],
        "kc": 0.8,
        "kc_stage": "flowering",
        "rain_mm": 0,
        "effective_rain_fraction": 0.8
      },
      "applied_l": 9980,
      "applied_mm": 3.7425
    }
  ],
  "truncated": false
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · from
{
  "error": "invalid from: a local date YYYY-MM-DD",
  "code": "invalid_from"
}
响应 400 · application/json · to
{
  "error": "invalid to: not before from",
  "code": "invalid_to"
}
响应 400 · application/json · span
{
  "error": "invalid span: at most 92 days from from to to",
  "code": "invalid_span"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/home

Read the irrigation control home

身份验证:cookie · getControlHome

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#354. What needs a person today, for the company's controllers in scope (an operator: its facilities' controllers; an agronomist: what rests on a sheet they signed): how many controllers have a control zone; the programs waiting for a person's approval (their count and the newest 5); the rules by state, with not_ready the disabled rules whose sheet would not let them be enabled today (the sheet gate the engine runs on every compose), and at most 10 of them, blocked first, then on fallback, then not ready, each with the engine's reason or the sheet gate's; the open salinity alerts (salinity_block, salinity_alert: their count and the newest 5); and each weather station's latest stored reference ET0 day (at most 10: meteorology only, a needs_krs day has no ET0 of its own, and nothing is filled in that the stored day does not hold). 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); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

响应

状态码类型说明
200ControlHome
application/json

The irrigation control home.

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, auditor, operator or agronomist of the company (an operator for its facilities' controllers, an agronomist for what rests on a sheet they signed), or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": 1790000000.5,
  "controllers": 1,
  "programs_waiting": {
    "count": 1,
    "items": [
      {
        "id": 31,
        "device_id": "irr-ph7-01",
        "local_date": "2027-03-02",
        "proposed_at": 1790000000.5
      }
    ]
  },
  "rules": {
    "total": 3,
    "ok": 1,
    "blocked": 1,
    "fallback": 0,
    "not_ready": 1,
    "items": [
      {
        "id": 14,
        "name": "Block A ET0",
        "device_id": "irr-ph7-01",
        "kind": "et0_budget",
        "enabled": true,
        "state": "blocked",
        "reason": "salinity_block"
      },
      {
        "id": 15,
        "name": "Block B schedule",
        "device_id": "irr-ph7-01",
        "kind": "schedule",
        "enabled": false,
        "state": "disabled",
        "reason": "no_signed_sheet"
      }
    ]
  },
  "salinity": {
    "open": 1,
    "items": [
      {
        "id": 88,
        "kind": "salinity_block",
        "severity": "high",
        "device_id": "irr-ph7-01",
        "created_at": 1790000000.5
      }
    ]
  },
  "et0": {
    "items": [
      {
        "device_id": "wx-ph7-01",
        "local_date": "2027-03-01",
        "status": "ok",
        "reason": null,
        "et0_mm": 4.8123,
        "hargreaves_mm": 5.1022,
        "estimated": [
          "u2"
        ]
      },
      {
        "device_id": "wx-ph7-02",
        "local_date": "2027-03-01",
        "status": "needs_krs",
        "reason": "no_radiation",
        "et0_mm": null,
        "hargreaves_mm": 4.9871,
        "estimated": [
          "rs"
        ]
      }
    ]
  }
}
响应 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/advisory

Read the lime and fertiliser advisory

身份验证:cookie · getControlAdvisory

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#354. One item per signed sheet of the company whose validity covers today (the local date, Asia/Ho_Chi_Minh), by series and version: the sheet, who signed it and when, its advisory section exactly as signed (lime and fertiliser: the advice in Vietnamese, English and Simplified Chinese, an optional attachment's SHA-256, and that a lab test is required), its references, and the codes of the company's growing areas of its crop (at most 200; none for a caller who may not read the growing areas: an agronomist holding no other role gets growing_areas []); drafts counts the company's draft sheets, which are never listed. A signed sheet whose signature can no longer be checked (its stored document no longer hashes to its body_sha256 and to what its attestation signed, or its signer is no longer verified: the checks a rule's sheet gate makes) is not listed either: withheld counts such sheets, with no detail. No amount and no formula: the advice is words only (a sheet's advisory text carries no digit) and the amounts come from a lab test. A sheet is company-wide: an operator reads every one. 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); the advice an agronomist signed is read by a person. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

响应

状态码类型说明
200ControlAdvisory
application/json

The lime and fertiliser advisory.

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, auditor, agronomist or operator of the company, or platform_admin acting for it, through a signed-in session only), 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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": 1790000000.5,
  "today": "2027-03-02",
  "items": [
    {
      "sheet_id": 7,
      "series_key": "durian:Ri6:82",
      "crop": "durian",
      "version": 2,
      "valid_from": "2027-01-01",
      "valid_to": "2027-06-30",
      "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
      "signed_by": "Nguyễn Văn An",
      "signed_at": 1790000000.5,
      "advisory": {
        "lime": {
          "text": {
            "vi": "Bón vôi theo kết quả phân tích đất của phòng thí nghiệm.",
            "en": "Lime as the laboratory's soil analysis says.",
            "zh-Hans": "按实验室土壤分析结果施用石灰。"
          },
          "requires_lab_test": true
        },
        "fertiliser": {
          "text": {
            "vi": "Bón phân theo kết quả phân tích đất và lá.",
            "en": "Fertilise as the soil and leaf analysis says.",
            "zh-Hans": "按土壤和叶片分析结果施肥。"
          },
          "attachment_sha256": "9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b",
          "requires_lab_test": true
        }
      },
      "references": [
        {
          "title": "Provincial durian growing guide",
          "sha256": "1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c"
        }
      ],
      "growing_areas": [
        "VT-PH7-03",
        "VT-PH7-04"
      ]
    }
  ],
  "drafts": 1,
  "withheld": 0
}
响应 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/control/rules/{id}/resume

Resume a controller's rules over a person's own program

身份验证:cookie · resumeControlRule

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#352. While a person's own set_program (sent by the device command route) is in force on the rule's controller, the engine sends nothing for it: its rules are blocked with the reason manual_override. Resuming makes every enabled rule of the controller resume over that program: the next compose asserts the engine's program again, with a higher version. 409 no_override when no person's program is in force. Needs a recent second-factor proof. Audited (control_rule.resume). Through a signed-in session only: an API token, an API client or the legacy token is refused (403); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the staff console.

参数

名称位置类型说明
id
必填
pathstring

The record id.

Idempotency-Key
可选
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.

响应

状态码类型说明
200ControlRule
application/json

The rule, with the command it resumed over.

400Error
application/json

A bad request. 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. Or a session of an account with two-step sign-in whose code was last confirmed more than 5 minutes ago, or its password more than 10 minutes ago (mfa_step_up_required, #87: confirm both with POST /v1/auth/reauth, then repeat the request; nothing was done and no audit row was written).

403Error
application/json

The caller is known but refused: role not permitted (tenant_admin of the company, or platform_admin acting for it, through a signed-in session only), 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 rule of this company: another company's (or one outside the caller's grant) answers exactly like a missing one.

405Error
application/json

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

409Error
application/json

No person's program is in force on the controller, or the rule is not enabled. 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.

响应头

名称状态码类型说明
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.

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.

响应示例

响应 200 · application/json
{
  "id": 12,
  "kind": "schedule",
  "name": "Block A schedule",
  "device_id": "irr-ph7-01",
  "zones": [
    3
  ],
  "sheet_id": 7,
  "windows": [
    {
      "start_local": "05:30",
      "max_duration_s": 7200
    }
  ],
  "fallback_rule_id": null,
  "approval": "required",
  "eval_interval_s": 900,
  "min_interval_s": 300,
  "peer_tolerance_pct": null,
  "min_probes": null,
  "enabled": true,
  "state": "ok",
  "state_reason": null,
  "state_at": 1790007300.5,
  "next_run_at": 1790035500,
  "last_run_at": 1790007300.5,
  "created_by": "admin@coop.example",
  "created_at": 1790000000.5,
  "updated_by": "admin@coop.example",
  "updated_at": 1790000000.5,
  "enabled_by": "admin@coop.example",
  "enabled_at": 1790007200.5,
  "auto_approval_by": null,
  "auto_approval_at": null,
  "hold_until": null,
  "sheet": {
    "id": 7,
    "series_key": "durian:Ri6:82",
    "version": 2,
    "status": "signed",
    "body_sha256": "4f1c0a3e9b2d7c6e5a8f0b1d2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "valid_from": "2027-01-01",
    "valid_to": "2027-06-30"
  },
  "sheet_gate": null,
  "resumed_command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f"
}
响应 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 400 · application/json · invalid_idempotency_key
{
  "error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
  "code": "invalid_idempotency_key"
}
响应 401 · application/json · credentials
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 401 · application/json · step_up
{
  "error": "mfa step-up required: confirm your password and a code from your authenticator app with POST /v1/auth/reauth",
  "code": "mfa_step_up_required"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 403 · application/json · csrf
{
  "error": "csrf token missing or invalid",
  "code": "csrf_token_missing_or_invalid"
}
响应 403 · application/json · origin
{
  "error": "origin not allowed",
  "code": "origin_not_allowed"
}
响应 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"
}
响应 404 · application/json
{
  "error": "not found: 12",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · no_override
{
  "error": "no override: no person's own program is in force on this controller",
  "code": "no_override"
}
响应 409 · application/json · not_enabled
{
  "error": "not enabled: the rule is disabled",
  "code": "not_enabled"
}
响应 409 · application/json · idempotency_in_use
{
  "error": "idempotency key in use: retry later",
  "code": "idempotency_key_in_use"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "error": "idempotency key mismatch: the key was used with another request",
  "code": "idempotency_key_mismatch"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/fleet-state

The company's water today

身份验证:cookie · getControlFleetState

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#363 (CP-4 of #357). What needs attention, each growing area that holds an irrigation controller and each controller, from what the controllers and gateways reported. An operator reads the controllers and alarms of their facilities; an agronomist those of the rules bound to a sheet they signed. Served from a 10 s server cache (max_age_s); poll every poll_hint_s. At most 15 statements cold, 0 warm. 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); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

响应

状态码类型说明
200ControlFleetState
application/json

The company's water today.

400Error
application/json

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).

404Error
application/json

The selected company does not exist (a platform admin naming one with X-Tenant).

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "tenant": "coop-dl",
  "generated_at": "2026-10-22T07:32:05Z",
  "max_age_s": 10,
  "poll_hint_s": 15,
  "day": {
    "date": "2026-10-22",
    "starts_at": "2026-10-21T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "view": "admin",
  "attention": {
    "state": "ok",
    "alarms": {
      "urgent": 0,
      "warning": 1,
      "notice": 0,
      "shelved": 1
    },
    "items": [
      {
        "type": "alarm",
        "id": 812,
        "kind": "command_refused_site",
        "priority": "warning",
        "state": "active_unacked",
        "since": "2026-10-21T22:12:00Z",
        "subject": {
          "area": "VN-LDG-VT03",
          "device": "ctl-03",
          "zone": 3
        },
        "words_key": "manual_override_active",
        "can_ack": true
      },
      {
        "type": "task",
        "kind": "program_waiting_approval",
        "program_id": 31,
        "device": "ctl-03",
        "since": "2026-10-21T17:05:00Z"
      }
    ],
    "capped": false
  },
  "areas": {
    "state": "ok",
    "items": [
      {
        "code": "VN-LDG-VT03",
        "name": "Garden 3",
        "controllers": {
          "total": 1,
          "online": 1,
          "stale": 0,
          "offline": 0,
          "unknown": 0
        },
        "zones": {
          "total": 6,
          "running": 1,
          "scheduled_now": 0
        },
        "water_today": {
          "applied_l": 4120,
          "planned_l": null,
          "plan": "blocked",
          "reason": "no_signed_sheet"
        },
        "sensors": {
          "total": 4,
          "stale": 1
        },
        "alarms": {
          "urgent": 0,
          "warning": 1,
          "notice": 0
        }
      }
    ],
    "capped": false
  },
  "controllers": {
    "state": "ok",
    "running_or_outstanding": true,
    "items": [
      {
        "device_id": "ctl-03",
        "name": "Controller 3",
        "area": "VN-LDG-VT03",
        "link": {
          "state": "online",
          "via": "gateway",
          "gateway": "gw-v3",
          "heard_at": "2026-10-22T07:31:50Z",
          "expected_s": 30,
          "ready": true
        },
        "lease": {
          "program_version": 41,
          "valid_until": "2026-10-22T17:00:00Z"
        }
      }
    ],
    "capped": false
  }
}
响应 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: company",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/areas/{code}/today

An area's irrigation day

身份验证:cookie · getControlAreaToday

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#363 (CP-4 of #357). The day of the irrigation controllers placed in one growing area of the company: each controller's link, today's program, its zones (state from the reports only, today's water against the rules' plan, soil moisture against the signed sheet's band), its lease's steps and its newest commands. Served from a 10 s server cache. At most 12 statements cold, 0 warm. 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); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

参数

名称位置类型说明
code
必填
pathstring

The growing area code.

响应

状态码类型说明
200ControlAreaToday
application/json

An area's irrigation day.

400Error
application/json

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).

404Error
application/json

No such area of this company, or none of its controllers is in the caller's facilities or rules: each answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json
{
  "generated_at": "2026-10-22T07:32:05Z",
  "max_age_s": 10,
  "poll_hint_s": 15,
  "day": {
    "date": "2026-10-22",
    "starts_at": "2026-10-21T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "area": {
    "code": "VN-LDG-VT03",
    "name": "Garden 3"
  },
  "controllers": [
    {
      "device_id": "ctl-03",
      "name": "Controller 3",
      "link": {
        "state": "online",
        "via": "gateway",
        "gateway": "gw-v3",
        "heard_at": "2026-10-22T07:31:50Z",
        "expected_s": 30,
        "ready": true
      },
      "hold_until": null,
      "program": {
        "state": "installed",
        "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
        "program_version": 41,
        "control_program_id": 31,
        "valid_until": "2026-10-22T17:00:00Z",
        "withdrawable": true,
        "withdraw_effect": "stop_installed",
        "withdrawal": null,
        "lease_version": 41,
        "lease_command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
        "lease_control_program_id": 31
      },
      "zones": [
        {
          "zone": 3,
          "name": "Rows 1-4",
          "state": "running",
          "source": "run_zone_reply",
          "since": "2026-10-22T07:03:00Z",
          "expected_end": "2026-10-22T07:23:00Z",
          "reason": null,
          "today": {
            "applied_l": 840,
            "planned_l": null,
            "runs": 1
          },
          "moisture": {
            "state": "no_band",
            "value_pct": 28.4,
            "obs_time": "2026-10-22T07:26:00Z",
            "band": {
              "lower_pct": null,
              "upper_pct": null,
              "sheet": null
            }
          },
          "sheet": null
        }
      ],
      "steps": [
        {
          "zone": 3,
          "start_s": 21600,
          "duration_s": 1200,
          "max_volume_l": 2625,
          "planned_l": null,
          "actual": {
            "state": "done",
            "litres": 1980,
            "ended_at": "2026-10-21T23:20:40Z"
          }
        }
      ],
      "commands": [
        {
          "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
          "name": "run_zone",
          "status": "accepted",
          "issued_by": "Lan",
          "issued_at": "2026-10-22T07:02:10Z",
          "params": {
            "zone": 3,
            "duration_s": 1200,
            "max_volume_l": 2000
          },
          "expires_at": "2026-10-22T07:07:10Z",
          "reason": null,
          "measured": null
        }
      ]
    }
  ],
  "truncated": false
}
响应 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: area",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/control/controllers/{id}/today

A controller's irrigation day

身份验证:cookie · getControlControllerToday

仅限登录会话——API 令牌和 OAuth 客户端不可调用

#363 (CP-4 of #357). One irrigation controller's day in the shape of a controller of the area's day, with its profile's run_zone limits and its zones' nominal flow and daily cap (#352 control_zones: installation facts, not agronomy). Served from a 10 s server cache. At most 11 statements cold, 0 warm. 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); irrigation control is a person's decision about water. Not part of the partner SDK clients (x-not-in-sdk): an operation of the irrigation cockpit.

参数

名称位置类型说明
id
必填
pathstring

The controller's device id.

响应

状态码类型说明
200ControlControllerDay
application/json

A controller's irrigation day.

400Error
application/json

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).

404Error
application/json

Not an irrigation controller of this company, or outside the caller's facilities or rules: each answers exactly like a missing one.

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.

响应头

名称状态码类型说明
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.

响应示例

响应 200 · application/json · installed A program installed, a zone running by hand
{
  "generated_at": "2026-10-22T07:32:05Z",
  "max_age_s": 10,
  "poll_hint_s": 15,
  "day": {
    "date": "2026-10-22",
    "starts_at": "2026-10-21T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "device_id": "ctl-03",
  "name": "Controller 3",
  "link": {
    "state": "online",
    "via": "gateway",
    "gateway": "gw-v3",
    "heard_at": "2026-10-22T07:31:50Z",
    "expected_s": 30,
    "ready": true
  },
  "hold_until": null,
  "program": {
    "state": "installed",
    "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "program_version": 41,
    "control_program_id": 31,
    "valid_until": "2026-10-22T17:00:00Z",
    "withdrawable": true,
    "withdraw_effect": "stop_installed",
    "withdrawal": null,
    "lease_version": 41,
    "lease_command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "lease_control_program_id": 31
  },
  "zones": [
    {
      "zone": 3,
      "name": "Rows 1-4",
      "state": "running",
      "source": "run_zone_reply",
      "since": "2026-10-22T07:03:00Z",
      "expected_end": "2026-10-22T07:23:00Z",
      "reason": null,
      "today": {
        "applied_l": 840,
        "planned_l": null,
        "runs": 1
      },
      "moisture": {
        "state": "no_band",
        "value_pct": 28.4,
        "obs_time": "2026-10-22T07:26:00Z",
        "band": {
          "lower_pct": null,
          "upper_pct": null,
          "sheet": null
        }
      },
      "sheet": null,
      "nominal_flow_lpm": 100,
      "max_daily_l": 5000
    }
  ],
  "steps": [
    {
      "zone": 3,
      "start_s": 21600,
      "duration_s": 1200,
      "max_volume_l": 2625,
      "planned_l": null,
      "actual": {
        "state": "done",
        "litres": 1980,
        "ended_at": "2026-10-21T23:20:40Z"
      }
    }
  ],
  "commands": [
    {
      "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
      "name": "run_zone",
      "status": "accepted",
      "issued_by": "Lan",
      "issued_at": "2026-10-22T07:02:10Z",
      "params": {
        "zone": 3,
        "duration_s": 1200,
        "max_volume_l": 2000
      },
      "expires_at": "2026-10-22T07:07:10Z",
      "reason": null,
      "measured": null
    }
  ],
  "area": {
    "code": "VN-LDG-VT03"
  },
  "limits": {
    "duration_s_min": 1,
    "duration_s_max": 3600,
    "max_volume_l_min": 1,
    "max_volume_l_max": 20000,
    "max_expiry_s": 300
  },
  "truncated": false
}
响应 200 · application/json · withdrawn Today's program withdrawn (the 16:00 step withdrawn, the controller held until midnight), the zone's rule bound to a signed sheet
{
  "generated_at": "2026-10-22T07:32:05Z",
  "max_age_s": 10,
  "poll_hint_s": 15,
  "day": {
    "date": "2026-10-22",
    "starts_at": "2026-10-21T17:00:00Z",
    "time_zone": "Asia/Ho_Chi_Minh"
  },
  "device_id": "ctl-03",
  "name": "Controller 3",
  "link": {
    "state": "online",
    "via": "gateway",
    "gateway": "gw-v3",
    "heard_at": "2026-10-22T07:31:50Z",
    "expected_s": 30,
    "ready": true
  },
  "hold_until": "2026-10-22T17:00:00Z",
  "program": {
    "state": "ended",
    "command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "program_version": 41,
    "control_program_id": 31,
    "valid_until": "2026-10-22T17:00:00Z",
    "withdrawable": true,
    "withdraw_effect": "already_held",
    "withdrawal": {
      "requested_at": "2026-10-22T07:00:00Z",
      "published": true,
      "reason": "Rain since noon"
    },
    "lease_version": 41,
    "lease_command_id": "5b0f3c2e-8a51-4c1e-9d0a-3f7b2c1d4e5f",
    "lease_control_program_id": 31
  },
  "zones": [
    {
      "zone": 3,
      "name": "Rows 1-4",
      "state": "running",
      "source": "run_zone_reply",
      "since": "2026-10-22T07:03:00Z",
      "expected_end": "2026-10-22T07:23:00Z",
      "reason": null,
      "today": {
        "applied_l": 840,
        "planned_l": null,
        "runs": 1
      },
      "moisture": {
        "state": "no_band",
        "value_pct": 28.4,
        "obs_time": "2026-10-22T07:26:00Z",
        "band": {
          "lower_pct": null,
          "upper_pct": null,
          "sheet": null
        }
      },
      "sheet": {
        "id": 7,
        "status": "signed",
        "version": 3,
        "stage": "flowering",
        "stage_name": {
          "vi": "Ra hoa",
          "en": "Flowering",
          "zh-Hans": "开花期"
        }
      },
      "nominal_flow_lpm": 100,
      "max_daily_l": 5000
    }
  ],
  "steps": [
    {
      "zone": 3,
      "start_s": 21600,
      "duration_s": 1200,
      "max_volume_l": 2625,
      "planned_l": null,
      "actual": {
        "state": "done",
        "litres": 1980,
        "ended_at": "2026-10-21T23:20:40Z"
      }
    },
    {
      "zone": 3,
      "start_s": 57600,
      "duration_s": 1200,
      "max_volume_l": 2625,
      "planned_l": null,
      "actual": {
        "state": "withdrawn",
        "litres": null,
        "ended_at": null
      }
    }
  ],
  "commands": [
    {
      "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
      "name": "run_zone",
      "status": "accepted",
      "issued_by": "Lan",
      "issued_at": "2026-10-22T07:02:10Z",
      "params": {
        "zone": 3,
        "duration_s": 1200,
        "max_volume_l": 2000
      },
      "expires_at": "2026-10-22T07:07:10Z",
      "reason": null,
      "measured": null
    }
  ],
  "area": {
    "code": "VN-LDG-VT03"
  },
  "limits": {
    "duration_s_min": 1,
    "duration_s_max": 3600,
    "max_volume_l_min": 1,
    "max_volume_l_max": 20000,
    "max_expiry_s": 300
  },
  "truncated": false
}
响应 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
响应 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
响应 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
响应 403 · application/json · two_factor
{
  "error": "two-factor required: set up two-step sign-in for this account",
  "code": "two_factor_required"
}
响应 404 · application/json
{
  "error": "not found: device",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}