Getting a list of product templates
GET {{api-url}}/product/{{tenant}}/product-templates?q=attributes.type:DATETIME
Returns a list of product templates. The product template defines a set of attributes which are common for all product instances based on the product template.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
pageNumber | number | The page number to be retrieved where the size of the pages must be specified by the pageSize parameter.The number of the first page is 1. | |
pageSize | number | The number of documents being retrieved on the page. | |
sort | string | Fields to sort the response data by following order of the parameters from left to right. | |
Can contain multiple fields in format: field name:sort direction separated by a comma. | |||
The colon with sort direction parameter is redundant and descending order is taken only if it is equal to desc or DESC . | |||
Ascending order is considered in any other case. | |||
While sorting by a localised field the following rule is taken into account: |
- If a localized field contains information about a language then the language should be used. For example
name.en:ASC
. In that case en language will be used for sorting the name property. The language suffix takes precedence overAccept-Language
header. - If a localized field does not contain information about language then
Accept-Language
header will be used. For examplename:ASC
andAccept-Language: de
. In that case de will be used for sorting the name property - If a localized field does not contain information about language and
Accept-Language
header contains*
then default language from configuration service will be used as a language. For examplename:ASC
andAccept-Language: *
and default language is pl then pl will be used as a language for name property - If a localized field does not contains information about language and
Accept-Language
header does not exists in the request then default language from configuration service will be used. " | |q
| string | | A standard query parameter is used to search for specific values. + Searching for an item by string property:q=id:31065d5b-b62e
whereid
is the name of string field and31065d5b-b62e
is its required value. + Searching for an item by localized field property:q=name.en:T-s
wherename
is the name of the field,en
is a language code andT-s
is a required value of this field. This query works only for localized fields, which are stored in a Map format wherekey
is a language code andvalue
is translation to particular language. + Searching for items by date property. All numer-based property queries are valid also for dates. In that case the date should be placed within double quotes:q=metadata.createdAt:(>="2021-05-18T07:27:27.455Z" AND <"2021-05-20T07:27:27.455Z")
+ Searching for items with non existing or empty property:q=name.en:null
wherename.en
is a name of fields that has valuenull
. + Searching for items with existing property:q=attributes:exists
whereattributes
is a name of field that hasnon null
value. + Searching for items by multiple specific values:q=id:(5c3325baa9812100098ff48f,5c3325d1a9812100098ff494)
whereid
is name of field and strings within a bracket are it's required value. + Searching for items by multiple fields:q=id:5c3325baa9812100098ff48f name.en:T-s
whereid
and 'name.en' are the names of fields. All documents that contain given values of these fields are returned. Multiple fields separated by space can be specified. Multiple values for each field can be also specified in a format presented above. + Searching for items with string fields conforming to a regex:q=name.en:~ABCD12
orq=name.en:(~AB CD)
- in case of searching for strings with space, wherename
is the name of field andABCD12
orAB CD
is it's querying regex. |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
X-Total-Count | boolean | In order to get information how many entities meet a filter requirements, X-Total-Count header has been introduced. The header is optional and its default value is false. It the header is provided and it is true then total count is returned in the X-Total-Count response header. In both cases (X-Total-Count true, false or not provided), the response body has the same format (array of entities). In other words, the information about total count is returned on demand, depending of an existence of X-Total-Count header in a request. Therefore, the X-Total-Count header is not returned if an API consumer didn’t ask for it. | |
Accept-Language | string | The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty then default system language is returned. It can be a priority list working as a fallback mechanism. | |
Accept | string |
RESPONSES
status: OK
[{"id":"31065d5b-b62e-4ceb-ba1f-ef931be7c3bd","name":{"en":"T-shirt"},"attributes":[{"key":"color","name":{"en":"Color","pl":"Kolor"},"type":"TEXT","metadata":{"mandatory":false,"defaultValue":null},"values":[{"key":"GREEN"},{"key":"RED"}]}],"metadata":{"createdAt":"2022-03-31T09:52:15.423Z","modifiedAt":"2022-03-31T09:52:15.423Z","version":1}}]