Tips and tricks#
The following paragraphs will show some advices on how to handle different situations.
Portfolio-Update#
A possible approach to update the current assortment could look like this:
- Flag all items as inactive.
- Download the latest assortment via
GET api/products
. - Import/update all products from step 2 and flag them as active.
- This will (re)activate all available products, while keeping EOL items from step 1 inactive.
If this approach doesn't work, you can always set the parameter checkAll
to true
when doing a POST
-request against api/products/check-availability
.
This will return three different lists of skus:
unavailable
will list all skus that have been provided in the request-body but are not in the API anymore.new
will list all skus that have not been provided in the request-body but are in the API.existing
will list all skus that have been provided in the request-body and are still in the API.
Check product availability#
If you want to check if a product is in stock (before placing an order for instance), you can do a GET
-request on the endpoint api/products
by using the parameter sku
.
The response will allow you to check the value of stock
.
Attention
If you don't get a response in the first place, the ordered product is EOL and the order can not be fulfilled.
Find changes#
Since products that are already online and still available could also have updated values - like prices, texts or images - we highly recommend to check all products on a regular basis.
To have a single value that represents the product integrity each product has a field called prevDataHash
. This can be stored alongside the other details in you databse.
As soon as both hashes (meaning the "old" and the "new" one) are not equal, at least one value changed and the product needs to be updated.
Following a basic example:
- Day 1: The product is stored in your database with a
prevDataHash
value ofaaabbbcccdddeeefff
. - Day 2: The value of
prevDataHash
is stillaaabbbcccdddeeefff
: nothing has to be done. - Day 3: The value of
prevDataHash
is nowggghhhiiijjjkkklll
: some data did change so your database-record needs to be updated.