Get a canon grain
Módulo Canon
GET/canon/grains/{grain}canonGrains.get
Grain: class, unit or lot (Section 3.9). Returns one canon grain with its `ETag`. A canon grain the caller may not see returns 404.
- Requiere la capacidad canon.taxonomy.read.
- Alcances de OAuth: canon.
- Estados de error: 400, 401, 404, 429. Los errores son detalles de problema RFC 9457.
Parámetros de ruta y de consulta
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| grain | GrainCode | Sí | Grain from `xpms.dim_grain` (Section 3.9).Restricciones: pattern ^[a-z]+$ |
| fields | Fields | No | Sparse fieldset: a comma-separated list of top-level fields to return. `id` is always returned.Restricciones: pattern ^[a-z_][a-z0-9_]*(,[a-z_][a-z0-9_]*)*$ |
Respuesta 200: CanonGrain
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| grain | GrainCode | Sí | Grain from `xpms.dim_grain` (Section 3.9).Restricciones: pattern ^[a-z]+$ |
| counts | string | Sí | What it counts.Restricciones: length 1 to 300 |
| identified_by | string | Sí | How it is identified.Restricciones: length 1 to 300 |
| answers | string | Sí | What it answers.Restricciones: length 1 to 300 |
| note | string | null | Sí | Note from the Bible.Restricciones: length 1 to 20000 |
{
"grain": "unit",
"counts": "One physical thing",
"identified_by": "Serial or asset tag",
"answers": "Where is this one?",
"note": "Tracked individually."
}Ejemplos de código
curl -X GET "$XOS_BASE_URL/canon/grains/unit" \
-H "Authorization: Bearer $XOS_API_KEY"const { data, etag } = await xos.canonGrains.get("unit");response = xos.canon_grains.get("unit")xos canon-grains get unit