Query a Single Type document
Here we discuss how to retrieve the content for a Single type document.
getSingle helper function
In this example we use the getSingle helper function to query the single instance of the custom type "navigation".
'navigation'); // $document contains the document content$document = $api->getSingle(
Without the helper
You can perform the same query without using the helper function. Here we again query the single document of the type "navigation".
'document.type', 'navigation')); $document = $response->results; // $document contains the document content$response = $api->query(Predicates::at(
Querying by Language
Note that if you are trying to query a document that isn't in the master language of your repository this way, you will need to specify the language code or wildcard language value. You can read how to do this on the Query by Language page.
If you are using the query helper function above, you do not need to do this.
Was this article helpful?
Can't find what you're looking for? Get in touch with us on our Community Forum.