allegro / allegro-api

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

Request contains invalid data. Contact the application author. #10335

Open MBI910 opened 3 days ago

MBI910 commented 3 days ago

can the error be specified?

sending data: {"name":"2x ScreenLeaf sustainably packed Screen Protector for Rollei Viltrox DC-X3","category":{"id":"10532"},"images":[{"url":"https:\/\/a.allegroimg.com\/original\/115ebf\/12312f4d40f79b8843abb71fec5e"}],"language":"en-US","parameters":[{"id":"225693","valuesIds":[],"values":["4068489507461"],"rangeValue":null},{"name":"Condition","valuesIds":[],"values":["New"],"rangeValue":null},{"name":"Dedicated brand","valuesIds":[],"values":["Rollei"],"rangeValue":null},{"name":"Kind","valuesIds":[],"values":["protective film"],"rangeValue":null},{"id":"207862","valuesIds":[],"values":["2"],"rangeValue":null},{"id":"219781","valuesIds":[],"values":["Rollei Viltrox DC-X3 6\""],"rangeValue":null},{"id":"224017","valuesIds":[],"values":["6156783"],"rangeValue":null},{"name":"Manufacturer","valuesIds":[],"values":["248798_1928605"],"rangeValue":null}]} response data {"errors":[{"code":"HttpMessageNotReadableException","message":"An error has occurred","details":null,"path":null,"userMessage":"Request contains invalid data. Contact the application author.","metadata":{}}]} header data {"trace-id":"f2160065394bbd72","date":"Tue, 19 Nov 2024 13:39:51 GMT","content-type":"application\/json; charset=UTF-8","content-length":"209","x-frame-options":"DENY","strict-transport-security":"max-age=15552000","x-content-type-options":"nosniff"}

Lukasz-Zurek commented 2 days ago

Your request is just incorrect, we do not describe the specific reason in our response. As I see in your request sample - there are some duplicated quotes there:

{"id":"219781","valuesIds":[],"values":["Rollei Viltrox DC-X3 6""],"rangeValue":null},{"id":"224017","valuesIds":[],"values":["6156783"],"rangeValue":null},{"name":"Manufacturer","valuesIds":[],"values":["248798_1928605"],"rangeValue":null}]}

so it should look like this:

...
         "values":[
            "Rollei Viltrox DC-X3 6"
         ],
         "rangeValue":null
      },
      {
         "id":"224017",
         "valuesIds":[

         ],
         "values":[
            "6156783"
         ],
         "rangeValue":null
      },
      {
         "name":"Manufacturer",
         "valuesIds":[

         ],
         "values":[
            "248798_1928605"
         ],
         "rangeValue":null
      }
   ]
}
MBI910 commented 2 days ago

@Lukasz-Zurek thank you the same applies to this request I reckon?

sending data: {"name":"BROTECT AirGlass Matte Glass Screen Protector for Surfans F22","category":{"id":"10532"},"images":[{"url":"https:\/\/a.allegroimg.com\/original\/11a03c\/33228ded416fab8f16c72f20f9ae"}],"language":"en-US","parameters":[{"id":"225693","valuesIds":[],"values":["4062481791408"],"rangeValue":null},{"name":"Condition","valuesIds":[],"values":["New"],"rangeValue":null},{"name":"Dedicated brand","valuesIds":[],"values":["Surfans"],"rangeValue":null},{"name":"Kind","valuesIds":[],"values":["hybrid glass"],"rangeValue":null},{"id":"207862","valuesIds":[],"values":["1"],"rangeValue":null},{"id":"219781","valuesIds":[],"values":["Surfans F22"],"rangeValue":null},{"id":"224017","valuesIds":[],"values":["5340122"],"rangeValue":null},{"name":"Manufacturer","valuesIds":[],"values":["248798_1928605"],"rangeValue":null}]} response data {"errors":[{"code":"HttpMessageNotReadableException","message":"An error has occurred","details":null,"path":null,"userMessage":"Request contains invalid data. Contact the application author.","metadata":{}}]} header data {"trace-id":"92692c9efc82c6ba","date":"Wed, 20 Nov 2024 05:13:20 GMT","content-type":"application\/json; charset=UTF-8","content-length":"209","x-frame-options":"DENY","strict-transport-security":"max-age=15552000","x-content-type-options":"nosniff"}

Lukasz-Zurek commented 2 days ago

@MBI910 Ok, now I see some incorrect names and values:

And what is important - using POST /sale/product-proposals where you can propose a product first - you cannot use names, only IDs are supported.

Please use GET /sale/categories/10532/parameters to check parameters options, dictionary values, etc.

So as you can see - there is a lot of things to look at before sending this request.