Open MBI910 opened 3 weeks ago
You can indeed use the names of the parameters, not just their IDs. You can get information about the parameters by using GET /sale/categories/{categoryId}/parameters. In the type
field you will find information about the type of parameter supported values: dictionary
(of single or multiple choice, depending on, the value in multipleChoices
), integer
and float
, string
(you can add one or more values).
You can also check if it is a range parameter by looking at the restrictions.range
flag.
Below you can find samples of properly completed parameter structures, depending on their type:
multipleChoices
is true
)
{
"id": "209878",
"valuesIds": [
"209878_2",
"209878_1"
],
"values": [],
"rangeValue": null
}
or, just by using names (in name and values), for example:
{
"name": "Brand",
"values": [
"Apple"
]
}
for range parameter (and integer type)
{
"id": "212570", \\ or name
"rangeValue": {
"from": "80",
"to": "100"
}
}
for string parameter type
{
"id": "216325", \\ or name
"values": [
"green",
"yellow",
"red"
]
}
@AureliuszBrussy Okay, so either IDs or names.... but how am I supposed to recognise what should be taken when, I can't just say if numbers or numbers with an underline then they are IDs otherwise names... that won't work.
For dictionary-type parameters and it's values, you can always use ID or names. In this case, there's no need to use "if" logic, you can just choose it on your side. For the rest type of the parameters, the value type is related to a specific type of parameter, as in the documentation:
When it comes to the parameters names (not values), you can always use names instead of IDs.
@PrzemyslawLukanowski somehow we still get an error sending the data:
sending data: {"name":"6x Savvies Screen Protector for Umidigi A5 Pro","category":{"id":"10532"},"images":[{"url":"https:\/\/a.allegroimg.com\/original\/114e50\/c9fb699848158658333433cac5af"}],"language":"en-US","parameters":[{"id":"225693","valuesIds":[],"values":["4062481067268"],"rangeValue":null},{"name":"Condition","valuesIds":[],"values":["New"],"rangeValue":null},{"name":"Dedicated brand","valuesIds":[],"values":["Umidigi"],"rangeValue":null},{"name":"Kind","valuesIds":[],"values":["protective film"],"rangeValue":null},{"id":"207862","valuesIds":[],"values":["6"],"rangeValue":null},{"id":"219781","valuesIds":[],"values":["Umidigi A5 Pro"],"rangeValue":null},{"id":"224017","valuesIds":[],"values":["1635924"],"rangeValue":null},{"name":"Manufacturer","valuesIds":[],"values":["Bedifol GmbH"],"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":"393d72f64b8e7f9b","date":"Wed, 13 Nov 2024 15:10:36 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"}
@MBI910 I'm sorry for the misunderstanding, but I assumed that you were mentioning the POST /sale/product-offers resource which is our main approach to listing offers with products. Now I see in our logs that you are using POST /sale/product-proposals which is a different approach where you can propose a product first - in this case, you cannot use names, only IDs are supported.
@PrzemyslawLukanowski
We want to send the data for the category Attributes (dictionary) in the form ‘Name’ - ‘Values’. We create our new products via ‘/sale/product-proposals’ and our offers via ‘/sale/product-offers’. Since, according to your support, we cannot send the data in the form ‘Name’ - ‘Values’ when creating products via ‘/sale/product-proposals’, which endpoint do we have to use to send the product data for creation in order to be able to use ‘Name’ - ‘Values’?
You should use POST /sale/product-offers. You can find more information in our tutorial.
@PrzemyslawLukanowski Can we also create non-existent products via [POST /sale/product-offers] instead of product-proposals?
Yes, please check the mentioned tutorial:
@PrzemyslawLukanowski
Now I really ask myself the question, why does the /sales/product-proposals exist? Since this is totally restricted (maximum number, updates only max. 200 per day) why does this exist if it is much easier with the /sale/product-offers and presumably the updates of the products are probably not limited to 200 per day!
The /sale/product-proposals resource was introduced earlier than /sale/product-offers and it represents a different approach - you create only a product, without associating it with an offer within one request.
Since this is totally restricted (maximum number, updates only max. 200 per day) why does this exist if it is much easier with the /sale/product-offers and presumably the updates of the products are probably not limited to 200 per day!
There shouldn't be such limit on this resource, can you give me a sample trace-id where we returned this message? The limit on this resource is 20 000 created products per month.
@PrzemyslawLukanowski Which parameters are mandatory when creating products via /sale/product-offers The API documentation does not say what is required. And whether we also need images for the products here, or whether it is sufficient to send them via the offers?
Required parameters for products are returned in the GET /sale/categories/{categoryID}/parameters and are marked as "requiredForProduct": true
. It's described in this part of the tutorial, where you can also find information, about what needs to be done to create a new product - images of the product are also required:
@PrzemyslawLukanowski Perhaps somewhat unfortunate wording the parameters clearly define which products are mandatory and which are not, but my question is more about the : name category id (can't actually exist, as it doesn't exist yet) idType images
Id is required when you indicate a product from our catalog, idType in that type of approach is optional. Please check our tutorial, where both approaches are described and we mention, which fields need to be filled.
Hi there , attributes with IDs are quite difficult for us to handle since we have more to offer than Allegro shows us. For example, the attribute “dedicated brands” in the category “Electronics/Phones and Accessories/GSM Accessories/Protective Films and Glass”- you have like 150 brand to choose from. We have more than 2000 brands, that means we can manually connect 150 brands, and the rest goes into "others" it is not possible to send the text like “Apple”, we must submit ID: “207786_233798” which is a lot of work to do the mapping for us. It would be easier if we could send our text (Apple) and Allegro matches it with the ID.
Otherwise, we receive errors like this:
SKU: 2855687 Offer: 36069006 sending data: {"name":"upscreen Scratch Shield Clear Screen Protector for Garmin Xero C1 Pro","category":{"id":"10532"},"images":[{"url":"https:\/\/a.allegroimg.com\/original\/11ec3d\/dfd7e8ef489194a6d852e241407a"}],"language":"en-US","parameters":[{"id":"225693","valuesIds":[],"values":["4068489379181"],"rangeValue":null},{"id":"11323","valuesIds":["11323_1"],"values":[],"rangeValue":null},{"id":"219781","valuesIds":[],"values":["Xero C1 Pro"],"rangeValue":null},{"id":"224017","valuesIds":[],"values":["2855687"],"rangeValue":null},{"id":"248798","valuesIds":["248798_1678756"],"values":[],"rangeValue":null},{"id":"207786","valuesIds":["Garmin"],"values":[],"rangeValue":null},{"id":"207854","valuesIds":["207854_234030"],"values":[],"rangeValue":null},{"id":"207862","valuesIds":[],"values":["1"],"rangeValue":null}]} response data {"errors":[{"code":"UnableToCreateProductWithoutAllRequiredParametersException","message":"Unable to create product without proper values in all required parameters: [Dedykowana marka] in category: 10532","details":null,"path":"parameters","userMessage":"You cannot create a product without providing correct values for all the required parameters: [Dedicated brand]","metadata":{}}]} header data {"trace-id":"82ac390dc1133ef0","date":"Wed, 06 Nov 2024 07:01:28 GMT","content-type":"application\/json; charset=UTF-8","content-length":"384","x-frame-options":"DENY","strict-transport-security":"max-age=15552000","x-content-type-options":"nosniff"}
I think this is a general problem for everyone who is listing thousands of products via API not only for that specific Attribute in that specific category.
Allegro:
I asked our API for help with that questions and here is their answer:
This is something that the sellers, unfortunately, will not get around - sellers have to indicate a particular brand, while the others that they have in their database - they should actually pass on as "other".
But we could map by the name you pass on and according to the colleagues, this should work properly. My colleague tested one example with the brand and it works, so you should only pass the brand in the ‘values’ field, while ‘valuesIds’ should be removed from the request
Seller:
Is this applicable to every attribute in every category? That would be a gamechanger to a certain degree even if we cannot connect everything and have to use “other” for many. Maybe it is possible that Allegro extends the lists with data we can send you e.g. the 2000 brands we offer?
Allegro respond:
According to our API yes, it should work for every parameter.
Seller:
according to our IT specialist:
Please note the following: • ‘type’: ‘dictionary’ (selection), • only value_ids are permitted here • and ID 207786 is such a type, therefore only one ID may be entered here and not ‘Garmin’. • ‘type’: ‘range’ (range), • only ‘rangeValue’ => [ ‘from’ => XXXX, ‘to’ => XXXX ] may be filled • ‘type’: ‘float’ (decimal numbers), • only numbers may be transmitted here • for all other types that are not defined more precisely, the ‘values “ field is then filled as for ID 219781 (”type’: ‘string’) Please note, as this is important when filling the attributes, I cannot change anything here, these are the Allegro defaults.
As I told him that you tested it with your IT sending value text, he replied:
Okay, but how am I supposed to recognise whether this value belongs in value_ids or values? I can only follow their guidelines, and that's exactly what I've described. I can't put everything into value_ids and values, that certainly won't work. Then it would be nice if you could also tell me how I can recognise where I can enter something. Is there perhaps another parameter by which I can recognise something like this?