Conventions
Connections and paginationLink copied!
GraphQL Cursor Connections Specification, or Relay spec provides a consistent interface for querying by id and for pagination within queries that return a list.
The GraphQL Management API uses this standard wherever paginated result sets are available — not just for assets and media, but across the whole API, including content generation sessions, teams, extensions and webhook listeners.
ConnectionsLink copied!
Connections are used to describe the connection between an object in the graph and the objects it is connected to. In the GraphQL Management API the viewer is connected to its mediaHubs and organizations, each media hub is connected to its assetRepositories, each asset repository is connected to its assetFolders and each asset folder is connected to its assets.
Edges and PageInfoLink copied!
Connections will always contain edges and a pageInfo field (of type PageInfo).
The edge describes the relationship between the two nodes (e.g. between the media hub and the asset repository).
The pageInfo object describes the current set of results and is detailed in the Pagination section below.
NodesLink copied!
A node is a single entity in the graph, for example an asset or an assetFolder.
Single node queriesLink copied!
You can fetch a single asset using the node query
Multiple node queriesLink copied!
Queries that return a list (multiple nodes) use the connection > edges > node structure defined by the Cursor Connections Specification.
For example to return the list of assets for an assetSearch query:
Note
The id used in node queries is a specific id for use within our GraphQL Management API. Assets also have an assetId, which is a shorter UUID, which is for compatibility with asset manifests and existing integrations.
PaginationLink copied!
For multiple node queries that support pagination, the values in the pageInfo object can be used along with the arguments first and after, or last and before:
firstspecifies the number of results to return when paginating forwards, and is required wheneverafteris usedlastspecifies the number of results when paginating backwards, and must be used together withbefore
The PageInfo object will allow you to determine whether there is a next or previous page (hasNextPage, hasPreviousPage) as well as the start and end cursor to use when paging (startCursor, endCursor).
For example the following assetSearch query
Returns this response:
The endCursor value from the response can then be passed into the after argument of the next request:
Note
assetSearch connections additionally return a total field with the overall result count, which is useful when building paging controls. total is specific to asset search results — most other connections in the API expose only edges and pageInfo.