02-27-2023 09:03 AM
Hi all, I'm trying to create listings on multiple ebay stores through the REST API, but I have a problem with the call to create offers (sell/inventory/v1/bulk_create_offer). If run the code by entering only one marketplace ID (example EBAY_US) the call is successful. So the payload built like this works:
payload = {...
"marketplaceId": "EBAY_US"
...}
However, if I try to enter multiple marketplace IDs I get the error could not serialize the field. At this point I guess it is just a syntax problem or maybe is it not possible to enter multiple marketplace IDs?
I have tried several different ways:
"marketplaceId": "EBAY_US, EBAY_UK"
"marketplaceId": ["EBAY_US", "EBAY_UK" ]
"marketplaceId": "["EBAY_US", "EBAY_UK" ]"
and a few others, but I always get the same error could not serialize the field. I tried looking in the documentation but couldn't find anything about it. If anyone has been through this before I would really appreciate it to understand how to pass the field correctly.
Thanks
02-27-2023 09:11 AM
Edit: I'm trying with EBAY_CA not EBAY_UK that doesn't even exist
02-27-2023 09:32 AM
The schema listed in the documentation for the call lists marketplaceId as:
"marketplaceId" : "MarketplaceEnum : [EBAY_US,EBAY_MOTORS,EBAY_CA...]",
the [] portion is only in reference to the Enum having a list of possible values, marketplaceId itself is just a single Enum value between the " ".
For a field to allow multiples of something it would be listed like this:
"marketplaceId" : [
"MarketplaceEnum : [EBAY_US,EBAY_MOTORS,EBAY_CA...]"
]
02-27-2023 10:33 AM
Hi, thanks for your answer. I tried with:
"marketplaceId": [
"MarketplaceEnum : [EBAY_US,EBAY_IT]"
]
but I received the same error.
I also tried:
"marketplaceId": "MarketplaceEnum : [EBAY_US,EBAY_CA]"
"marketplaceId": "[EBAY_US,EBAY_CA]"
"marketplaceId": ["EBAY_US,EBAY_CA"]
have not worked
02-27-2023 10:54 AM
Right. So schema defines what is acceptable input, meaning it is an outline of what the call will accept in a payload. It is not something you can redefine or change.
What is described in the schema as per the documents for the call is
"marketplaceId": " "
With the Enum definition between the " ", meaning it can only accept a single value of whatever type is described between the " ".
The type being an Enum, a list of predefined values, so it can only accept a single value such as EBAY_US or EBAY_CA, etc.
My statement regarding "marketplaceId": [ " " ] was hypothetical, to explain that since the schema 'does not' define marketplaceId as such, it cannot accept multiple values. -
- But, if you look elsewhere in the schema you can see some things that 'can' accept multiples,
such as:
"shippingCostOverrides" : [ {
which can accept multiples of type dict
and:
"storeCategoryNames" : [ "string" ]
which can accept multiples of type string
As far as valid input, the only valid input for marketplaceId is something in the form of
"marketplaceId": "EBAY_US",
or
"marketplaceId":"EBAY_CA",
So long as what is between the " " is a single value of the Enum type.
02-27-2023 11:01 AM - edited 02-27-2023 11:03 AM
Okay thank you. In fact I was convinced that it was possible looking at the other fields
So I guess it's not possible to post offers this way and at most I could create one offer per ebay store. However that would affect my sales limits