Get an asset
Returns one asset by its id; the id's prefix says which type it is.
GET /context/v1/assets/{asset_id}
Returns one asset by its id; the id's prefix says which type it is. Pass version to read an archived version instead of the live one. Pass expand=links to attach the asset's incoming and outgoing relationships, each with the neighbour's type and display name already resolved, so you do not need a request per relationship.
Requires the context:read scope.
Parameters
| Parameter | Location | Required | Description |
|---|---|---|---|
asset_id | path | yes | The asset's id. |
version | query | no | Return this archived version of the asset instead of the live one. |
expand | query | no | Pass links to attach incoming and outgoing relationships, each with the neighbour's type and display name already resolved. |
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 |
|---|---|---|---|
asset | object | yes | The asset's whole body; its fields depend on the asset's type. |
asset_id | string | yes | The asset's id. |
asset_type | string | yes | The asset's type. |
card | AssetCard | yes | The asset's short form. |
label | string | yes | The asset's display name. |
links | AssetLinks or null | no | The asset's relationships. Present when expand=links was asked for. |
name | string or null | no | The asset's canonical name, projects/{project}/assets/{asset_id}. 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. |
Shapes
The named shapes used above.
AssetCard
The short form of an asset: enough to show it in a list without reading its body.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | The asset's id. |
summary | string or null | no | A one- or two-line summary, or null when the asset's type has none. |
tags | array of string | yes | The asset's tags. |
title | string or null | no | A short title, or null when the asset's type has none. |
AssetLinks
An asset's relationships.
| Field | Type | Required | Description |
|---|---|---|---|
incoming | array of AssetLink | yes | Relationships that point at this asset. |
outgoing | array of AssetLink | yes | Relationships that start at this asset. |
AssetLink
One relationship an asset has.
| Field | Type | Required | Description |
|---|---|---|---|
direction | string | yes | Whether it leaves this asset or arrives at it. |
directionality | string | yes | Whether the relationship reads the same in both directions. |
neighbour | AssetNeighbour | yes | The asset at the other end. |
predicate | string | yes | The relationship's name. |
rank | integer or null | no | The position of this relationship among those of the same kind, or null when the relationship has no order. |
version | integer | yes | How many times this relationship has changed. |
AssetNeighbour
The asset at the other end of a relationship.
| Field | Type | Required | Description |
|---|---|---|---|
asset_id | string | yes | Its id. |
asset_type | string or null | no | Its type, or null if the id cannot be resolved. |
label | string | yes | Its display name. |
name | string or null | no | Its canonical name, projects/{project}/assets/{asset_id}. 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. |
Example
curl -sS "$API_URL/context/v1/assets/$ASSET_ID" \
-H "Authorization: Bearer $TOKEN"Get several assets by id
Returns the named assets in one call, of whatever types their ids name.
Get the open changeset
Returns the project's open changeset without the bodies of its ops: its status, the ops staged in it (what each acts on, who staged it and how review has decided it), and the ops grouped into the uni…