question

easyads-dev avatar image
0 Likes"
easyads-dev asked

Create Offer: Invalid request

Hi, I'm trying to create an offer for an added inventory item. This is my post request: (I've replaced all double quotes to single quotes in my post here because else they would be html encoded for some reason) POST https://api.ebay.com/sell/inventory/v1/offer HTTP/1.1 Content-Type: application/json Content-Language: nl-BE Authorization: Bearer xxx Host: api.ebay.com Content-Length: 465 Expect: 100-continue { 'format': 'FIXED_PRICE', 'marketplaceId': 'EBAY_BE_NL', 'sku': 'EasyAds_Ebay_BE_8608556', 'availableQuantity': 1, 'categoryId': '179680', 'listingPolicies': { 'fulfillmentPolicyId': '133514051026', 'paymentPolicyId': '133514052026', 'returnPolicyId': '133514053026' }, 'merchantLocationKey': 'ZoekertjesPlanet_Ebay_BE', 'pricingSummary': { 'price': { 'currency': 'EUR', 'value': '242.99' } } } As you can see I'm using `Content-Language: nl-BE` and `'marketplaceId': 'EBAY_BE_NL'` and the inventory item was also added for `nl-BE`. The error I'm receiving is: HTTP/1.1 400 Bad Request Content-Length: 267 Cneonction: close Date: Thu, 29 Aug 2019 08:51:35 GMT RlogId: t6pitnmsgwj70%3D9vjdpitnmsgwj70*1%3D70303%29pqtfwpu%29pie%29fgg%7E-fij-16cdc92ac2d-0x9730 X-EBAY-C-REQUEST-ID: ri=kPoyUv7k198y,rci=%2Fjei0ypoTqk6Oxz%2F X-EBAY-C-VERSION: 1.0.0 X-eBay-Client-TLS-Version: CLIENT.SSL.VERSION+', '+CLIENT.IP.SRC X-EBAY-REQUEST-ID: 16cdc92ac1a.a9cc812.75382.f9b552cf![] Content-Type: application/json Connection: keep-alive Strict-Transport-Security: max-age=31536000 { 'errors': [ { 'errorId': 2004, 'domain': 'ACCESS', 'category': 'REQUEST', 'message': 'Invalid request', 'longMessage': 'The request has errors. For help, see the documentation for this API.', 'parameters': [ { 'name': 'reason', 'value': 'Could not serialize field [marketplaceId]' } ] } ] } But as you can see the `marketplaceId`seems to be correct. What could be the problem? Best regards, Marc Selman
create offermarketplaceinvalid request
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

guvi_87 avatar image
0 Likes"
guvi_87 answered
@easyads-dev, Would you mind landing a helping hand? It seems like you managed to successfully PUT createOrReplaceInventoryItem request. How did you do it? I am struggling for the past two days trying to get Ebay provided sample code to work, namely: const data = { 'availability': { 'shipToLocationAvailability': { 'quantity': 50 } }, 'condition': 'NEW', 'product': { 'title': 'GoPro Hero4 Helmet Cam', 'description': 'New GoPro Hero4 Helmet Cam. Unopened box.', 'aspects': { 'Brand': ['GoPro'], 'Type': ['Helmet/Action'], 'Storage Type': ['Removable'], 'Recording Definition': ['High Definition'], 'Media Format': ['Flash Drive (SSD)'], 'Optical Zoom': ['10x'] }, 'brand': 'GoPro', 'mpn': 'CHDHX-401', 'imageUrls': [ ' http://i.ebayimg.com/images/i/182196556219-0-1/s-l1000.jpg', ' http://i.ebayimg.com/images/i/182196556219-0-1/s-l1001.jpg', ' http://i.ebayimg.com/images/i/182196556219-0-1/s-l1002.jpg' ] } }; const rawPost = await fetch(` https://api.ebay.com/sell/inventory/v1/inventory_item/${sku}`, { method: 'PUT', // *GET, POST, PUT, DELETE, etc. mode: 'cors', // no-cors, cors, *same-origin // cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached credentials: 'include', // include, *same-origin, omit headers: { 'Content-Type': 'application/json', 'accept' : 'application/json', 'Content-Language' : 'en-US', 'Authorization' : "Bearer "+access_token }, referrer: 'client', // no-referrer, *client body: data }) if(!rawPost.ok){console.warn('Errored Out');}; const post = await rawPost.json(); console.log(post); And I always get : category: "REQUEST" domain: "ACCESS" errorId: 2004 longMessage: "The request has errors. For help, see the documentation for this API." message: "Invalid request" No matter, how many parameters am I passing to the request body (most of them, as per doc are optional). Do you mind sharing a minimum viable request parameters, which worked for you? Would appreciate a ton! Kinds, Dennis
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

krich_developersupport avatar image
0 Likes"
krich_developersupport answered
@easyads-dev , Your original request has: 'marketplaceId': 'EBAY_BE_NL', Please try using the marketplace IDs outlined in the table here: https://developer.ebay.com/api-docs/static/rest-request-components.html#Marketpl Regards,
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.