Navigation
Lead / Send Request Scenario
General
Design
APIs
Lead / Send Request Scenario
General
Design
APIs
The propertyservice API allows customers to decide which properties should be shown to the users. This can be useful, for instance, if a shop does not offer all variants of a product. Technically, the API works similar to the PriceService API.
The URL of the webservice has to be sent to us so it can be set as parameter in the corresponding GatekeeperID configuration on the server.
CORS Header (Cross-Origin)
Since pCon.ui will get information from a different origin than its own, the same origin policy is violated. Therefore, CORS header need to be set to allow loading of the information in pCon.ui as follows:
Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Method: POST Access-Control-Allow-Origin: https://ui.pcon-solutions.com
The properties can be adapted on two levels: the properties themselves and their values. For both levels, the post requests are send to the same webservice URL. In any case, the properties are not “removed” from the article, they are just not shown to the user (hidden).
The POST request sent by pCon.ui on every event that may change the property list looks like the following:
{ "type": "property", "manufacturerId": "<manufacturerId>", "seriesId": "<seriesId>", "baseArticleNumber": "<baseArticleNumber>", "properties": Array<property> }
The properties field contains all available properties in the format
<property>, which is defined as:
{ "propClass": "<propClass>", "propKey": "<propKey>" }
If customFields parameter was set in pCon.ui URL, the JSON contains this as well.
{ "type": "property", "manufacturerId": "<manufacturerId>", "seriesId": "<seriesId>", "baseArticleNumber": "<baseArticleNumber>", "properties": [ { "propClass": "<propClass_1>", "propKey": "<propKey_1>" }, { "propClass": "<propClass_1>", "propKey": "<propKey_2>" }, { "propClass": "<propClass_2>", "propKey": "<propKey_1>" }, { "propClass": "<propClass_2>", "propKey": "<propKey_2>" } ], "customFields": "<customFields>" }
The response can contain a whitelist as well as a blacklist.
If both are sent, the blacklist will be ignored. If none is returned, all properties are shown.
{ whiteList: Array<property>, blackList: Array<property> }
| Element | Presence | Description |
|---|---|---|
| whitelist | optional | List of <property>s that should be visible |
| blacklist | optional | List of <property>s that should be hidden |
Example
→ If you want to enable only propertykeys color and material in the chair basics class, height should not be visible. You do a whitelist like this:
{ "whiteList": [ { "propClass": "chair_basics", "propKey": "color" }, { "propClass": "chair_basics", "propKey": "material" } ] }
You could do the same with a blacklist like this:
{ "blackList": [ { "propClass": "chair_basics", "propKey": "height" } ] }
Please make sure that you just use one of the options (whitelist OR blacklist).
The POST request sent by pCon.ui on every event that may change the property list looks like the following:
{ "type": "choice", "manufacturerId": "<manufacturerId>", "seriesId": "<seriesId>", "baseArticleNumber": "<baseArticleNumber>", "propClass": "<propClass>", "propKey": "<propKey>", "currentChoice": "<propValue>", "choices": Array<propValue> }
The field choices
contains all available property values as a list of string values.
{ "type": "choice", "manufacturerId": "<manufacturerId>", "seriesId": "<seriesId>", "baseArticleNumber": "<baseArticleNumber>", "propClass": "<propClass>", "propKey": "<propKey>", "currentChoice": "<propValue_1>", "choices": [ "<propValue_1>", "<propValue_2>", "<propValue_3>", "<propValue_4>", "<propValue_5>", "<propValue_6>" ] }
The response has to contain a whitelist. If the current choice is not part of this list, it will be automatically added in order to avoid empty choice lists.
Array<propValue>
Example
→ you want to enable only choices red, green and blue in the propKey color, yellow and black should not be visible. You do a whitelist like this:
["red","green","blue"]
As you enable just these three choices, the choices not mentioned are not visible.
Please pay attention - choices can only be defined throught whitelisting!