CropPath 开发者

API 参考

ingest

4 个操作

POST /v1/ingest/{route}

Receive a signed envelope from a device or gateway

身份验证:deviceMtls · ingestEnvelope

The path parameter route spans {tenant}/{site}/{device}/{kind}[/{eventType}] and includes slashes (the server pattern is /v1/ingest/{route*}). The body is a signed envelope (envelope version 1, spec agritrace.iot/1.0), which the server validates against its full schema, served at /developers/downloads/envelope-v1.schema.json (event types at /developers/downloads/event-types-v1.json, capabilities at /developers/downloads/capabilities-v1.json, device profiles below /developers/downloads/profiles/); that schema is not inlined here, so the request schema is open (additionalProperties: true). Over mTLS the certificate CN must match the device or its gateway. Statuses: 202 accepted or quarantined, 409 duplicate, 503 for a rejection that may resolve itself (unknown_device, unknown_key), other rejections 4xx. Every outcome that comes from the ingest service carries an IngestResult body; 400 and 413 can also come from the HTTP layer with an Error body. A pack event (#136: profile vn.agritrace.pack-station, one pack.carton reading per carton, the seal number in context.seal) is compared with the lot's packing records: the lot, its facility and the sending device's, the seal number (the lot's pack seal once it is packed), and every carton's fruits and net mass. Any difference is quarantined with the reason pack_mismatch: <differences> and a high pack_mismatch alert, and holds the lot until it is reviewed. A status envelope whose device id is a registered gateway's is that gateway's status heartbeat (#24, profile vn.agritrace.gateway): signed with one of the gateway's own keys, over mTLS from that gateway, with the readings of that profile only, else it is rejected (profile_mismatch, invalid_content, key_not_authorized). It is not stored as an envelope: the server keeps the gateway's newest heartbeat (GET /v1/gateways/{id}/heartbeat), and answers 202 accepted, or 409 duplicate for the heartbeat it keeps and, with the reason superseded, for an older one. Ordering: by seq, except for signed heartbeats, which also carry the gateway's own clock: a signed heartbeat with a lower seq but a later time than the kept one is kept (a gateway that was reset counts its seq from 0 again), and a signed heartbeat with a higher seq but an earlier time is answered superseded; an unsigned one is ordered by seq alone. A heartbeat dated more than the server's maximum future skew past its clock is rejected with 400 future_timestamp (a device envelope gets a 202 quarantine instead), so it never freezes the kept one. The other rejection reasons are those of a device envelope. #134: a message over its company's ingest quota (the company of the certificate's device or gateway, whatever the route names) answers 429 too_many_requests with Retry-After and an Error body before the body is read; the device sends it again later. A request without a client certificate (plain HTTP, or TLS without one), or with a certificate of no registered device or gateway (which the ingest then rejects), never takes a company's quota: it takes its client address's own bucket, of the default ingest quota, and answers the same 429 over it.

参数

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

{tenant}/{site}/{device}/{kind}[/{eventType}], slashes included.

请求体

Envelope (必填)

媒体类型: application/json

请求示例 · application/json
{
  "spec": "agritrace.iot/1.0",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "kind": "event",
  "eventType": "inspect",
  "device": {
    "id": "knk-1",
    "profile": "vn.agritrace.durian-knocker@1.0.0",
    "gateway": "gw-01"
  },
  "time": "2026-09-30T08:00:00.000+07:00",
  "seq": 0,
  "context": {
    "lot": "LOT-A",
    "facility": "66-DL-SR-0001-CHN"
  },
  "readings": [
    {
      "capability": "produce.maturity_index",
      "value": 82,
      "unit": "%"
    }
  ]
}

响应

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

Stored. status is accepted or quarantined (held for review, see reasons).

400IngestResult | Error
application/json

Rejected as malformed (malformed, unsupported_spec, bad_route, route_mismatch, bad_time; IngestResult), or a bad X-Request-Id (Error).

401IngestResult
application/json

Rejected: missing_signature or bad_signature.

403IngestResult
application/json

Rejected: key_not_authorized, peer_mismatch, tenant_mismatch, device_inactive or company_read_only (SELF-2-4, #193: the device's company is leaving CropPath or has left).

405Error
application/json

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

409IngestResult
application/json

Duplicate of a stored envelope (same id and content). Permanent for the sender; nothing was changed.

413IngestResult | Error
application/json

Rejected as payload_too_large (IngestResult), or the request body is over 1 MiB (Error).

422IngestResult
application/json

Rejected: id_conflict (same id, different content). An alert is raised.

500Error
application/json

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

503IngestResult
application/json

Rejected with unknown_device or unknown_key: the registry may catch up, so the sender retries.

响应头

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

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.

X-Request-Id503string

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

Retry-After503string

Seconds to wait before retrying.

响应示例

响应 202 · application/json · accepted
{
  "status": "accepted",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": []
}
响应 202 · application/json · quarantined
{
  "status": "quarantined",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": [
    "volume_exceeds_cap"
  ]
}
响应 400 · application/json · rejected
{
  "status": "rejected",
  "id": null,
  "reasons": [
    "malformed"
  ]
}
响应 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
响应 401 · application/json
{
  "status": "rejected",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": [
    "bad_signature"
  ]
}
响应 403 · application/json
{
  "status": "rejected",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": [
    "tenant_mismatch"
  ]
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json
{
  "status": "duplicate",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": []
}
响应 413 · application/json · rejected
{
  "status": "rejected",
  "id": null,
  "reasons": [
    "payload_too_large"
  ]
}
响应 413 · application/json · body_too_large
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 422 · application/json
{
  "status": "rejected",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": [
    "id_conflict"
  ]
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}
响应 503 · application/json
{
  "status": "rejected",
  "id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
  "reasons": [
    "unknown_device"
  ]
}

