The ZGW standard has several endpoints which can be accessed. This will show you how to access them. We'll be using OpenZaak with the 'zaken' endpoint in this example, but it can be exchanged with any of the supported ZGW clients or endpoints.
The easiest way to access any endpoint is through a Client instance. All (supported) endpoints are available as a method on the Client class. For example:
use function OWC\ZGW\ApiClient;
$openzaakClient = apiClient('my-oz-client');
$zakenEndpoint = $openzaakClient->zaken();
At the time of writing, the following endpoints are available to most (but not all!) ZGW clients. Remember: the endpoints are available as methods on a client instance.
📥 ZRC | 🗂️ ZTC | 📄 DRC |
---|---|---|
zaken | zaaktypen | objectinformatieobjecten |
statussen | statustypen | enkelvoudiginformatieobjecten |
rollen | roltypen | |
resultaten | catalogussen | |
zaakeigenschappen | resultaattypen | |
zaakinformatieobjecten | informatieobjecttypen | |
zaakobjecten | eigenschappen |
All of these endpoints are callable as a method on your client. It will return an subtype of the OWC\ZGW\Endpoints\Endpoint
class.
$zakenEndpoint = $openzaakClient->zaaktypen();
$zakenEndpoint = $openzaakClient->objectinformatieobjecten();
$zakenEndpoint = $openzaakClient->catalogussen();
// etc.
Not every ZGW client supports every endpoint, so it's a good habit to check for its support:
if ($openzaakClient->supports('zaken')) {
// here be magic
}
Most endpoints support three basic operations: all()
, filter()
and get()
.
Request all entities through the all()
method:
$zakenEndpoint = $openzaakClient->zaken();
$zaken = $zakenEndpoint->all();
The result will be a OWC\ZGW\Support\PagedCollection
(read more about collections).
Request a single entity through the get()
method:
$zakenEndpoint = $openzaakClient->zaken();
$zaak = $zakenEndpoint->get('unique-identifier-here');
The result will be a OWC\ZGW\Entities\Entity
(read more about entities).
Request entities which match a given filter.
$filteredZaken = $zakenEndpoint->filter($filter);
The $filter
has to be of type OWC\ZGW\Endpoints\Filter\AbstractFilter
. This will give any filter a few basic operations:
use OWC\ZGW\Endpoints\Filter\ZakenFilter;
$filter = new ZakenFilter();
// Add any parameter
$filter->add('myparameter', 'myvalue');
// Check if it exists
$filter->has('myparameter', 'myvalue');
// Or remove it
$filter->remove('myparameter');
All endpoints have their own filter implementation with their own methods, in respect to that endpoint. For example the ZakenFilter
will have a method to add a BSN-number filter:
use OWC\ZGW\Endpoints\Filter\ZakenFilter;
$filter = new ZakenFilter();
$filter->byBsn('111222333');
$zakenByBsnNumber = $zakenEndpoint->filter($filter);
Other endpoints might support different methods. Check the technical docs to see which endpoint supports what method.
Most operations on an endpoint either return an Entity or a Collection.