To fetch the data of an entity such as an article or a customer you can use methods such as Article.get or Customer.get. To retrieve the entire entity, use true
or the empty object ({}
) as the query.
You can specify what part of the data you want by providing a query object with the value true
for all the keys that you want to get, e.g.
This works for subkeys as well.
In this way, you can get several values.
A shortcut to get a single property lets you specify a string rather than an object with key: true
, like this.
If all the keys are on the same level in the object, you can specify an array of key names.
In some cases, a value refers to a unique identifier in a different API class.
It is then possible to fetch that other object, in this case the article group using the Articlegroup class. To achieve this, specify that part of the query in object form.
If the article doesn't have an article group, { "articlegroup": null }
is returned, even if there is a query specifying properties inside the article group in question.
If the query is malformed, for example if you try to query into a scalar value, then you will get an error back. The error will always carry a pointer to where in the query it occurred.