Here is my setup:
Python 3.4
Using the Trading API
Attempting to call eBay's "VerifyAddItem"
I marked where I get the Error, in PicURL
, and I'm trying to post multiple pictures with multiple URLs. I'm currently just trying out two pictures let's say http://i.ebayimg.com/picture1
and http://i.ebayimg.com/picture2
. (I realize that these are not real pictures, but that's not part of the problem I'm having)
The eBay API Documentations states To specify multiple pictures, send each URL in a separate, PictureDetails.PictureURL element. The first URL passed in will be the Gallery image and appears on the View Item page.
So I tried passing both of the following lines to no avail:
"PictureDetails": {"PictureURL": ["http://i.ebayimg.com/picture1",
"http://i.ebayimg.com/picture2"]}
and
"PictureDetails": [{"PictureURL": "http://i.ebayimg.com/picture1"},
{"PictureURL": "http://i.ebayimg.com/picture2"}]
I get the following errors from eBay's connection, respectively:
VerifyAddItem: Class: RequestError, Severity: Error, Code: 37, Input data is invalid.
Input data for tag <Item.PictureDetails.PictureURL[2]> is invalid or missing. Please
check API documentation.
and
VerifyAddItem: Class: RequestError, Severity: Error, Code: 37, Input data is invalid.
Input data for tag <Item.PictureDetails[2].PictureURL> is invalid or missing. Please
check API documentation.
Unfortunately, I have run out of ideas. Please help! Here is the full dictionary, don't worry about the logic, as I have verified that everything else works fine.
api = Trading(config_file="ebay.yaml", warnings=False)
myitem = {
"Item": {
"Title": Title,
"Description": Description,
"PrimaryCategory": {"CategoryID": p.CategoryValue},
"StartPrice": str(p.Price_sbox.value()),
"CategoryMappingAllowed": "true",
"Country": "US",
"ConditionID": CatID,
"ConditionDescription": p.CondDetail_tedit.toPlainText(),
"Currency": "USD",
"DispatchTimeMax": "1",
"ListingDuration": "GTC",
"ListingType": "FixedPriceItem",
"PaymentMethods": "PayPal",
"PayPalEmailAddress": PayPal,
#############################
###This is where I get the Error
#############################
"PictureDetails": PicURL,
"PostalCode": ZipCode,
"Quantity": str(p.Quantity_sbox.value()),
"ReturnPolicy": {
"ReturnsAcceptedOption": "ReturnsAccepted",
"RefundOption": "MoneyBack",
"Description": "14 days money back, you pay return shipping",
"ReturnsWithinOption": "Days_14",
"ShippingCostPaidByOption": "Buyer" },
"ShippingDetails": {
"ShippingType": "Calculated",
"PaymentInstructions": "1 business days of handling time, usually shipped next day. Make sure your address is correct, especially when shipping to foreign countries.",
"ShippingServiceOptions": {
"FreeShipping": FreeShip,
"ShippingService": ShipService
},
"CalculatedShippingRate": {"OriginatingPostalCode": ZipCode} },
"ShippingPackageDetails": {
"MeasurementUnit": "English",
"WeightMajor": str(p.WeightLbs_sbox.value()),
"WeightMinor": str(p.WeightOz_sbox.value()),
"PackageDepth": str(p.DimensionH_sbox.value()),
"PackageLength": str(p.DimensionL_sbox.value()),
"PackageWidth": str(p.DimensionW_sbox.value()),
"ShippingPackage": "PackageThickEnvelope"},
"ShipToLocations": "Worldwide",
"Site": "US",
"SKU": p.ItemID_ledit.text() } }
IntShip = []
boolint = False
if(p.IntShip1_chbox.isChecked()):
IntShip.append('USPSPriorityMailInternational')
boolint = True
if(p.IntShip2_chbox.isChecked()):
IntShip.append('USPSPriorityMailInternationalLargeFlatRateBox')
boolint = True
if(boolint):
myitem['Item']['ShippingDetails']['ShippingServiceOptions']['InternationalShippingServiceOption'] = IntShip
if(p.BestOffer_chbox.isChecked()):
myitem['Item']['BestOfferDetails'] = {'BestOfferEnabled': 'true'}
#print(myitem)
api.execute('VerifyAddItem', myitem)
print("%s" % api.response.content)
except ConnectionError as e:
for node in api.response.dom().findall('ErrorCode'):
print("error code: %s" % node.text)
if 37 in api.response_codes():
print("Invalid data in request")
print(e)
print(e.response.dict())
Well nevermind... I feel dumb... Since I'm still working in sandbox, I'm passing test photos where some of the URLs in the list PicURL
do not point to a valid photo.
If anyone else gets these errors, the first format is the correct one:
"PictureDetails": {"PictureURL": ["http://i.ebayimg.com/picture1",
"http://i.ebayimg.com/picture2"]}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With