allegro / allegro-api

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

Questions about uploading the Offer API #6394

Closed CrazyTaolt closed 1 year ago

CrazyTaolt commented 1 year ago

Hello, Aellgro Developer,

I heard that the interface for uploading offers will be cancelled in 2023. URL:https://developer.allegro.pl/documentation#operation/createOfferUsingPOST I would like to ask if it is true?

If this API is cancelled, which API should I use instead?

thank you!

Zero

AureliuszBrussy commented 1 year ago

Yes, it is true - we plan to completely disable resources (on January 1, 2024) for creating and editing offers from the /sale/offers and /sale/offers/{offerId} paths. The /sale/product-offers resource will be the only one to allow listing and editing offers.

You should start using:

You can find more information in our news.

CrazyTaolt commented 1 year ago

Is there a request example for this API?The example in the document seems incomplete. POST /sale/product-offers

AureliuszBrussy commented 1 year ago

Check our guide if you need more info about this endpoint.

CrazyTaolt commented 1 year ago

OK,Thank you! Is there an alternative interface for the GetOffers interface?

AureliuszBrussy commented 1 year ago

@CrazyTaolt no, there is no alternative endpoint for GET /sale/offers. We do not plan to shut down GET /sale/offers.

CrazyTaolt commented 1 year ago

OK,Thank you! image

If the category does not allow creation of products(offersWithProductPublicationEnabled=false,productCreationEnabled=false), how can I upload an offer?

For example: Category Id:111718,111719,111720,111721,111722.....

AureliuszBrussy commented 1 year ago

You can create offers without creating new products, as well as without linking a product to an offer. POST /sale/product-offers interface will also handle such case.

CrazyTaolt commented 1 year ago

OK, Thank you!

CrazyTaolt commented 1 year ago

When creating an offer using the category that prohibits the creation of products, I do not pass the productSet parameter, but an error is reported.

request: {"id":null,"name":"Buty LED Swiecące Dziecięce Frozen","productSet":null,"category":{"id":"88309"},"images":["https://a.allegroimg.com/original/115c30/e6140b934a1ba4697b783143709b","https://a.allegroimg.com/original/1199db/904e395c42cb84decaea9e386d7c","https://a.allegroimg.com/original/1171c8/d92313214bf398a1c79b9362786e","https://a.allegroimg.com/original/117a01/0c4b5a6340beb95b61688d41cc8d","https://a.allegroimg.com/original/114345/1247d11f4ef698b2ce4bc344b3eb","https://a.allegroimg.com/original/115115/27d49539413a9e9492d414adddb8"],"parameters":[{"id":"11323","name":"Stan","requiredForProduct":false,"describesProduct":false,"valuesIds":["11323_1"],"values":null,"rangeValue":null}],"description":{"sections":[{"items":[{"type":"TEXT","content":"

Dziecięce buty ze świecącymi na kolorowo ledami, które zachwycą każdego malucha.Dzięki światełkom oraz wysokiej jakości tworzywa materiału, obuwie wygląda atrakcyjnie również wtedy, gdy nie są włączone ledy.

Długość stopy:

Rozmiar 22 = 13.5 CM ,

Rozmiar 23 = 14 CM ,

Rozmiar 24 = 14.5 CM ,

Rozmiar 25 = 15 CM ,

Rozmiar 26 = 15.5 CM ,

Rozmiar 27 = 16 CM ,

Rozmiar 28 = 16.6 CM ,

Rozmiar 29 = 17.2 CM ,

Rozmiar 30 = 17.8 CM ,

Rozmiar 31 = 18.5 CM

","url":null}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/1171c8/d92313214bf398a1c79b9362786e"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/117a01/0c4b5a6340beb95b61688d41cc8d"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/114345/1247d11f4ef698b2ce4bc344b3eb"}]}]},"sellingMode":{"format":"BUY_NOW","price":{"amount":104.99,"currency":"PLN"},"minimalPrice":{"amount":104.99,"currency":"PLN"},"startingPrice":{"amount":104.99,"currency":"PLN"}},"stock":{"available":100,"unit":"UNIT","sold":0},"delivery":{"shippingRates":{"id":"1ff001c0-9d4d-4020-bc98-bb59617f885f"},"additionalInfo":"","handlingTime":"P3D","shipmentDate":null},"external":{"id":"SKU27110-PINK- 25 cm"},"afterSalesServices":{"impliedWarranty":{"id":"ea9dfa43-ab62-4e35-b4ef-47abea1c20a4"},"returnPolicy":{"id":"c6507c63-5832-4f2e-b32a-d17cf8778bf8"},"warranty":null},"payments":{"invoice":"NO_INVOICE"},"location":{"countryCode":"CN","province":"fujiansheng","city":"xiamenshi","postCode":"361000"},"publication":null,"tax":null,"sizeTable":null,"discounts":null,"customParameters":null}

