Get a canon grain
Canon module
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.
- Requires the capability canon.taxonomy.read.
- OAuth scopes: canon.
- Error statuses: 400, 401, 404, 429. Errors are RFC 9457 problem details.
Path and query parameters
| Field | Type | Required | Description |
|---|---|---|---|
| grain | GrainCode | Yes | Grain from `xpms.dim_grain` (Section 3.9).Constraints: pattern ^[a-z]+$ |
| fields | Fields | No | Sparse fieldset: a comma-separated list of top-level fields to return. `id` is always returned.Constraints: pattern ^[a-z_][a-z0-9_]*(,[a-z_][a-z0-9_]*)*$ |
Response 200: CanonGrain
| Field | Type | Required | Description |
|---|---|---|---|
| grain | GrainCode | Yes | Grain from `xpms.dim_grain` (Section 3.9).Constraints: pattern ^[a-z]+$ |
| counts | string | Yes | What it counts.Constraints: length 1 to 300 |
| identified_by | string | Yes | How it is identified.Constraints: length 1 to 300 |
| answers | string | Yes | What it answers.Constraints: length 1 to 300 |
| note | string | null | Yes | Note from the Bible.Constraints: length 1 to 20000 |
{
"grain": "unit",
"counts": "One physical thing",
"identified_by": "Serial or asset tag",
"answers": "Where is this one?",
"note": "Tracked individually."
}Code samples
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