POST /v1/gateways/{id}/station-delegations/claim

An edge station claims an operator's sign-in

身份验证:deviceMtls · claimStationSignIn

#85 (owner decision 2026-10-17, option b): operators keep working at an edge station with the WAN down. The station claims the sign-in whose one-time code the operator typed on its screen (any case; spaces and hyphens ignored): once, while the code is valid, only at the gateway it was issued for, and only while the operator's account is active and the operator may still record fruit actions at the station's facility (else 403 operator_not_allowed; disabling the account or turning the membership off revokes the sign-in: 404). The answer is the sign-in (the operator's opaque id and display name, its end), the label data of the fruits of the open lots at the station's facility (newest first, at most 2000), which its printer queue prints from with the WAN down, the highest seq the cloud recorded from the station (last_seq, which its action counter moves above) and the cloud's time (the station counts the sign-in's end from it on its monotonic clock). One audit row (station.delegation.claim, actor the operator) in the company's activity log. The body is signed with one of the gateway's own active keys (ES256 over the canonical JSON of every member but sig, as an envelope). Over mTLS the client certificate must be the gateway's. No principal: the signature is the authentication. #326: with label_code=1 each label also has the fruit's lookup code (label_code, #288), the 15-character code the station's fruit label prints for a person whose QR code cannot be scanned; the scan page and GET /v1/public/resolve read it. Added after the partner SDK 0.2.0 (x-not-in-sdk): not part of the generated SDK clients.

参数

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