response: {"errors":[{"code":"RemoveProductException","message":"Unprocessable Entity","details":null,"path":"productSet[0].product","userMessage":"Unable to unlink product from offer."}]}

CrazyTaolt commented 1 year ago

Can you give an example of calling API from the category where product creation is prohibited?

AureliuszBrussy commented 1 year ago

You simply have to distinguish between product and offer parameters. Product parameters are the parameters you need to pass in the productSet.product[].parameters structure. You will recognize them with parameters[].options.describesProduct = true flag on GET /sale/categories/{categoryId}/parameters. You proceed exactly as in the category where you can create a product.

Sample payload for category 88309 (Sandbox):

{
    "name": "Test offer",
    "productSet": [
        {
            "quantity": {
                "value": 1
            },
            "product": {
                "category": {
                    "id": "88309"
                },
                "parameters": [
                    {
                        "id": "7174",
                        "valuesIds": [
                            "7174_400"
                        ],
                        "values": [
                            "TestBrand"
                        ],
                        "rangeValue": null
                    },
                    {
                        "id": "6952",
                        "valuesIds": [],
                        "values": [
                            "12"
                        ],
                        "rangeValue": null
                    },
                    {
                        "id": "205826",
                        "valuesIds": [
                            "205826_1041839"
                        ],
                        "values": [],
                        "rangeValue": null
                    }
                ]
            }
        }
    ],
    "parameters": [
        {
            "id": "11323",
            "name": "Stan",
            "values": [
                "Nowy"
            ],
            "valuesIds": [
                "11323_1"
            ],
            "rangeValue": null
        }
    ],
    "images": [
        "https://a.allegroimg.allegrosandbox.pl/original/11b2ae/a0c2ae3d407e8cd8f63388b0c486"
    ],
    "publication": {
        "status": "ACTIVE"
    },
    "afterSalesServices": {
        "impliedWarranty": {
            "name": "default"
        },
        "returnPolicy": {
            "name": "default"
        },
        "warranty": null
    },
    "payments": {
        "invoice": "NO_INVOICE"
    },
    "sellingMode": {
        "format": "BUY_NOW",
        "price": {
            "amount": "100.00",
            "currency": "PLN"
        },
        "startingPrice": null,
        "minimalPrice": null
    },
    "stock": {
        "available": 12,
        "unit": "UNIT"
    },
    "location": {
        "countryCode": "PL",
        "province": "WIELKOPOLSKIE",
        "city": "Poznań",
        "postCode": "66-166"
    },
    "delivery": {
        "shippingRates": {
            "name": "default"
        },
        "handlingTime": "PT48H",
        "additionalInfo": "",
        "shipmentDate": null
    },
    "description": {
        "sections": [
            {
                "items": [
                    {
                        "type": "TEXT",
                        "content": "<p>Test</p>"
                    }
                ]
            }
        ]
    },
    "external": null,
    "tax": null,
    "sizeTable": null,
    "discounts": {
        "wholesalePriceList": null
    },
    "contact": null,
    "fundraisingCampaign": null,
    "messageToSellerSettings": {
        "mode": "OPTIONAL"
    }
}
CrazyTaolt commented 1 year ago

I used the category: 12181

request:

