Reference¶
A Reference is how an object points to another: an Order to the Products it orders, a
Review to what it reviews. It is a JSON-LD node reference, {"@id": ..., "@type": ...}, written
at_id and at_type as every ObjectsGrid field is.
Send at_id, the object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>: ObjectsGrid sets id and
at_type from it, whatever you send, and refuses an object of a type the field may not point to (each field's type
in the reference pages names them). Any other URL is external: id is null and at_type is the
Schema.org type you send, or null. A pinned reference, such as an Order's customer,
keeps ?version=<n> in at_id.
REST returns a Reference as stored. In GraphQL every reference field is an ObjectsGridObject: select at_id, id
and at_type at no cost, and the object's own fields with a fragment, such as brand { ... on Brand { name { at_value } } }.
See References in GraphQL. A list that grows as other objects are created,
such as a Product's reviews, is computed from the other side, never sent: write the Reviews, each pointing to the
Product.
Example¶
{
"at_id": "https://apis.objectsgrid.com/products/2b5f8f0e-1d0c-4d61-9a7e-5a1f0c3e9d21",
"id": "2b5f8f0e-1d0c-4d61-9a7e-5a1f0c3e9d21",
"at_type": "Product"
}
Fields¶
Required: at_id.
| Field | Type | Required | Description |
|---|---|---|---|
at_id |
URL | Yes | The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid. |
id |
string | The object's id. Assigned by ObjectsGrid when the object is created. | |
at_type |
string | JSON-LD @type, the object's type name. |