allegro / allegro-api

Issue tracker and wiki for Allegro REST API
https://developer.allegro.pl/
213 stars 39 forks source link

Product offer update #8984

Open PupuCz opened 4 months ago

PupuCz commented 4 months ago

We are integrating Allegro through api for one of our customers and now we encountered a problem where Allegro allows us to create an offer but then restricts us from updating it because of incomplete offer data. How should we handle this scenario?

It happened for example with this product: https://allegro.cz/nabidka/ukazatel-vetru-109204-bilo-cerveny-100-cm-14891782978?utm_feed=712e6653-4749-4512-b084-b6e297fc9e0b&utm_source=google&utm_medium=cpc&utm_campaign=CZ%3ESport%3EOther%3E3P%3EPMAX&ev_campaign_id=20040875755&gad_source=1&gclid=Cj0KCQjwir2xBhC_ARIsAMTXk856SZf9YSV5UsXctliKMi_5A9xP5BMSkydY3x6YS0VK3VUG7T39N8kaAl9dEALw_wcB

Thank you

PrzemyslawLukanowski commented 4 months ago

Hello, the last error message for this offer is "Missing required parameters: 209202". The product that is connected with your offer does not have this parameter filled in, you need to provide it in your request, along with other parameters. Your request can look as follows:

{
    "productSet": [
        {
            "product": {
                "id": "16169624-e6e4-47e6-9497-d12b9ad95651",
                "parameters": [
                    {
                        "id": "224017",
                        "name": "Kód výrobce",
                        "values": [
                            "109204"
                        ],
                        "valuesIds": null,
                        "rangeValue": null
                    },
                    {
                        "id": "248922",
                        "name": "Značka",
                        "values": [
                            "Invento"
                        ],
                        "valuesIds": [
                            "248922_964746"
                        ],
                        "rangeValue": null
                    },
                    {
                        "id": "17448",
                        "name": "Hmotnost (s balením)",
                        "values": [
                            "0"
                        ],
                        "valuesIds": null,
                        "rangeValue": null
                    },
                    {
                        "id": "237206",
                        "name": "Model",
                        "values": [
                            "109204"
                        ],
                        "valuesIds": null,
                        "rangeValue": null
                    },
                    {
                        "id": "225693",
                        "name": "EAN (GTIN)",
                        "values": [
                            "4031169213303"
                        ],
                        "valuesIds": null,
                        "rangeValue": null
                    },
                    {
                        "id": "209202",                      // missing parameter with sample value added
                        "name": "Zasilanie",
                        "values": [
                            "akumulatorowe"
                        ],
                        "valuesIds": [
                            "209202_1769478"
                        ],
                        "rangeValue": null
                    }
                ]
            },
            "quantity": {
                "value": 1
            }
        }
    ],
    "stock": {
        "available": 0,
        "unit": "UNIT"
    },
    "afterSalesServices": {
        "returnPolicy": {}
    },
    "sellingMode": {
        "format": "BUY_NOW",
        "price": {
            "amount": "474.00",
            "currency": "CZK"
        }
    },
    "external": {
        "id": "1660"
    },
    "taxSettings": {
        "rates": [
            {
                "rate": "21.00",
                "countryCode": "CZ"
            }
        ]
    }
}
PupuCz commented 4 months ago

I understand the error. But for this customer we are currently using only product data that already exist in Allegro, because we don't have parameter data available yet. The problem is that Allegro let us create the offer, but we can't update it without providing the missing parameters. Is expected behaviour? Is there a way to ask the API to deny offer creation if there is data missing?

I basically need to prevent our integration from getting into this state where we have offers in Allegro that we can't update without providing missing product data.

Thank you.

PrzemyslawLukanowski commented 4 months ago

The problem is that Allegro let us create the offer, but we can't update it without providing the missing parameters. Is expected behaviour?

The case with this specific offer is that we created it successfully, there were no missing parameters, but in the meantime the category in the offer has changed (we don't have logs anymore for this operation, so it's hard to say what was the source of this change). Right now, the category in the offer is 148212 and the category of the product is 13585. If you try to list this product in the category 148212, we will return the missing parameter error - cause parameter 209202 is required in the category 148212. We did not return this error in your scenario, cause, as I presume, it was published in the product category (13585), where this parameter was not oblige.

I basically need to prevent our integration from getting into this state where we have offers in Allegro that we can't update without providing missing product data.

To distinguish offers with incomplete data you can also compare parameters in your offers with the parameters required in the given category by using GET /sale/categories/{categoryID}/parameters. In the "requiredForProduct" field we return information whether this parameter is required. If the parameter marked as "true" is not included in the offer data, that is an information you should provide such parameter.

PupuCz commented 4 months ago

Ohh ok, sop if I understand it correctly in our scenario where we don't have parameter date the easiest solution would be to delete our offer and list it again once product data in Allegro are complete?

Thank you

PrzemyslawLukanowski commented 4 months ago

Yes - in case when you list an offer in a product category and a product has all of the required parameters. For example, right now you can list a product from the offer mentioned above, without any errors, but you need to list it in category 148212 (from the product data, so you don't need to indicate the category directly, we will take it based on product data), not 13585 (the category, in which, for some reason, the offer is right now).

stale[bot] commented 3 months ago

W tym wątku nie pojawiła się żadna nowa odpowiedź w ciągu 7 dni, dlatego automatycznie oznaczamy go jako przeterminowany. Jeśli w ciągu kolejnych 7 dni nie pojawi się żadna odpowiedź, wątek zostanie zamknięty. Dziękujemy za zaangażowanie w dyskusję i zachęcamy Cię do wypełnienia ankiety dotyczącej naszego wsparcia na forum.


There was no new reply in this thread within 7 days, therefore, we automatically marked it as expired. If no response is received within the next 7 days, this thread will be closed. Thank you for engaging in the discussion. We encourage you to complete our forum support survey.