{"id":null,"name":"4*5M WOJSKOWA SIATKA MASKUJĄCA MORO KA 12156","productSet":[{"product":{"name":"4*5M WOJSKOWA SIATKA MASKUJĄCA MORO KA 12156","category":{"id":"12181"},"id":"","parameters":[{"id":"4713","name":"oryginał / kopia","requiredForProduct":true,"describesProduct":true,"valuesIds":["4713_2"],"values":null,"rangeValue":null}],"images":["https://a.allegroimg.com/original/11c045/304071fa4bafb8cc8666ccb60c0c","https://a.allegroimg.com/original/11499a/2e2cef8742068278cc46b43ea4a2","https://a.allegroimg.com/original/1134ee/531a47264b84908fccd70b799bf4","https://a.allegroimg.com/original/11f1e1/8059409942c8bc9ec56a46f0c601","https://a.allegroimg.com/original/113738/4f0ccc23406db14d485a0b255c83","https://a.allegroimg.com/original/1139a8/737b443e4c29b47243f87dc24653","https://a.allegroimg.com/original/116aae/089f09a14543b5bb4859e20e5829","https://a.allegroimg.com/original/115806/bc76bb5349c3a5181cfda9d1bc04","https://a.allegroimg.com/original/117092/0adef1884aa090748e16f1299eeb","https://a.allegroimg.com/original/116c0a/76a6826d482f89a45e326a9239e7"]},"quantity":{"value":500}}],"category":{"id":"12181"},"images":["https://a.allegroimg.com/original/11c045/304071fa4bafb8cc8666ccb60c0c","https://a.allegroimg.com/original/11499a/2e2cef8742068278cc46b43ea4a2","https://a.allegroimg.com/original/1134ee/531a47264b84908fccd70b799bf4","https://a.allegroimg.com/original/11f1e1/8059409942c8bc9ec56a46f0c601","https://a.allegroimg.com/original/113738/4f0ccc23406db14d485a0b255c83","https://a.allegroimg.com/original/1139a8/737b443e4c29b47243f87dc24653","https://a.allegroimg.com/original/116aae/089f09a14543b5bb4859e20e5829","https://a.allegroimg.com/original/115806/bc76bb5349c3a5181cfda9d1bc04","https://a.allegroimg.com/original/117092/0adef1884aa090748e16f1299eeb","https://a.allegroimg.com/original/116c0a/76a6826d482f89a45e326a9239e7"],"parameters":[],"description":{"sections":[{"items":[{"type":"TEXT","content":"<p>Funkcja:</p><p>-100% nowy i wysokiej jakości.</p><p>-Kamuflażowa kamuflażowa dżungla bez liny.</p><p>- Kamuflaż jest bardzo skutecznym, realistycznym efektem i wszechstronnym.</p><p>Główna rola i cele:</p><p>Szkolenie wojskowe w kamuflażu, instalacje wojskowe radar przeciw podczerwieni.</p><p>Firma zajmująca się nieruchomościami, lotnicza fotografia lotnicza.</p><p>Nielegalne budynki i fotografia roślinna z satelity.</p><p>Parkingi i inne miejsca publiczne cienią krajobraz.</p><p>Pokrywa górska i zielona, pokrywa śmieci.</p><p>Miłośnicy obserwowania ptaków muszą strzelać w dal i w kontakcie z kamuflażem ptaków.</p><p>Kamuflaż snajperski i użycie.</p><p>Dekoracyjne architektura krajobrazu (parki tematyczne, wystawy, baza filmowa, zagospodarowanie terenu, symulacja pola CS, dekoracja hotelu, dekoracja przemysłowa, dekoracja domu itp.), Kolor tła imitacji i inne aspekty.</p><p>Dane techniczne:</p><p>Nazwa produktu: Camo Net</p><p>Materiał: tkanina poliestrowa Oxford</p><p>Kolor: jako pokaz obrazu</p><h2>Rozmiar: około 4 x 5 M.</h2><p>Paczka zawiera:</p><p>1x Siatka kamuflażowa</p><p>Uwagi:</p><p>1. Rzeczywisty kolor może nieznacznie różnić się od obrazu ze względu na różne efekty monitora i oświetlenia.</p><p>2. Proszę pozwolić 1-3 mm odchylenie ze względu na pomiarze ręcznym.</p>","url":null}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/116aae/089f09a14543b5bb4859e20e5829"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/115806/bc76bb5349c3a5181cfda9d1bc04"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/117092/0adef1884aa090748e16f1299eeb"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/116c0a/76a6826d482f89a45e326a9239e7"}]}]},"sellingMode":{"format":"BUY_NOW","price":{"amount":119.00,"currency":"PLN"},"minimalPrice":{"amount":119.00,"currency":"PLN"},"startingPrice":{"amount":119.00,"currency":"PLN"}},"stock":{"available":500,"unit":"UNIT","sold":0},"delivery":{"shippingRates":{"id":"8ecb5e01-cc96-428c-82bd-7b414aede340"},"additionalInfo":"","handlingTime":"P4D","shipmentDate":null},"external":{"id":"SKU32296-kopia / replika"},"afterSalesServices":{"impliedWarranty":{"id":"f91fe8cc-1c4a-4860-b7ee-ec4939e0c553"},"returnPolicy":{"id":"561b9b6f-cb32-4f15-aa32-37f739e2259a"},"warranty":null},"payments":{"invoice":"NO_INVOICE"},"location":{"countryCode":"HK","province":"Hongkong","city":"Hongkong","postCode":"000000"},"publication":null,"tax":null,"sizeTable":null,"discounts":null,"customParameters":null}

