Appearance
Making Product Updates using RAW JSON
Sometimes it is not possible to use one of our SDKs to perform product updates. Here is an example of what that is possible to provide to Relewise about your products. The fields showcase how to map different data types to Relewise.
The examples support batching, and each batch can hold up to 1,000 products. You can fill the items
property with up to 1,000 products. If you need to update more than 1,000 at a time, you need to handle sending the updates in multiple batches.
The request needs to be sent as an HTTP POST
to the following endpoint https://api.relewise.com/<dataset-id>/v1/BatchedTrackingRequest
. You also need to provide the following HTTP Header:
json
"Authorization": "APIKey <API_KEY>"
JSON Product Update
The example here is a batch containing 1 product update:
json
{
"Items": [
{
"$type": "Relewise.Client.DataTypes.ProductUpdate, Relewise.Client",
"Product": {
"Id": "<product-id>",
"DisplayName": {
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "Produkt navn"
},
{
"Language": {
"Value": "en"
},
"Text": "Product name"
}
]
},
"CategoryPaths": [
{
"BreadcrumbPathStartingFromRoot": [
{
"Id": "1",
"DisplayName": {
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "<rod #1>"
},
{
"Language": {
"Value": "en"
},
"Text": "<root #1>"
}
]
}
},
{
"Id": "2",
"DisplayName": {
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "<child #1>"
},
{
"Language": {
"Value": "en"
},
"Text": "<child #1>"
}
]
}
}
]
},
{
"BreadcrumbPathStartingFromRoot": [
{
"Id": "3",
"DisplayName": {
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "<rod #2>"
},
{
"Language": {
"Value": "en"
},
"Text": "<root #2>"
}
]
}
},
{
"Id": "4",
"DisplayName": {
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "<child #2>"
},
{
"Language": {
"Value": "en"
},
"Text": "<child #2>"
}
]
}
}
]
}
],
"Assortments": [
1,
2,
3
],
"Data": {
"ImportedAt": {
"Type": "Double",
"Value": <import-time-stamp>,
"IsCollection": false
},
"<string-value-property-name>": {
"Type": "String",
"Value": "String Value",
"IsCollection": false
},
"<stringlist-value-property-name>": {
"Type": "StringList",
"Value": {
"$type": "System.Collections.Generic.List`1[[System.String, System.Private.CoreLib]], System.Private.CoreLib",
"$values": [
"value-1",
"value2"
]
},
"IsCollection": true
},
"<boolean-value-property-name>": {
"Type": "Boolean",
"Value": true,
"IsCollection": false
},
"<number-value-property-name>": {
"Type": "Double",
"Value": 1234.5,
"IsCollection": false
},
"<numberlist-value-property-name>": {
"Type": "DoubleList",
"Value": {
"$type": "System.Collections.Generic.List`1[[System.Double, System.Private.CoreLib]], System.Private.CoreLib",
"$values": [
1234.5,
5432.1
]
},
"IsCollection": true
},
"<multilingual-value-property-name>": {
"Type": "Multilingual",
"Value": {
"$type": "Relewise.Client.DataTypes.Multilingual, Relewise.Client",
"Values": [
{
"Language": {
"Value": "da"
},
"Text": "Tekst"
},
{
"Language": {
"Value": "en"
},
"Text": "Text"
}
]
},
"IsCollection": false
},
"<multilingual-list-value-property-name>": {
"Type": "MultilingualCollection",
"Value": {
"$type": "Relewise.Client.DataTypes.MultilingualCollection, Relewise.Client",
"Values": [
{
"Language": {
"Value": "da"
},
"Values": [
"Tekst #1",
"Tekst #2"
]
},
{
"Language": {
"Value": "en"
},
"Values": [
"Text #1",
"Text #2"
]
}
]
},
"IsCollection": true
}
},
"ListPrice": {
"Values": [
{
"Amount": 50.0,
"Currency": {
"Value": "DKK"
}
},
{
"Amount": 99.9,
"Currency": {
"Value": "USD"
}
}
]
},
"SalesPrice": {
"Values": [
{
"Amount": 25.0,
"Currency": {
"Value": "DKK"
}
},
{
"Amount": 24.9,
"Currency": {
"Value": "USD"
}
}
]
},
"Brand": {
"Id": "<brand-id>",
"DisplayName": "Brand Name"
}
},
"Variants": [
{
"Id": "variant-1",
"Assortments": [],
"Specification": {
"Size": "XL"
},
"Data": {}
},
{
"Id": "variant-2",
"Assortments": [],
"Specification": {
"Size": "S"
},
"Data": {}
}
],
"ProductUpdateKind": "ReplaceProvidedProperties",
"VariantUpdateKind": "ReplaceProvidedProperties",
"ReplaceExistingVariants": true,
"TypeName": "ProductUpdate"
}
]
}
Variants can contain a subset of properties that is also possible to provide on a product:
- SalesPrice
- ListPrice
- Data-properties
- DisplayName
- Assortments
Handling enabling and disabling when doing full product imports
When you are doing a full product import, there might be products that are no longer available on your website, and there might be old products that need to be re-enabled. You can accomplish that by running these updates. All products imported into Relewise should contain a Data-property called ImportedAt
. This could be a unix timestamp that is the same for all products being imported. Also across batches. Relewise will then enable all products with the new ImportedAt
timestamp, and disable all products without it. This means that all those products that are not part of the batches will be disabled and no longer returned for recommendations and search.
They need to be sent via an HTTP POST to https://api.relewise.com/<dataset-id>/v1/BatchedTrackingRequest
. Here you also need to specificy the ApiKey for this request.
json
{
"Items": [
{
"$type": "Relewise.Client.DataTypes.ProductAdministrativeAction, Relewise.Client",
"Filters": {
"Items": [
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "ImportedAt",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.EqualsCondition, Relewise.Client",
"Value": {
"Type": "Double",
"Value": <import-time-stamp>,
"IsCollection": false
},
"TypeName": "EqualsCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
}
]
},
"ProductUpdateKind": "Disable",
"VariantUpdateKind": "None",
"TypeName": "ProductAdministrativeAction"
},
{
"$type": "Relewise.Client.DataTypes.ProductAdministrativeAction, Relewise.Client",
"Filters": {
"Items": [
{
"$type": "Relewise.Client.Requests.Filters.ProductDataFilter, Relewise.Client",
"Key": "ImportedAt",
"FilterOutIfKeyIsNotFound": true,
"MustMatchAllConditions": true,
"Conditions": {
"Items": [
{
"$type": "Relewise.Client.Requests.Conditions.EqualsCondition, Relewise.Client",
"Value": {
"Type": "Double",
"Value": <import-time-stamp>,
"IsCollection": false
},
"TypeName": "EqualsCondition",
"Negated": false
}
]
},
"TypeName": "ProductDataFilter",
"Negated": false
}
]
},
"ProductUpdateKind": "Enable",
"VariantUpdateKind": "None",
"TypeName": "ProductAdministrativeAction"
}
]
}