Here we can create products groups and add products to product group. In addition, we can set the default VAT value for all products as well as a value other than the default value for a given product.
Table of contents
Table of contentsGlossaryPOST - create new product group. Id will be generatedPUT - add products to product groupPUT - assign products tax value
Glossary
Name | Explanation |
name | name of product group |
POST - create new product group. Id will be generated
In order to create new product group use POST
/api/v1/pricing/integrations/auth-required/product-group
. The sequence diagram below shows the process:
Example request:
jsoncurl -X POST "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/product-group" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "{ "name": "VIP group" }
In response you will receive
productGroupId
which should be saved.Example response:
json{ "productGroupId": "6bade70a-e943-46ce-8625-ba8a00356859", "name": "VIP group" }
PUT - add products to product group
In order to add products to product group use PUT
/api/v1/pricing/integrations/auth-required/product-group/{id}/products
. The diagram below shows the dependence of communicating with the API:Use the parameter in query below to add selected products to product group:
id
Example request:
jsoncurl -X PUT "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/product-group/6bade70a-e943-46ce-8625-ba8a00356859/products" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "[ "SKU1", "SKU2", "SKU3", "SKU4" ]
PUT - assign products tax value
By default, 23% VAT is set for all products. It is possible assign a different percentage to a selected product. Use for this purpose PUT
/api/v1/pricing/integrations/auth-required/products/tax
. The diagram below shows the dependence of communicating with the API:
Example request:
jsoncurl -X GET "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/products/tax" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "{ "taxes": [ { "productId": "SKU1", "tax": 8 }, { "productId": "SKU2", "tax": 5 } ] }