03-10-2023 11:29 PM
Hello.
If you don't mind, please advise.
I started studying the API of ebay today.
I want to do "X-EBAY-API-CALL-NAME: AddItem" of the API.
When I tried, the following error occurred:
Error: 37 - Input data for tag is invalid or missing. Please check API documentation.
I am having trouble understanding the cause.
I am using the following XML. If you could please let me know the cause and any advice on how to deal with it.
Thank you.
/** test add item xml **/
apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>*******</eBayAuthToken>
</RequesterCredentials>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
<Item>
<ListingDuration>GTC</ListingDuration>
<Duration>GTC</Duration>
<Title>Sample Item</Title>
<CustomLabel>Test-SKU</CustomLabel>
<Description>This is a sample item.</Description>
<PrimaryCategory>
<CategoryID>69528</CategoryID>
</PrimaryCategory>
<StartPrice>200</StartPrice>
<CategoryMappingAllowed>true</CategoryMappingAllowed>
<ConditionID>3000</ConditionID>
<Country>US</Country>
<Currency>USD</Currency>
<DispatchTimeMax>7</DispatchTimeMax>
<ListingType>FixedPriceItem</ListingType>
<Location>Japan</Location>
<PaymentMethods>PayPal</PaymentMethods>
<PayPalEmailAddress>k.tokimatsu@gmail.com</PayPalEmailAddress>
<PictureDetails>
<GalleryType>Gallery</GalleryType>
<PictureURL>https://static.mercdn.net/item/detail/orig/photos/m68173458123_1.jpg</PictureURL>
</PictureDetails>
<Quantity>0</Quantity>
<ItemSpecifics>
<NameValueList>
<Name>Brand</Name>
<Value>TEST</Value>
</NameValueList>
<NameValueList>
<Name>Type</Name>
<Value>Figure</Value>
</NameValueList>
</ItemSpecifics>
<ReturnPolicy>
<ReturnPolicyName>return policy Copy</ReturnPolicyName>
</ReturnPolicy>
<ShippingDetails>
<ShippingServiceOptions>
<ShippingPolicyName>Free 999~1799g(Econommy & Standerd)[COL19]</ShippingPolicyName>
</ShippingServiceOptions>
</ShippingDetails>
<Site>0</Site>
</Item>
</AddItemRequest>
03-12-2023 09:00 AM
It is recommended to use VerifyAddItem instead of AddItem first, to make sure the XML submitted is error free. It is the same as AddItem, without pushing the listing live.
To note several issues:
When running that XML against the server I receive the same error with some additional information:
<LongMessage>Input data for tag <Item.Site> is invalid or missing. Please check API documentation.</LongMessage>
Item.Site being the first issue.
Looking up the documentation:
https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/VerifyAddItem.html#Request.Item.Site
https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/AddItem.html#Request.Item.Site
And subsequently the type Item.Site:
https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/types/SiteCodeType.html
This field uses US rather than 0. So you would need to change it to <Site>US</Site>
Next, make sure <eBayAuthToken> has a valid authentication token -- OR, IF you have a token declared in your headers like:
"X-EBAY-API-IAF-TOKEN: YOURTOKENHERE"
You can remove the <RequesterCredentials><eBayAuthToken> fields from the XML as in that case they are already taken care of.
Next errors that comes up:
Item.Duration is not a valid field, you already have the right field there ListingDuration, so remove <Duration>
Next:
CustomLabel is not valid, use <SKU></SKU> instead
Next:
Business policy stuff goes under Item.SellerProfiles, the fields PaymentDetails, ShippingDetails, and ReturnPolicy are older and it is recommended to instead migrate to using only business policies instead:
So this section should look something like:
<SellerProfiles>
<SellerShippingProfile>
<ShippingProfileName>Free 999~1799g(Econommy & Standerd)[COL19]</ShippingProfileName>
</SellerShippingProfile>
<SellerReturnProfile>
<ReturnProfileName>return policy Copy</ReturnProfileName>
</SellerReturnProfile>
<SellerPaymentProfile>
<PaymentProfileName>YOUR PAYMENT PROFILE NAME</PaymentProfileName>
</SellerPaymentProfile>
</SellerProfiles>
And you have to make sure that the names you use for each business policy match business policies you have set on your account, if the name doesn't find a matching business policy, you likely will get an error.
Next you want some package details:
something like:
<ShippingPackageDetails>
<MeasurementUnit>English</MeasurementUnit>
<PackageDepth>7</PackageDepth>
<PackageLength>6</PackageLength>
<PackageWidth>4</PackageWidth>
<WeightMajor>0</WeightMajor>
<WeightMinor>15</WeightMinor>
</ShippingPackageDetails>
Lastly I receive a message about PostalCode, if I add a <PostalCode> the post changes <Ack>Failure</Ack> to <Ack>Warning</Ack> and the posting is accepted. From there the only errors I receive are warnings (which you can research the warnings further to correct them and make go away). Since in your situation PostalCode might not make sense, I suggest reading the documentation regarding Item.PostalCode and Item.Location to try to figure out what works best for your location to address any errors related to it.
03-13-2023 07:07 AM
Thank you for the wonderful advice.
Thanks to your advice, I was able to register the product.
However, adding a tag ↓ will result in an error.
<SellerShippingProfile> <ShippingProfileName>Free 999~1799g(Econommy & Standerd)[COL19]</ShippingProfileName> </SellerShippingProfile>
Error: Unrecognized element in request message.
I was able to register the item by defining it with the ShippingServiceOptions tag.
Do you know the cause of this error? Sorry for asking so many questions.
Thank You.
03-13-2023 02:10 PM
Hmm, not sure if that error is directly related to the ShippingServiceOptions tag as the message is unclear since it does not specify the element that is having the issue.
You should verify that the name exactly matches a valid policy, which you can see your policies and their names using the Account V1 REST API.
something like:
https://api.sandbox.ebay.com/sell/account/v1/fulfillment_policy?marketplace_id=EBAY_US
(remove sandbox for production, and research the Account v1 REST API if you need to create one)
The sandbox version appears to be down at the moment, giving an error. In production additionally you can verify the name with the website in your Seller Hub -> Business Policies
Also, as I forgot to originally mention, you probably need to change
<MeasurementUnit>English</MeasurementUnit>
to >Metric< if you're weighing the items in grams.
Other than that I would go back to those documentation links and compare your XML vs the input examples and try to see if there are any inconsistencies or typos.
03-17-2023 10:46 PM
Thank you for your advice.
Thank you.