API ReferenceContext Repository
Get several assets by id
Returns the named assets in one call, of whatever types their ids name.
GET /context/v1/assets/by-id
Returns the named assets in one call, of whatever types their ids name. Pass the ids as a comma-separated list in asset_ids, at most 500 per call. Use it when you already hold ids, for example from a search or a link, and want their bodies without one request each. An id the project does not hold is left out of assets and listed in not_found.
Requires the context:read scope.
Parameters
| Parameter | Location | Required | Description |
|---|---|---|---|
asset_ids | query | no | Comma-separated asset ids or canonical names (projects/{project}/assets/{id}), at most 500. |
Responses
| Status | Meaning |
|---|---|
200 | The request succeeded. |
401 | The token is missing, expired or invalid. |
403 | The token does not carry the scope this operation requires. |
404 | No such project, or the token belongs to a different project. |
422 | The request was not valid: a parameter or the body failed validation. |
The 200 response body:
| Field | Type | Required | Description |
|---|---|---|---|
assets | array of AssetsByIdEntry | yes | The assets the project holds, in no particular order. |
not_found | array of string | yes | The ids that were asked for and are not in assets. |
Shapes
The named shapes used above.
AssetsByIdEntry
One asset returned by id.
| Field | Type | Required | Description |
|---|---|---|---|
asset | object | yes | The asset's whole body; its fields depend on the asset's type. |
asset_type | string | yes | The asset's type. |
declared_type | object or null | no | For an asset of a type the project declared: that type's card rules, content schema and, when it is a table, its table spec. |
name | string or null | no | The asset's canonical name, projects/{project}/assets/{id}, where {id} is the id inside asset. A request that takes an asset id in its body or query accepts this name in its place; a URL path takes the bare id. It is null when the id cannot be written in a canonical name. |
noun | string | yes | What an asset of this type is called. |
Example
curl -sS "$API_URL/context/v1/assets/by-id" \
-H "Authorization: Bearer $TOKEN"