CropPath cho nhà phát triển

Tài liệu API

419 thao tác của AgriTrace HTTP API, phiên bản 1, được tạo từ tài liệu OpenAPI.

Mô tả thao tác và trường dữ liệu viết bằng tiếng Anh, như trong tài liệu OpenAPI.

The CropPath HTTP API, version 1, at https://txng.theio.vn. It covers a company's traceability records (growing areas, lots, packing, shipping and exports), devices and their signed messages, laboratories, the public lot and fruit pages behind the QR codes, and webhooks. Guides, examples and this reference: https://txng.theio.vn/en/developers.

Each operation's security lists the credentials it accepts. bearer: an API token (agt_..., role tenant_admin, operator or auditor) or the access token of an OAuth2 API client (ago_...), sent as Authorization: Bearer; an API client also needs the scope the operation lists under oauth2. cookie: a person signed in to the CropPath console. An operation with no security is anonymous. deviceMtls: a device or gateway with its client certificate.

x-session-only: true marks an operation for people signed in to the console only (account, team, credentials, company settings and support): it lists the session cookie as its only security. An API token or API client calling one is refused: 401 not_authenticated for the signed-in user's own operations under /v1/auth/... and for GET /v1/help, which read only the session cookie, and 403 role_not_permitted for the others. Operations for CropPath's platform admins and for lab users need a role that no API client and no API token a company creates can hold, so they answer 403 to a company's integrations as well.

An error answers with a stable code in its JSON body (an Error; device ingest answers an IngestResult, and the OAuth2 endpoints the RFC 6749 error with the code beside it). An operation that lists the Idempotency-Key header can be retried safely with the same key.

Per-company quotas (#134): every call made with a company's API tokens or API clients counts toward that company's quotas, on top of the per-client limits an operation lists: calls per minute and calls per UTC day (the company admin's usage page and getCompanyUsage show both). Over either, any such operation answers 429 too_many_requests with Retry-After (for the daily quota, the seconds until the next UTC midnight), right after the credential is checked and before anything else is checked or changed.

Tải tài liệu OpenAPI (JSON) /developers/openapi.json

Xác thực

Thao tác theo nhóm

Nền tảng (nội bộ)

Các thao tác dùng để vận hành chính nền tảng: mọi thao tác chỉ quản trị viên nền tảng gọi được (ví dụ tạo đơn vị và quản trị viên của đơn vị, duyệt cơ sở, vùng trồng, thiết bị và gateway, quản lý phòng kiểm nghiệm, số liệu giám sát) và lệnh kiểm tra quyền của broker MQTT. Tích hợp của đối tác không dùng đến các thao tác này.

Xem thêm