response: {"errors":[{"code":"ProductSetOfferWithoutIdsException","message":"Unprocessable Entity","details":null,"path":"productSet.product.id","userMessage":"Unable to create a product set containing non-product items. Make sure that all set elements belong to categories that support creating products."}]}

CrazyTaolt commented 1 year ago

The parameters of this category are as follows: offersWithProductPublicationEnabled=false productCreationEnabled=false

This category prohibits the creation of product, but in the previous API (POST /sale/offers), it was allowed to create an offer separately. How should I pass parameters to this category now?

AureliuszBrussy commented 1 year ago

I just tried a request to list in this category and was able to list successfully. My payload:

{
    "productSet": [
        {
            "product": {
                "name": "4*5M WOJSKOWA SIATKA MASKUJĄCA MORO KA 12156",
                "category": {
                    "id": "12181"
                },
                "parameters": [
                    {
                        "id": "4713",
                        "valuesIds": [
                            "4713_1"
                        ],
                        "values": [],
                        "rangeValue": null
                    }
                ]
            }
        }
    ],
    "images": [
        "https://a.allegroimg.allegrosandbox.pl/original/11b2ae/a0c2ae3d407e8cd8f63388b0c486"
    ],
    "afterSalesServices": {
        "impliedWarranty": {
            "name": "default"
        },
        "returnPolicy": {
            "name": "default"
        },
        "warranty": null
    },
    "payments": {
        "invoice": "NO_INVOICE"
    },
    "sellingMode": {
        "format": "BUY_NOW",
        "price": {
            "amount": "100.00",
            "currency": "PLN"
        },
        "startingPrice": null,
        "minimalPrice": null
    },
    "stock": {
        "available": 200,
        "unit": "UNIT"
    },
    "location": {
        "countryCode": "PL",
        "province": "WIELKOPOLSKIE",
        "city": "Poznań",
        "postCode": "66-166"
    },
    "delivery": {
        "shippingRates": {
            "name": "default"
        },
        "handlingTime": "PT48H",
        "additionalInfo": "",
        "shipmentDate": null
    },
    "description": {
        "sections": [
            {
                "items": [
                    {
                        "type": "TEXT",
                        "content": "<p>Test</p>"
                    }
                ]
            }
        ]
    },
    "external": null,
    "tax": null,
    "sizeTable": null,
    "discounts": {
        "wholesalePriceList": null
    },
    "contact": null,
    "fundraisingCampaign": null,
    "messageToSellerSettings": {
        "mode": "OPTIONAL"
    },
    "attachments": [],
    "b2b": null,
    "additionalServices": null,
    "compatibilityList": null,
    "publication": {
        "status": "ACTIVE"
    }
}
}

Change the value of the product.quantity.value field to 1 or do not pass this field in these cases. In this field, you define the number of products in the set, not the number of products in stock.

CrazyTaolt commented 1 year ago

Hello, Aellgro Developer, I encountered a strange problem in calling the API. I filled in the product parameter [length] according to the correct requirements, but the API always prompts that the parameter [length] is wrong.

