CropPath 开发者

API 参考

AgriTrace HTTP API(版本 1)的 419 个操作,由其 OpenAPI 文档生成。

操作和字段说明为英文,与 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.

下载 OpenAPI 文档(JSON) /developers/openapi.json

身份验证

按领域分组的操作

平台(内部)

用于运行平台本身的操作:所有只有平台管理员可以调用的操作(例如创建租户及其管理员,批准设施、种植区、设备和网关,管理实验室,监控指标),以及 MQTT 代理的授权检查。合作伙伴的集成不会用到这些操作。

更多