Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The GetCategories-request resemble the GetProducts-request very much. In fact, most of the parameters are shared between the two.
GetCategories | |||||
Parameters | Name | Mandatory | Description | ||
Channel | Yes | The channel you want categories from must be supplied. | |||
Keys | No | The list of KeyField values for the categories you want fetched. If no Keys supplied, all categories will be fetched. | |||
SiteKey | No | Only fetch categories for some site denoted by is KeyField. | |||
IncludeMappings | No | Specifies which mappings should be included for the fetched categories. If nothing is specified here all mappings are included. | |||
ExcludeMappings | No | Specifies which mappings should be excluded. If nothing is specified here, it is assumed that no mappings are excluded. | |||
ForceBinaryOutputKind | No | How binaries are output is controlled on the mapping. This parameter overrides that setting on the mapping and forces binaries to be output as specified. Possible values are None, Url, File and Embedded. | |||
IncludeModificationDates | No | When set to true, modification dates will be output on all elements in result. | |||
IncludePerfionNamesOnFields | No | When set to true, the name of the feature from which a field comes from is added to output. | |||
IncludePerfionItemIdsOnSelectables | No | When set to true, the id of a selectable feature output to a Field will be added to the output. | |||
RemoveUnwantedFeaturesByConfiguration | No | When set to true, a wild-card mapping will only return Features/Fields which are configured for each individual item. | |||
FlattenHierarchy | No | When set to true, sub categories will no longer be output as child elements of their parents but all in one big list. Parenthood can still be determined by looking at the output parented-attribute. | |||
TimeZone | No | Available from Perfion 4.7 this parameter allows you to control in which time zone that is used to output modification dates when IncludeModificationDates is enabled. If this parameter is not supplied, the time zone supplied in Settings will be used (See section Timezone). If no time zone is supplied here either, the time zone of the Perfion Database will be used. This was also the time zone used by the EC API in earlier versions of Perfion. | |||
OutputMultiValueFieldsIndividually | No | Available from Perfion 2024 R1 SR2: You can now output multi value features mapped to Fields as individual Fields-elements instead of the default of Value-subelements or a value attribute. | |||
Sample Mapping | Image RemovedImage Added | ||||
Sample Data | Image RemovedImage Added
| ||||
Sample Request |
| ||||
Sample result |
|
Table 1: GetCategories-method.
Note in Table 1 that only CatId and Name is output. Note further that hierarchy is built into the result in two ways:
Structural, i.e. a category has in a Categories-element its subcategories. This can be omitted by using the FlattenHierarchy-parameter as described in Section GetCategories.
By id and parentid. A category will as parentid point to its parent-category except when it has no in which parentid would be 0.
The following parameters are shared with GetProducts meaning that Channel, IncludeMappings, ExcludeMappings ForceBinaryOutputKind, IncludeModificationDates, IncludePerfionNamesOnFields and RemoveUnwantedFeaturesByConfiguration work for categories exactly as they do for products. If you need info on any of these please go to appropriate sub-section of section GetProducts.
The remaining Parameters supported will be described in sections below.
GetCategories: Keys-Parameter
The Keys-parameter works for categories as they do for Products. There is a small pitfall using it on categories, though, since it will only fetch a single category when used on a KeyField (assuming this holds a unique value). This means that you will not get any sub-categories for this single category (unless they share the same Key).
In most cases, however, you would just want to retrieve all categories.
GetCategories: SiteKey-Parameter
In case you have more sites in your category structure, as seen on below, you can ask for only categories from a particular site.
Example: The following request fetches only categories for site with a key value of “Site B”:
Code Block |
---|
<Execute method="GetCategories" refreshconfiguration="true"> <Parameter id="Channel" value="My Channel" /> <Parameter id="SiteKey" value="Site B" /> </Execute> |
Info |
---|
NOTE: This requires you to have a KeyField-mapping on Site-entity. |
GetCategories: FlattenHierarchy-Parameter
As can be seen in Table 1 the ECommerce API outputs categories hierarchically. In case you want to have categories in a flat element-list instead (using id/parentid-relationship to determine hierarchy) you can use the FlattenHierarchy-parameter:
Sample Data | Image RemovedImage Added
| ||
Sample Request |
| ||
Sample result |
|
Table 2: GetCategories-output is flattened using the FlattenHierarchy-parameter
Table of Contents |
---|