support
4 个操作
GET /v1/helpWhat the staff shell's Help shows: announcements and the status pageGET /v1/support-requestsList the company's support requestsPOST /v1/support-requestsSend CropPath a support requestGET /v1/support-requests/{id}Read one of the company's support requests
GET /v1/help
What the staff shell's Help shows: announcements and the status page
身份验证:cookie · getHelp
仅限登录会话——API 令牌和 OAuth 客户端不可调用
SELF-2-7 (#196). The platform announcements showing now (the staff shell's banner; never shown on a public page) and CropPath's status page address (AGRITRACE_STATUS_PAGE_URL; null when the deployment has none, and the console hides the link). Any signed-in user, whatever the roles.
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | Helpapplication/json | The announcements and the status page. |
| 400 | Errorapplication/json | The X-Request-Id header is present and malformed. |
| 401 | Errorapplication/json | No valid session cookie. |
| 403 | Errorapplication/json | The caller is refused: tenant not allowed (X-Tenant). Session routes are open to every role. |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"status_page_url": "https://status.croppath.example",
"announcements": [
{
"id": 3,
"text": "Planned maintenance on Sunday 22:00 to 23:00 (Vietnam time): the console may be slow.",
"level": "warning",
"starts_at": 1790000000.5,
"ends_at": 1790086400.5
}
]
}响应 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}响应 401 · application/json
{
"error": "not authenticated",
"code": "not_authenticated"
}响应 403 · application/json
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/support-requests
List the company's support requests
身份验证:cookie · listSupportRequests
仅限登录会话——API 令牌和 OAuth 客户端不可调用
SELF-2-7 (#196). The selected company's (X-Tenant) support requests, newest first, with their status and CropPath's reply: every request of the company for tenant_admin and platform_admin, only the caller's own for operators and auditors. Allowed for only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused (403).
参数
| 名称 | 位置 | 类型 | 说明 |
|---|---|---|---|
limit可选 | query | integer | 1 to 200 (default 50). |
cursor可选 | query | string | The previous page's |
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | SupportRequestPageapplication/json | One page of requests. |
| 400 | Errorapplication/json | A bad |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused); tenant not allowed (X-Tenant), two-factor required (this session must prove a second factor before acting for the company), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"items": [
{
"id": 12,
"tenant": "coop-dl",
"user": {
"id": 7,
"email": "op@coop.example",
"display_name": "Lan"
},
"subject": "Scale at line A1 shows no weight",
"body": "Since this morning the scale at line A1 shows 0 kg for every fruit.",
"record_id": "LOT-2026-001",
"status": "answered",
"reply": "Please restart the scale; it reconnects in a minute.",
"created_at": 1790000000.5,
"updated_at": 1790003600.5
}
],
"next_cursor": null
}响应 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}响应 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}响应 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/support-requests
Send CropPath a support request
身份验证:cookie · createSupportRequest
仅限登录会话——API 令牌和 OAuth 客户端不可调用
SELF-2-7 (#196). Sends CropPath a request from the caller in the selected company (X-Tenant): a subject, a text and optionally the id of the record it is about. It lands in the platform's queue with the company and the user; there is no email, so the answer comes back as the request's status and reply. Stored as plain text exactly as typed (trimmed), never as HTML or markdown. At most 5 requests per person per hour, 10 per person per day and 30 per company per day (429). Audited (support_request.create, in the same transaction; never the text). Allowed for only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused (403).
参数
| 名称 | 位置 | 类型 | 说明 |
|---|---|---|---|
Idempotency-Key可选 | header | string | 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 |
请求体
SupportRequestCreate (必填)
媒体类型: application/json
请求示例 · application/json
{
"subject": "Scale at line A1 shows no weight",
"body": "Since this morning the scale at line A1 shows 0 kg for every fruit.",
"record_id": "LOT-2026-001"
}响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 201 | SupportRequestapplication/json | The request, as the company sees it. |
| 400 | Errorapplication/json | Invalid JSON, an unknown field or a value outside the limits, or a bad X-Request-Id; or a malformed or repeated Idempotency-Key header. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused); tenant not allowed (X-Tenant), two-factor required (this session must prove a second factor before acting for the company), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only once the company has left CropPath; during its 30-day read-only window this stays open (owner decision A). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 409 | Errorapplication/json | The Idempotency-Key's first request is still running (retry after |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 422 | Errorapplication/json | The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body. |
| 429 | Errorapplication/json | Too many requests sent: at most 5 per person per hour, 10 per person per day and 30 per company per day. Nothing was stored; retry after |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 201 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 409 | string | Request id: the caller's |
Retry-After | 409 | string | Seconds to wait before retrying. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 422 | string | Request id: the caller's |
X-Request-Id | 429 | string | Request id: the caller's |
Retry-After | 429 | string | Seconds to wait before retrying. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 201 · application/json
{
"id": 12,
"tenant": "coop-dl",
"user": {
"id": 7,
"email": "op@coop.example",
"display_name": "Lan"
},
"subject": "Scale at line A1 shows no weight",
"body": "Since this morning the scale at line A1 shows 0 kg for every fruit.",
"record_id": "LOT-2026-001",
"status": "open",
"reply": null,
"created_at": 1790000000.5,
"updated_at": 1790000000.5
}响应 400 · application/json · subject
{
"error": "invalid subject: required, text of at most 200 characters",
"code": "invalid_subject"
}响应 400 · application/json · body
{
"error": "invalid body: required, text of at most 5000 characters",
"code": "invalid_body"
}响应 400 · application/json · record_id
{
"error": "invalid record_id: at most 100 letters, digits and . _ : / # -, such as LOT-2026-001",
"code": "invalid_record_id"
}响应 400 · application/json · unknown
{
"error": "unknown field: priority",
"code": "unknown_field"
}响应 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"
}响应 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 · idempotency_key_in_use
{
"error": "idempotency key in use: retry later",
"code": "idempotency_key_in_use"
}响应 409 · application/json · idempotency_key_used
{
"error": "idempotency key used: the response is too large to replay",
"code": "idempotency_key_used"
}响应 409 · application/json · idempotency_key_unrecorded
{
"error": "idempotency key used: the request ran but its response was not recorded",
"code": "idempotency_key_used"
}响应 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"
}响应 429 · application/json
{
"error": "too many support requests: at most 5 per person per hour",
"code": "too_many_support_requests"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/support-requests/{id}
Read one of the company's support requests
身份验证:cookie · getSupportRequest
仅限登录会话——API 令牌和 OAuth 客户端不可调用
SELF-2-7 (#196). One support request of the selected company (X-Tenant): any of the company's for tenant_admin and platform_admin, only the caller's own for operators and auditors. Another company's request, or another person's for an operator or auditor, answers 404 like a missing one. Allowed for only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused (403).
参数
| 名称 | 位置 | 类型 | 说明 |
|---|---|---|---|
id必填 | path | string | The request id. |
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | SupportRequestapplication/json | The request. |
| 400 | Errorapplication/json | The X-Request-Id header is present and malformed. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin, operator, auditor and platform_admin (acting for the company through X-Tenant), through a signed-in session: an API token, an API client or the legacy token is refused; lab users are refused); tenant not allowed (X-Tenant), two-factor required (this session must prove a second factor before acting for the company), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). |
| 404 | Errorapplication/json | No request with this id that the caller may read (another company's, or another person's). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"id": 12,
"tenant": "coop-dl",
"user": {
"id": 7,
"email": "op@coop.example",
"display_name": "Lan"
},
"subject": "Scale at line A1 shows no weight",
"body": "Since this morning the scale at line A1 shows 0 kg for every fruit.",
"record_id": "LOT-2026-001",
"status": "answered",
"reply": "Please restart the scale; it reconnects in a minute.",
"created_at": 1790000000.5,
"updated_at": 1790003600.5
}响应 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: 12",
"code": "not_found"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}