Laredoute Offer zero stock update
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Date | Version | Name | Applied changes |
---|---|---|---|
07/03/2023 | 1.0 | Hristiyan | Initial Version |
26/05/2023 | 1.1 | Danail Deltchev | Addition of Closed and Protect flags behaviour |
The purpose of this page is to describe in details the process of sending zero stock updates on MIRAKL.
We are able to send updates to an offer using the call for creating an offer (OF01), but we need to specify the value in update_delete field to be equal to “update“ ( "update_delete"
: "update") and to send quantity=0;
-
POST OF01 - Import a file to add offers API Call:
/api/offers/imports
API Docs: https://laredoutestg-stg.mirakl.net/help/api-doc/seller/mmp.html#OF01
In order to send zero stock updated we should push only mandatory fields as per below mapping:
Mapping is the same as Offer stock update
In order to send 0 stocks, in Hemi the statuses and the triggers would be:
We pick the offer for zero stock when we have:
Product status=Product Published ; End Item= Pending
If we send the offer for update successfully we set: Product status=Product Published ; Listing Status= Active/Inactive; End Item= Sent
After successful update we will have:
Product status=Product Published ; Listing Status= Inactive; End Item= Not Needed
If error, we will have following:
Product status=Product Published ; Listing Status= Active/Inactive; End Item= Error
The error need to be stored into the particular End item error field.
Note: End item=Yes will trigger the update!
Example Response:
{
"import_id": 2035
}
After each successfully send feed for creation we will receive the feed id from the response and need to store it in Marketplace Feeds table.
Mirakl Field | Hemi Field | Comment |
---|---|---|
import_id | Marketplace Feed > External ID | |
Marketplace Feed > Account | For which account is the feed generated. | |
Marketplace Feed > Type | Hardcoded as “Offer End Item” | |
Marketplace Feed > Submitted Date | When the feed is submitted | |
Marketplace Feed > Sent Objects Count | How many products we have pushed in the feed | |
Marketplace Feed > Completed Date | When the feed is completed |
Please note we will also add the feed objects which after processing need to be removed.
- GET OF02 - Get information and statistics about an offer import
API Call: /api/offers/imports/{import}
API Docs: https://laredoutestg-stg.mirakl.net/help/api-doc/seller/mmp.html#OF02
Parameter | Integration Notes / Value | Required |
---|---|---|
import |
Import identifier | Yes |
Using this call, we are able to check the status of the imported file.
Example Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<import>
<date_created>2019-04-01T15:16:31Z</date_created>
<error_report>false</error_report>
<import_id>2035</import_id>
<lines_in_error>0</lines_in_error>
<lines_in_pending>0</lines_in_pending>
<lines_in_success>1</lines_in_success>
<lines_read>1</lines_read>
<mode>NORMAL</mode>
<offer_deleted>0</offer_deleted>
<offer_inserted>1</offer_inserted>
<offer_updated>0</offer_updated>
<status>COMPLETE</status>
</import>
OF02 call is returning the response for the actual offer import (all offers).
Based on the response, we will need to check if we have to continue with the error report (if "error_report": true
) we continue with OF03, otherwise we treat it as success.
Success case:
Product status=Product Published ; Listing Status= Inactive; End Item= Not Needed
Error case:
If "error_report": true
this means there is an error and we need to reach each of the reports in order to check for which item and what is the error.
Product status = Product created and Listing Status = Inactive and End Item = Error
and we need to store the relevant error in Product Account > End Item Error
- GET OF03 - Get the error report file for an offer import
In order to check if there are any errors related to the products, into imported file we should use the GET OF03 API Call.
API Call: /api/offers/imports/{import}/error_report
API Docs: https://laredoutestg-stg.mirakl.net/help/api-doc/seller/mmp.html#OF03
"sku";"product-id";"product-id-type";"description";"internal-description";"price-additional-info";"quantity";"min-quantity-alert";"state";"available-start-date";"available-end-date";"logistic-class";"update-delete";"discount-start-date";"discount-end-date";"price";"discount-price";"discount-ranges";"price-ranges";"discount-start-date[channel=FR]";"discount-end-date[channel=FR]";"price[channel=FR]";"discount-price[channel=FR]";"discount-ranges[channel=FR]";"prices-ranges[channel=FR]";"discount-start-date[channel=CA]";"discount-end-date[channel=CA]";"price[channel=CA]";"discount-price[channel=CA]";"discount-ranges[channel=CA]";"prices-ranges[channel=CA]";"leadtime-to-ship";"error-line";"error-message"
"OFFER_SKU_004";"MKP100000000195360";"SKU";"My Offer Description n°1";"My Internal description 1";"My price Additional innformations";"1000000";"20";"11";"2017-02-20T10:45:53+01";"2017-04-30T10:45:53+01";"S";"update";"2017-02-22T10:45:53+01";"2017-04-30T10:45:53+01";"110.52";"108,56";"";"5|109.20,10|108.736";"2017-02-22T10:45:53+01";"2017-03-31T10:45:53+01";"105.56";"102,36";"";"5|104.56,10|103.27";"2017-02-22T10:45:53+01";"2017-03-31T10:45:53+01";"190.23";"175,36";"";"5|182.58,10|181.27";"15";"2";"The product does not exist"
As described above, this response give us detailed report of the SKUs and the actual SKUs errors are in the “error-message“ which we store in the Product Account >Update Item Error
Additional Information:
For this integration we will need to make sure the protect flags are working as expected:
Any Triggers or Validations that are not specifically mentioned, changed or removed from the above mentioned scope should follow the standard flor as per the Link Here abstraction.
(v1.1) As the purpose of this flow is only for the zero stock we have 2 options:
- End Item is on Pending - no matter what else is happening this is a trigger for sending quantity update with 0. This is the case for the Zero stock flow or for a full offer update too. If a product is picked for an update and End Item is on Pending we should send quantity 0 no matter of the value in Hemi or protection or closed flags
- The trigger is Update Quantity = Pending + Quantity = 0
- Item Closed flag - as everywhere else this should completely stop any updates so such products should not be sent
- Protect Quantity = yes - when it comes to the Zero Stock where we are looking just for the quantity updates this should also skip this product (same as for the normal Stock Update as described here: Laredoute Offer Stock Update )
- Protect the whole item should NOT block stock updates