Categories
On this page, we'll dive into the different category endpoints you can use to get or sync our category information. We'll look at how to list and get category information.
The category model
The category model contains all the information about a category, such as their name, ids, and images. It also contains a reference to when it was last updated. You can use this to only fetch categories that have been updated since your last sync.
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the category.
- Name
name
- Type
- string
- Description
The category name.
- Name
parent_id
- Type
- integer
- Description
The id of a parent category if this is available.
- Name
structure_path
- Type
- string
- Description
The full category structure as a single string.
- Name
structure
- Type
- array
- Description
The full category structure upwords to the root category. This is an array containing category models.
- Name
images
- Type
- array
- Description
A list of image urls for the category.
- Name
updated_at
- Type
- timestamp
- Description
Timestamp of when the categories was last updated.
List all categories
This endpoint allows you to retrieve a list of categories from VDH-Solar. Refer to the list at the top of this page to see which properties are included with category objects.
Query parameters
You can use the query parameters below to filter the list of categories you receive from the API. You can also paginate the results. Please check the pagination section for more information.
- Name
name
- Type
- string
- Description
Filter on the name of the category. This will use a
%LIKE%
query.
- Name
id
- Type
- integer
- Description
We will do an exact match on the category id. It would be beter to use the single category endpoint for this.
- Name
parent_id
- Type
- integer
- Description
We will do an exact match on the parent id and return a list of all categories that have this parent id.
- Name
updated_before
- Type
- timestamp
- Description
We will only return the categories that where updated before this timestamp.
- Name
updated_after
- Type
- timestamp
- Description
We will only return the categories that where updated after this timestamp.
Request
$client = new \VdhSolar\ApiClient('eyJ...');
$client->categories->list([
'name' => 'management',
'updated_since' => 555931527,
]);
Response
{
"data": [
{
"id": 209,
"parent_id": null,
"name": "Kabel management",
"structure_path": "Installatie > Kabels > Kabel management",
"structure": [{
"id": 198,
"parent_id": null,
"name": "Installatie",
// ...
},
{
"id": 205,
"parent_id": 198,
"name": "Kabels",
// ...
},
{
"id": 209,
"parent_id": 205,
"name": "Kabel management",
// ...
}
],
"images": [
"https://vdh-solar.nl/images/....",
// ...
],
"updated_at": 555931527,
},
{
// etc...
},
]
}
List a single category
This endpoint allows you to to list all information about a single category. Please let us know if you need more information about a category, we will add this to the response as requested.
Request
$client = new \VdhSolar\ApiClient('eyJ...');
$client->categories->get(3);
Response
{
"data": {
"id": 3,
"parent_id": null,
"name": "Zonnepanelen",
"structure_path": "Zonnepanelen",
"structure": [{
"id": 3,
"parent_id": null,
"name": "Zonnepanelen",
// ...
}
],
"images": [
"https://vdh-solar.nl/images/....",
// ...
],
"updated_at": 555931527,
}
}