allegro / allegro-api

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

Offer Variants #5744

Closed dmsmatrix closed 2 years ago

dmsmatrix commented 2 years ago

How to check added offer variants on Allegro site.

trace-id: 5701426d1a371dee

Lukasz-Zurek commented 2 years ago

Offers: 12219208098, 12219208408 are already in variant set called: "Testswapnil6".

Using GET /sale/offer-variants you can retrieve multi-variant offers you created using current account.

dmsmatrix commented 2 years ago

Thanks for the information.

[ 'server_output' => 'HTTP/1.1 100 Continue

HTTP/1.1 422 Unprocessable Entity expires: 0 cache-control: no-cache, no-store, max-age=0, must-revalidate x-xss-protection: 1; mode=block pragma: no-cache x-frame-options: DENY trace-id: 92a28f9da5329f60 date: Tue, 31 May 2022 16:32:29 GMT x-content-type-options: nosniff strict-transport-security: max-age=31536000 ; includeSubDomains content-type: application/json content-length: 290

{"errors":[{"code":"ConstraintViolationException.SizeTableInAllowedCategory","message":"Size table is not allowed in selected category.","details":"ConstraintViolationException.SizeTableInAllowedCategory","path":"sizeTable","userMessage":"Size table is not allowed in selected category."}]}', 'headers' => [ 'expires' => ' 0', 'cache-control' => ' no-cache, no-store, max-age=0, must-revalidate', 'x-xss-protection' => ' 1; mode=block', 'pragma' => ' no-cache', 'x-frame-options' => ' DENY', 'trace-id' => ' 92a28f9da5329f60', 'date' => ' Tue, 31 May 2022 16:32:29 GMT', 'x-content-type-options' => ' nosniff', 'strict-transport-security' => ' max-age=31536000 ; includeSubDomains', 'content-type' => ' application/json', 'content-length' => ' 290' ], 'responseBody' => '{"errors":[{"code":"ConstraintViolationException.SizeTableInAllowedCategory","message":"Size table is not allowed in selected category.","details":"ConstraintViolationException.SizeTableInAllowedCategory","path":"sizeTable","userMessage":"Size table is not allowed in selected category."}]}' ]

Can you please explain why this error occurs? Where can I get the full categories list in which Size Table is allowed? Is there any available API for the same?

dmsmatrix commented 2 years ago

"endpoint" : "PATCH https://api.allegro.pl/sale/product-offers/12223580110", "request" : {"afterSalesServices":{"returnPolicy":{"id":"8757d063-c1dd-4d50-9254-884282ebab5e","name":"Test Return 2"},"impliedWarranty":{"id":"67aa6cfa-07f0-422b-87de-eb485299c9cc","name":"Test Complaint 1"},"warranty":{"id":"d5a3dab6-2f90-47d7-8000-fbeda408c8f7","name":"Test Warrenty 1"}},"delivery":{"handlingTime":"PT24H","shipmentDate":"2022-06-01T21:50:00Z","additionalInfo":"TESTSWAPNIL82","shippingRates":{"id":"16d71a34-f8d7-4eb7-9826-99a841afeb43","name":"Test Delivery Price 2"}},"publication":{"startingAt":"2022-06-01T21:45:00Z","duration":null,"republish":true},"payments":{"invoice":"VAT"},"messageToSellerSettings":{"mode":"HIDDEN"},"sizeTable":{"id":"70145102-d75e-11ec-8b88-b02628480130","name":"Test Size 1"},"parameters":[{"id":"11323","name":"Condition","valuesIds":["11323_1"]}],"productSet":[{"product":{"parameters":[{"id":"225693","name":"EAN","values":["0735850162423"]},{"id":"213194","name":"Additional Features","valuesIds":["213194_1","213194_2"]},{"id":"226290","name":"Brand","valuesIds":["226290_314902"]},{"id":"237206","name":"Model","values":["TESTSWAPNIL82"]},{"id":"224017","name":"Producent code","values":["TESTSWAPNIL82"]},{"id":"206910","name":"Material","valuesIds":["206910_228838"]},{"id":"206338","name":"Volume","values":["2"]},{"id":"205826","name":"Dominant color","valuesIds":["205826_1041839"]},{"id":"203897","name":"Height","values":["2"]},{"id":"206398","name":"Diameter","values":["2"]},{"id":"206466","name":"Weight","values":["2"]},{"id":"17448","name":"Weight (with packaging)","values":["2"]}],"name":"Testswapnil8","category":{"id":"148828"},"images":["https://dmsmatrix.net/direct/images/62963f9b8e305153493d0603.jpg"]},"quantity":{"value":1}}],"name":"Testswapnil8","description":{"sections":[{"items":[{"type":"TEXT","content":"<p>TESTSWAPNIL8</p>"}]}]},"category":{"id":"148828"},"images":["https://dmsmatrix.net/direct/images/62963f9b8e305153493d0603.jpg"],"sellingMode":{"price":{"amount":"1.00","currency":"PLN"},"format":"BUY_NOW"},"stock":{"available":1,"unit":"UNIT"},"external":{"id":"TESTSWAPNIL8"}}

"headers" : {"expires":" 0","cache-control":" no-cache, no-store, max-age=0, must-revalidate","x-xss-protection":" 1; mode=block","pragma":" no-cache","x-frame-options":" DENY","trace-id":" c16105f4e2ddda08","date":" Tue, 31 May 2022 16:30:29 GMT","x-content-type-options":" nosniff","strict-transport-security":" max-age=31536000 ; includeSubDomains","content-type":" application/json","content-length":" 1112"}

"response" : {"errors":[{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterBrandvalueadidas(226290_314902)does not match the existing parameter value4F(226290_314942)."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Volume'(206338) value (2) does not match the existing parameter value (1)","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterVolumevalue2does not match the existing parameter value1."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Dominant color'(205826) value (beiges and browns(205826_1041839)) does not match the existing parameter value (clear(205826_225030))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterDominant colorvaluebeiges and browns(205826_1041839)does not match the existing parameter valueclear(205826_225030)."}]}

Why am I getting these errors after changing the values of the above-mentioned parameters? It was different at the time of Create Offer. How can I consider or mark some parameters of category as unchange parameters after its offer create, is there API for the same

Lukasz-Zurek commented 2 years ago

[...] 'responseBody' => '{"errors":[{"code":"ConstraintViolationException.SizeTableInAllowedCategory","message":"Size table is not allowed in selected category.","details":"ConstraintViolationException.SizeTableInAllowedCategory","path":"sizeTable","userMessage":"Size table is not allowed in selected category."}]}' ]

Can you please explain why this error occurs? Where can I get the full categories list in which Size Table is allowed? Is there any available API for the same?

You provide:

...
   "sizeTable": {
      "id": "70145102-d75e-11ec-8b88-b02628480130",
      "name": "Test Size 1"
   },
...

in the "category.id": "148828" in which size table is not allowed.

Here you will find the list of the categories where you are allowed to provide size table.

Lukasz-Zurek commented 2 years ago

[...]

"response" : {"errors":[{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterBrandvalueadidas(226290_314902)does not match the existing parameter value4F(226290_314942)."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Volume'(206338) value (2) does not match the existing parameter value (1)","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterVolumevalue2does not match the existing parameter value1."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Dominant color'(205826) value (beiges and browns(205826_1041839)) does not match the existing parameter value (clear(205826_225030))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterDominant colorvaluebeiges and browns(205826_1041839)does not match the existing parameter valueclear(205826_225030)."}]}

Why am I getting these errors after changing the values of the above-mentioned parameters? It was different at the time of Create Offer. How can I consider or mark some parameters of category as unchange parameters after its offer create, is there API for the same

I see that you created your product on May 31, 2022 when you created an offer (but it was not listed because of the validation errors), at 18:21:36. Before you have tried to edit it on the same day, at 18:30:29.

You have already filled this product with a different data than you try to provide via PATCH /sale/product-offers/12223580110. I suggest not to provide them at all (or provide values which do match the existing parameters in product database) while editing (or listing) an offer, because you won't be able to change these parameters in the product anyway. This is why you receive an error because for example: parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942)).

If you create an offer via POST /sale/product-offers and you provide needed parameters - we create a product (in the case where you do not provide a product.id) which will be assigned to the offer that you created and listed. So if you want to edit it via PATCH /sale/product-offers/{offerId} you have to remember to provide proper parameters. You can always check the product data (assigned to the offer) via GET /sale/products/{productId}.

dmsmatrix commented 2 years ago

"endpoint" : "POST https://api.allegro.pl/sale/product-offers"

"request" : {"afterSalesServices":{"returnPolicy":{"id":"5c1be946-8ac4-4636-9ca1-706f828382f7","name":"Test Return 1"},"impliedWarranty":{"id":"67aa6cfa-07f0-422b-87de-eb485299c9cc","name":"Test Complaint 1"}},"delivery":{"handlingTime":"PT0S","shippingRates":{"id":"cfbf12f5-602e-4057-97cb-9a2aa4ccd99c","name":"Test Delivery Price 1"}},"publication":{"startingAt":"2022-06-02T19:40:00.000Z","duration":null,"status":"ACTIVE","republish":true},"payments":{"invoice":"NO_INVOICE"},"messageToSellerSettings":{"mode":"OPTIONAL"},"parameters":[{"id":"11323","name":"Condition","valuesIds":["11323_2"]}],"productSet":[{"product":{"parameters":[{"id":"213194","name":"Additional Features","valuesIds":["213194_1"]},{"id":"226290","name":"Brand","valuesIds":["226290_314942"]},{"id":"237206","name":"Model","values":["TESTSWAPNIL1"]},{"id":"224017","name":"Producent code","values":["TESTSWAPNIL1"]},{"id":"206910","name":"Material","valuesIds":["206910_228834"]},{"id":"206338","name":"Volume","values":["1"]},{"id":"205826","name":"Dominant color","valuesIds":["205826_225030"]}],"name":"Testswapnil1","category":{"id":"148828"},"images":["https://dmsmatrix.net/direct/images/6297914cba802166c440e509.jpg"]},"quantity":{"value":1}}],"name":"Testswapnil1","description":{"sections":[{"items":[{"type":"TEXT","content":"<p>TESTSWAPNIL1</p>"}]}]},"category":{"id":"148828"},"images":["https://dmsmatrix.net/direct/images/6297914cba802166c440e509.jpg"],"sellingMode":{"price":{"amount":"1000.00","currency":"PLN"},"format":"BUY_NOW"},"stock":{"available":1,"unit":"UNIT"},"external":{"id":"TESTSWAPNIL1"}}

"headers" : {"expires":" 0","cache-control":" no-cache, no-store, max-age=0, must-revalidate","x-xss-protection":" 1; mode=block","pragma":" no-cache","x-frame-options":" DENY","trace-id":" 237886a664a45d21","date":" Wed, 01 Jun 2022 16:19:55 GMT","x-content-type-options":" nosniff","strict-transport-security":" max-age=31536000 ; includeSubDomains","content-type":" application/json","content-length":" 180"}

"response" : {"errors":[{"code":"ProductValidationException","message":"Empty GTIN: 225693","details":null,"path":"productSet[0].product","userMessage":"This category requires parameter EAN"}]}

Why am I getting an error "This category requires parameter EAN" despite selecting Condition parameter as Used

Conditions Parameter: { "id" : "11323", "name" : "Condition", "type" : "dictionary", "required" : true, "requiredForProduct" : false, "unit" : null, "options" : { "variantsAllowed" : false, "variantsEqual" : true, "ambiguousValueId" : null, "dependsOnParameterId" : null, "requiredDependsOnValueIds" : null, "displayDependsOnValueIds" : null, "describesProduct" : false, "customValuesEnabled" : false }, "dictionary" : [ { "id" : "11323_1", "value" : "New", "dependsOnValueIds" : [] }, { "id" : "11323_2", "value" : "Used", "dependsOnValueIds" : [] } ], "restrictions" : { "multipleChoices" : false } }

EAN Parameter: { "id" : "225693", "name" : "EAN", "type" : "string", "required" : true, "requiredForProduct" : true, "unit" : null, "options" : { "variantsAllowed" : false, "variantsEqual" : false, "ambiguousValueId" : null, "dependsOnParameterId" : "11323", "requiredDependsOnValueIds" : [ "11323_1" ], "displayDependsOnValueIds" : null, "describesProduct" : true, "customValuesEnabled" : false }, "restrictions" : { "minLength" : 8, "maxLength" : 14, "allowedNumberOfValues" : 1 } }

Also, startingAt field was sent as "2022-06-02T19:40:00.000Z" (UTC timezone) for this offer, but on Allegro the same is showing as "Jun 3, 2022, 1:10 AM". see the attached: screenshot-allegro pl-2022 06 01-22_28_43

Please let me know which timezone I have to send my dates?

Lukasz-Zurek commented 2 years ago

In the first case:

{
"id" : "225693",
"name" : "EAN",
"type" : "string",
"required" : true,
"requiredForProduct" : true,
"unit" : null,
"options" : {
"variantsAllowed" : false,
"variantsEqual" : false,
"ambiguousValueId" : null,
"dependsOnParameterId" : "11323",
"requiredDependsOnValueIds" : [
"11323_1"
],

The EAN Parameter is required for a product ("requiredForProduct" : true) and that is paramount.

The fact that the EAN is optional for "used" items to list the offer does not mean that it is not mandatory to catalog the offer. In this case there is no option to catalog the offer without indicating the EAN parameter, so you should provide it in your request.

Another thing - regarding "startingAt" field which was sent as "2022-06-02T19:40:00.000Z" (UTC timezone) - as I see - it will appear on Jun 2, 2022, 9:40 PM - so the information is correct right now.

Please note the fact that there is a time difference between the date we present in My Allegro and the REST API due to different time zones. REST API is in “Zulu Time”, universal time e.g. +00:00Z. Please check the information in our tutorial.

dmsmatrix commented 2 years ago

[...]

"response" : {"errors":[{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterBrandvalueadidas(226290_314902)does not match the existing parameter value4F(226290_314942)."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Volume'(206338) value (2) does not match the existing parameter value (1)","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterVolumevalue2does not match the existing parameter value1."},{"code":"PARAMETER_MISMATCH","message":"The provided parameter 'Dominant color'(205826) value (beiges and browns(205826_1041839)) does not match the existing parameter value (clear(205826_225030))","details":null,"path":"productSet[0].product.parameters","userMessage":"The provided parameterDominant colorvaluebeiges and browns(205826_1041839)does not match the existing parameter valueclear(205826_225030)."}]} Why am I getting these errors after changing the values of the above-mentioned parameters? It was different at the time of Create Offer. How can I consider or mark some parameters of category as unchange parameters after its offer create, is there API for the same

I see that you created your product on May 31, 2022 when you created an offer (but it was not listed because of the validation errors), at 18:21:36. Before you have tried to edit it on the same day, at 18:30:29.

You have already filled this product with a different data than you try to provide via PATCH /sale/product-offers/12223580110. I suggest not to provide them at all (or provide values which do match the existing parameters in product database) while editing (or listing) an offer, because you won't be able to change these parameters in the product anyway. This is why you receive an error because for example: parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942)).

If you create an offer via POST /sale/product-offers and you provide needed parameters - we create a product (in the case where you do not provide a product.id) which will be assigned to the offer that you created and listed. So if you want to edit it via PATCH /sale/product-offers/{offerId} you have to remember to provide proper parameters. You can always check the product data (assigned to the offer) via GET /sale/products/{productId}.


I am still getting this error. I have added this offer yesterday as new one, but getting error on edit offer. Please let me know.

"endpoint" : "PATCH https://api.allegro.pl/sale/product-offers/12227259587"

"request" : {\"afterSalesServices\":{\"returnPolicy\":{\"id\":\"5c1be946-8ac4-4636-9ca1-706f828382f7\",\"name\":\"Test Return 1\"},\"impliedWarranty\":{\"id\":\"67aa6cfa-07f0-422b-87de-eb485299c9cc\",\"name\":\"Test Complaint 1\"},\"warranty\":{\"id\":\"d5a3dab6-2f90-47d7-8000-fbeda408c8f7\",\"name\":\"Test Warrenty 1\"}},\"additionalServices\":{\"id\":\"a43b789b-80b1-4bee-9c63-d66f1e9689ff\",\"name\":\"Test Packagae 2\"},\"discounts\":{\"wholesalePriceList\":{\"id\":\"fbebc0ec-0da2-48bd-9243-f1c41c8589ed\",\"name\":\"Test Price 1\"}},\"delivery\":{\"handlingTime\":\"PT0S\",\"shipmentDate\":\"2022-06-02T15:25:00.000Z\",\"additionalInfo\":\"TESTSWAPNIL1-1\",\"shippingRates\":{\"id\":\"cfbf12f5-602e-4057-97cb-9a2aa4ccd99c\",\"name\":\"Test Delivery Price 1\"}},\"publication\":{\"duration\":null},\"payments\":{\"invoice\":\"NO_INVOICE\"},\"messageToSellerSettings\":{\"mode\":\"OPTIONAL\"},\"parameters\":[{\"id\":\"11323\",\"name\":\"Condition\",\"valuesIds\":[\"11323_1\"]}],\"productSet\":[{\"product\":{\"parameters\":[{\"id\":\"225693\",\"name\":\"EAN\",\"values\":[\"8903754241083\"]},{\"id\":\"213194\",\"name\":\"Additional Features\",\"valuesIds\":[\"213194_1\",\"213194_2\"]},{\"id\":\"226290\",\"name\":\"Brand\",\"valuesIds\":[\"226290_314902\"]},{\"id\":\"237206\",\"name\":\"Model\",\"values\":[\"TESTSWAPNIL1-1\"]},{\"id\":\"224017\",\"name\":\"Producent code\",\"values\":[\"TESTSWAPNIL1-1\"]},{\"id\":\"206910\",\"name\":\"Material\",\"valuesIds\":[\"206910_228838\"]},{\"id\":\"206338\",\"name\":\"Volume\",\"values\":[\"2\"]},{\"id\":\"205826\",\"name\":\"Dominant color\",\"valuesIds\":[\"205826_1041839\"]},{\"id\":\"203897\",\"name\":\"Height\",\"values\":[\"2\"]},{\"id\":\"206398\",\"name\":\"Diameter\",\"values\":[\"2\"]},{\"id\":\"206466\",\"name\":\"Weight\",\"values\":[\"2\"]},{\"id\":\"17448\",\"name\":\"Weight (with packaging)\",\"values\":[\"2\"]}],\"name\":\"Testswapnil1\",\"category\":{\"id\":\"148828\"},\"images\":[\"https:\\/\\/dmsmatrix.net\\/direct\\/images\\/6297914cba802166c440e509.jpg\"]},\"quantity\":{\"value\":1}}],\"name\":\"Testswapnil1\",\"description\":{\"sections\":[{\"items\":[{\"type\":\"TEXT\",\"content\":\"<p>TESTSWAPNIL1<\\/p>\"}]}]},\"category\":{\"id\":\"148828\"},\"images\":[\"https:\\/\\/dmsmatrix.net\\/direct\\/images\\/6297914cba802166c440e509.jpg\"],\"sellingMode\":{\"price\":{\"amount\":\"1000.00\",\"currency\":\"PLN\"}}}

"headers" : {\"expires\":\" 0\",\"cache-control\":\" no-cache, no-store, max-age=0, must-revalidate\",\"x-xss-protection\":\" 1; mode=block\",\"pragma\":\" no-cache\",\"x-frame-options\":\" DENY\",\"trace-id\":\" b0e097a77bdde3e1\",\"date\":\" Thu, 02 Jun 2022 12:03:43 GMT\",\"x-content-type-options\":\" nosniff\",\"strict-transport-security\":\" max-age=31536000 ; includeSubDomains\",\"content-type\":\" application\\/json\",\"content-length\":\" 1112\"}

"response" : {\"errors\":[{\"code\":\"PARAMETER_MISMATCH\",\"message\":\"The provided parameter 'Brand'(226290) value (adidas(226290_314902)) does not match the existing parameter value (4F(226290_314942))\",\"details\":null,\"path\":\"productSet[0].product.parameters\",\"userMessage\":\"The provided parameterBrandvalueadidas(226290_314902)does not match the existing parameter value4F(226290_314942).\"},{\"code\":\"PARAMETER_MISMATCH\",\"message\":\"The provided parameter 'Volume'(206338) value (2) does not match the existing parameter value (1)\",\"details\":null,\"path\":\"productSet[0].product.parameters\",\"userMessage\":\"The provided parameterVolumevalue2does not match the existing parameter value1.\"},{\"code\":\"PARAMETER_MISMATCH\",\"message\":\"The provided parameter 'Dominant color'(205826) value (beiges and browns(205826_1041839)) does not match the existing parameter value (clear(205826_225030))\",\"details\":null,\"path\":\"productSet[0].product.parameters\",\"userMessage\":\"The provided parameterDominant colorvaluebeiges and browns(205826_1041839)does not match the existing parameter valueclear(205826_225030).\"}]}

Lukasz-Zurek commented 2 years ago

@adityakokate You should not provide values which we pointed out in the response, because you created a product with different parameter's values. So they don't match.

You can check these values via GET /sale/products/6b4068f0-37df-4ab5-afee-ff981665f579.

As I see - you're trying to edit an offer which has been already assigned to the product. You can delete these parameters (which do not match) from your request.

stale[bot] commented 2 years 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.