Gateway id (the edge station's).

label_code
可选
query"0" | "1"

#326: 1 adds each label's lookup code (labels[].label_code), which the station's fruit label prints; 0 or none leaves it out and answers exactly as before; any other value is refused (400 bad label_code).

请求体

StationClaimRequest (必填)

媒体类型: application/json

请求示例 · application/json
{
  "gateway": "gw-01",
  "time": "2026-09-28T08:40:00+07:00",
  "code": "K7MQ2XPA",
  "sig": {
    "alg": "ES256",
    "kid": "gw-01",
    "value": "q6bJ0tM1g2pUo7k9wqzQyLhB4mF3aVxN8cR5sTdE1uYiHjKlZ0oP9nW2eQ3rT4yU6iO7pA8sD9fG0hJ1kL2zXc"
  }
}

响应

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

Claimed.

400Error
application/json

A malformed request, or label_code not 0 or 1.

403Error
application/json

Refused: the signature is not from an active key of this gateway, a bad signature, an inactive gateway, a client certificate of another identity, a request more than 300 s off the server's time, or a company that is leaving CropPath. Or the operator may no longer record fruit actions at the station's facility (operator_not_allowed).

404Error
application/json

No such gateway, or no sign-in with this code waiting at this station (unknown, used, expired or revoked).

405Error
application/json

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

413Error
application/json

The request body is over 1 MiB.

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-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-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-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
{
  "delegation": {
    "id": "3f9c2b1e8a7d4c6b9e0f1a2b3c4d5e6f",
    "operator": "user-7",
    "name": "Lan",
    "issued_at": 1790560000,
    "claimed_at": 1790560100,
    "expires_at": 1790588800
  },
  "labels": [
    {
      "code": "Q-014-0129",
      "lot": "LO-260928-014",
      "n": 129,
      "round": 0,
      "status": "recorded",
      "qr_url": "https://txng.theio.vn/01/00012345678905/10/LO-260928-014/21/k3Vd9_Qe2LmXa0Zr-Tb7"
    }
  ],
  "last_seq": 41,
  "time": 1790560100
}
响应 400 · application/json · malformed
{
  "error": "malformed: the request's fields",
  "code": "malformed"
}
响应 400 · application/json · code
{
  "error": "bad code: the sign-in code shown in the console",
  "code": "bad_code"
}
响应 400 · application/json · bad_label_code
{
  "error": "bad label_code",
  "code": "bad_label_code"
}
响应 403 · application/json · key
{
  "error": "key not authorized: not an active key of this gateway",
  "code": "key_not_authorized"
}
响应 403 · application/json · signature
{
  "error": "bad signature",
  "code": "bad_signature"
}
响应 403 · application/json · stale
{
  "error": "stale request: the station's time is more than 300 s off",
  "code": "stale_request"
}
响应 403 · application/json · operator
{
  "error": "operator not allowed: the operator may no longer act for the company",
  "code": "operator_not_allowed"
}
响应 404 · application/json
{
  "error": "unknown code: no sign-in with this code is waiting at this station",
  "code": "unknown_code"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/gateways/{id}/station-sync

An edge station asks the state of its sign-ins and its label data

身份验证:deviceMtls · syncStation

#85 (owner decision 2026-10-17, option b): operators keep working at an edge station with the WAN down. Once it reaches the cloud, the station asks the state of the sign-ins it holds (active, revoked, expired, or unknown for one that is not this station's or never claimed; revoked too for one whose operator's account is disabled or who may no longer record fruit actions at the station's facility) and refreshes its label data and last_seq; it ends the local session of a sign-in that is no longer active. A read: no audit row. The body is signed with one of the gateway's own active keys (ES256 over the canonical JSON of every member but sig, as an envelope). Over mTLS the client certificate must be the gateway's. No principal: the signature is the authentication. #326: with label_code=1 each label also has the fruit's lookup code (label_code, #288), the 15-character code the station's fruit label prints for a person whose QR code cannot be scanned; the scan page and GET /v1/public/resolve read it. Added after the partner SDK 0.2.0 (x-not-in-sdk): not part of the generated SDK clients.

参数

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

Gateway id (the edge station's).

label_code
可选
query"0" | "1"

#326: 1 adds each label's lookup code (labels[].label_code), which the station's fruit label prints; 0 or none leaves it out and answers exactly as before; any other value is refused (400 bad label_code).

请求体

StationSyncRequest (必填)

媒体类型: application/json

请求示例 · application/json
{
  "gateway": "gw-01",
  "time": "2026-09-28T10:00:00+07:00",
  "delegations": [
    "3f9c2b1e8a7d4c6b9e0f1a2b3c4d5e6f"
  ],
  "sig": {
    "alg": "ES256",
    "kid": "gw-01",
    "value": "q6bJ0tM1g2pUo7k9wqzQyLhB4mF3aVxN8cR5sTdE1uYiHjKlZ0oP9nW2eQ3rT4yU6iO7pA8sD9fG0hJ1kL2zXc"
  }
}

响应

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

The states and the labels.

400Error
application/json

A malformed request, or label_code not 0 or 1.

403Error
application/json

Refused: the signature is not from an active key of this gateway, a bad signature, an inactive gateway, a client certificate of another identity, a request more than 300 s off the server's time, or a company that is leaving CropPath.

404Error
application/json

No such gateway.

405Error
application/json

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

413Error
application/json

The request body is over 1 MiB.

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-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-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-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
{
  "delegations": {
    "3f9c2b1e8a7d4c6b9e0f1a2b3c4d5e6f": "active"
  },
  "labels": [
    {
      "code": "Q-014-0129",
      "lot": "LO-260928-014",
      "n": 129,
      "round": 0,
      "status": "recorded",
      "qr_url": "https://txng.theio.vn/01/00012345678905/10/LO-260928-014/21/k3Vd9_Qe2LmXa0Zr-Tb7"
    }
  ],
  "last_seq": 41,
  "time": 1790564400
}
响应 400 · application/json · malformed
{
  "error": "malformed: the request's fields",
  "code": "malformed"
}
响应 400 · application/json · ids
{
  "error": "bad delegations: at most 64 delegation ids",
  "code": "bad_delegations"
}
响应 400 · application/json · bad_label_code
{
  "error": "bad label_code",
  "code": "bad_label_code"
}
响应 403 · application/json · key
{
  "error": "key not authorized: not an active key of this gateway",
  "code": "key_not_authorized"
}
响应 403 · application/json · signature
{
  "error": "bad signature",
  "code": "bad_signature"
}
响应 403 · application/json · stale
{
  "error": "stale request: the station's time is more than 300 s off",
  "code": "stale_request"
}
响应 404 · application/json
{
  "error": "not found: gw-01",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/gateways/{id}/station-actions

An edge station replays an operator's offline action

身份验证:deviceMtls · replayStationAction

#85 (owner decision 2026-10-17, option b): operators keep working at an edge station with the WAN down. One action an operator recorded at the station with the WAN down, signed by the station as recorded offline at station X for operator Y, replayed in the station's order once it is back: accept and remeasure are applied as that operator's fruit actions with every existing check (lot closed or sampled, transition, measurement in review), the record id as idempotency key and no set_session push; print records that the station printed the fruit's label from its local queue. The cloud checks that the sign-in is this station's and of this company (else 404 like a missing one), claimed, not revoked, the record's time within it (300 s of slack; for a record stamped time_source unsynced, its since_claim_s alone, required: else 403 unsynced_clock), since_claim_s within the sign-in's length (300 s of slack) and the replay within 72 hours of its end (else 403), that the operator may still act on the fruit's facility, which must be the station's (403, 404), that seq is above every action the cloud recorded from the station (409 out_of_order), and that every envelope named in after is stored or was rejected (else 503 not_stored_yet, Retry-After: the station tries again, so an acceptance never overtakes the knock it accepts). A re-measure's offline round must be the fruit's next round: otherwise 409 round_conflict, nothing changes on the fruit, the conflict is recorded, and the knocks the station's devices stamped with that round do not bind (superseded_round). The same record again answers what it answered the first time (200 for an applied one) and writes nothing; other content under a stored id is 409 id_conflict. Each recorded action writes exactly one audit row (station.action, actor the operator, after.station the gateway). A fruit with an accept or re-measure from a station is at most Device-recorded (ADR 0001). The body is signed with one of the gateway's own active keys (ES256 over the canonical JSON of every member but sig, as an envelope). Over mTLS the client certificate must be the gateway's. No principal: the signature is the authentication. Added after the partner SDK 0.2.0 (x-not-in-sdk): not part of the generated SDK clients.

参数

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

Gateway id (the edge station's).

请求体

StationActionRecord (必填)

媒体类型: application/json

请求示例 · application/json
{
  "v": 1,
  "id": "9b2e4c1a-7f3d-4e8b-a6c5-0d1e2f3a4b5c",
  "type": "remeasure",
  "gateway": "gw-01",
  "seq": 12,
  "delegation": "3f9c2b1e8a7d4c6b9e0f1a2b3c4d5e6f",
  "operator": "user-7",
  "fruit": "Q-014-0129",
  "round": 1,
  "recorded_at": "2026-09-28T09:12:03.120+07:00",
  "time_source": "ntp",
  "after": [
    "0b9c2f4e-7d1a-4c3e-9f8b-2a6d5e1c7b30"
  ],
  "sig": {
    "alg": "ES256",
    "kid": "gw-01",
    "value": "q6bJ0tM1g2pUo7k9wqzQyLhB4mF3aVxN8cR5sTdE1uYiHjKlZ0oP9nW2eQ3rT4yU6iO7pA8sD9fG0hJ1kL2zXc"
  }
}

响应

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

Applied before (a lost acknowledgement): the stored answer.

201StationActionResult
application/json

Applied.

400Error
application/json

A malformed record.

403Error
application/json

Refused: the station's key or the sign-in (expired, by recorded_at or by since_claim_s; revoked, also by disabling the operator's account or turning their membership off; not claimed; not active when recorded; another operator), a record stamped unsynced without since_claim_s (unsynced_clock), or the operator may no longer act for the company (the account disabled included).

404Error
application/json

No such gateway, no such sign-in at this station (another station's or another company's), or no such fruit at this station.

405Error
application/json

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

409Error
application/json

Not applied: a round conflict (recorded; the same record again answers it again), an action replayed out of the station's order, another record under the id, or a check of the fruit action (lot closed, transition, review).

413Error
application/json

Over 8192 bytes.

500Error
application/json

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

503Error
application/json

An envelope the action follows is not stored yet; try again later.

响应头

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

X-Request-Id503string

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

Retry-After503string

Seconds to wait before retrying.

响应示例

响应 200 · application/json
{
  "id": "9b2e4c1a-7f3d-4e8b-a6c5-0d1e2f3a4b5c",
  "type": "accept",
  "outcome": "applied",
  "seq": 11,
  "fruit": {
    "code": "Q-014-0129",
    "status": "recorded",
    "accepted_at": 1790561523,
    "round": 0
  }
}
响应 201 · application/json
{
  "id": "9b2e4c1a-7f3d-4e8b-a6c5-0d1e2f3a4b5c",
  "type": "remeasure",
  "outcome": "applied",
  "seq": 12,
  "fruit": {
    "code": "Q-014-0129",
    "status": "awaiting_device",
    "accepted_at": null,
    "round": 1
  }
}
响应 400 · application/json · malformed
{
  "error": "malformed: round",
  "code": "malformed"
}
响应 400 · application/json · gateway
{
  "error": "gateway mismatch: the request names another gateway",
  "code": "gateway_mismatch"
}
响应 400 · application/json · future
{
  "error": "future timestamp: recorded after the server's time",
  "code": "future_timestamp"
}
响应 403 · application/json · key
{
  "error": "key not authorized: not an active key of this gateway",
  "code": "key_not_authorized"
}
响应 403 · application/json · expired
{
  "error": "delegation expired",
  "code": "delegation_expired"
}
响应 403 · application/json · revoked
{
  "error": "delegation revoked",
  "code": "delegation_revoked"
}
响应 403 · application/json · unsynced
{
  "error": "unsynced clock: the station's clock was off and the action carries no since_claim_s",
  "code": "unsynced_clock"
}
响应 403 · application/json · operator
{
  "error": "operator not allowed: the operator may no longer act for the company",
  "code": "operator_not_allowed"
}
响应 404 · application/json · delegation
{
  "error": "not found: no such delegation at this station",
  "code": "not_found"
}
响应 404 · application/json · fruit
{
  "error": "not found: no such fruit at this station",
  "code": "not_found"
}
响应 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
响应 409 · application/json · round
{
  "error": "round conflict: the station numbered round 1, the fruit's next round is 2",
  "code": "round_conflict"
}
响应 409 · application/json · order
{
  "error": "out of order: the station already replayed action 12",
  "code": "out_of_order"
}
响应 409 · application/json · id
{
  "error": "id conflict: another record is stored under this id",
  "code": "id_conflict"
}
响应 409 · application/json · transition
{
  "error": "invalid transition: awaiting_device to accept",
  "code": "invalid_transition"
}
响应 413 · application/json
{
  "error": "too large: at most 8192 bytes",
  "code": "too_large"
}
响应 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}
响应 503 · application/json
{
  "error": "not stored yet: an envelope the action follows has not reached the cloud",
  "code": "not_stored_yet"
}