category:1495 requestBody: {"id":null,"name":"BIG SCARF WARM FRINGES ELEGANT Modny damski","productSet":[{"product":{"name":"BIG SCARF WARM FRINGES ELEGANT Modny damski","category":{"id":"1495"},"id":"","parameters":[{"id":"128989","name":"Rodzaj","requiredForProduct":true,"describesProduct":true,"valuesIds":["128989_1"],"values":null,"rangeValue":null},{"id":"15851","name":"Płeć","requiredForProduct":false,"describesProduct":true,"valuesIds":["15851_1"],"values":null,"rangeValue":null},{"id":"203885","name":"Materiał dominujący","requiredForProduct":true,"describesProduct":true,"valuesIds":["203885_842089"],"values":null,"rangeValue":null},{"id":"224017","name":"Kod producenta","requiredForProduct":false,"describesProduct":true,"valuesIds":null,"values":["caibo"],"rangeValue":null},{"id":"2977","name":"Długość","requiredForProduct":true,"describesProduct":true,"valuesIds":null,"values":["185"],"rangeValue":null},{"id":"3766","name":"Wzór dominujący","requiredForProduct":false,"describesProduct":true,"valuesIds":["3766_6"],"values":null,"rangeValue":null},{"id":"3786","name":"Marka","requiredForProduct":true,"describesProduct":true,"valuesIds":["3786_85"],"values":["caibo"],"rangeValue":null},{"id":"451","name":"Kolor","requiredForProduct":true,"describesProduct":true,"valuesIds":["451_2048"],"values":null,"rangeValue":null},{"id":"225693","name":"EAN","requiredForProduct":false,"describesProduct":true,"valuesIds":null,"values":["6975648972467"],"rangeValue":null}],"images":["https://a.allegroimg.com/original/112354/fea17fef4f168a70eecccdc73b5c","https://a.allegroimg.com/original/11e308/cd952f5a42bbacfecd0f91d0be17","https://a.allegroimg.com/original/11754f/596066b34c14b513ad71bc3590de","https://a.allegroimg.com/original/1166b5/cadf4e474ceeb756c5acd709b44a","https://a.allegroimg.com/original/11371d/2796c9f546679eb0423460842ecf","https://a.allegroimg.com/original/1126f9/7162c9a74c27a10ecba7ef5c6705"]},"quantity":{"value":1}}],"category":{"id":"1495"},"images":["https://a.allegroimg.com/original/112354/fea17fef4f168a70eecccdc73b5c","https://a.allegroimg.com/original/11e308/cd952f5a42bbacfecd0f91d0be17","https://a.allegroimg.com/original/11754f/596066b34c14b513ad71bc3590de","https://a.allegroimg.com/original/1166b5/cadf4e474ceeb756c5acd709b44a","https://a.allegroimg.com/original/11371d/2796c9f546679eb0423460842ecf","https://a.allegroimg.com/original/1126f9/7162c9a74c27a10ecba7ef5c6705"],"parameters":[{"id":"11323","name":"Stan","requiredForProduct":false,"describesProduct":false,"valuesIds":["11323_1"],"values":null,"rangeValue":null}],"description":{"sections":[{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/1166b5/cadf4e474ceeb756c5acd709b44a"},{"type":"TEXT","content":"<p>Dimensions: 185cm x 65cm</p><p>Beautiful, large scarf with fringes, suitable for many styles. Classic and timeless. Modeled on global trends.</p><p>The most important features:</p><p>Beautiful activity with vivid and pastel colors.</p><p>High-quality material.</p><p>It fits very nicely. The material \"is fluffy, pleasant to the touch, THICK AND WARM.</p><p>A great gift.</p>","url":null}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/11754f/596066b34c14b513ad71bc3590de"},{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/11371d/2796c9f546679eb0423460842ecf"}]},{"items":[{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/1126f9/7162c9a74c27a10ecba7ef5c6705"},{"type":"IMAGE","content":null,"url":"https://a.allegroimg.com/original/1166b5/cadf4e474ceeb756c5acd709b44a"}]}]},"sellingMode":{"format":"BUY_NOW","price":{"amount":49.99,"currency":"PLN"},"minimalPrice":{"amount":49.99,"currency":"PLN"},"startingPrice":{"amount":49.99,"currency":"PLN"}},"stock":{"available":0,"unit":"UNIT","sold":0},"delivery":{"shippingRates":{"id":"2f3f7060-e279-4266-934a-2981c7077627"},"additionalInfo":"","handlingTime":"PT24H","shipmentDate":null},"external":{"id":"SCARF 2467-Pomarańczowy"},"afterSalesServices":{"impliedWarranty":{"id":"36a16aa9-7a25-4961-92c3-8d89fe8033b5"},"returnPolicy":{"id":"3b2a7843-d848-470f-a63e-f7b2f23f7b85"},"warranty":{"id":"cff5a12e-aeba-4012-a100-a243daf07be6"}},"payments":{"invoice":"VAT"},"location":{"countryCode":"PL","province":"MAZOWIECKIE","city":"Adamów 50","postCode":"05-825"},"publication":null,"tax":{"id":"b763d782-572a-47db-8752-8b2cb32b3d0a","rate":"23.00","subject":null,"exemption":null},"sizeTable":null,"discounts":null,"customParameters":null}

response:{"errors":[{"code":"ProductValidationException","message":"Unable to create product without proper values in all required parameters: [Długość] in category: 1495","details":null,"path":"productSet[0].product","userMessage":"Nie można stworzyć produktu bez podania poprawnych wartości wszystkich parametrów wymaganych: [Długość]"}]}

Related parameters image

MaciejFrackowiak commented 1 year ago

This is our error with the parameter - we are working to eliminate it.

CrazyTaolt commented 1 year ago

OK, please let me know after you solve this problem

CrazyTaolt commented 1 year ago

Hello, Aellgro Developer, I would like to ask if there is any update on this issue. Thank you!

MaciejFrackowiak commented 1 year ago

I see the task is not finished yet, but I sent a request with data from your template a minute ago and the offer was listed.

CrazyTaolt commented 1 year ago

OK, thank you very much for your reply! I asked them to try again.