cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HTTP Headers

Hi

I'm trying to make a request to ebay's api through python request module. I keep getting error code 400, however I'm able to get back a response on postman, unless I remove the host header.

 

The headers I'm using are:

headers = {
            "X-EBAY-C-MARKETPLACE-ID": "EBAY_GB",
            "Authorization": "Bearer OAuth Application Token"
            }  

I think the reason why I'm getting error code 400 is because I'm missing the host header. Does anyone know host header I need to use?

 

Thank you.

Message 1 of 4
latest reply
3 REPLIES 3

Re: HTTP Headers

Which API are you addressing?  I can't locate that header combination.

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 2 of 4
latest reply

Re: HTTP Headers

I'm using

 

https://api.ebay.com/buy/browse/v1/item_summary/search?q=drone&limit=3
Message 3 of 4
latest reply

Re: HTTP Headers

Start by acquiring an OAuth token to access public data:

https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html

That call will return an access_token.

 

The Browse API:

https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search

 

The API Explorer will assist in generating headers for the call to the browse API by showing how they are constructed.

https://developer.ebay.com/my/api_test_tool?index=0&env=production

Such as shown below:

 

X-EBAY-C-MARKETPLACE-ID:EBAY_GB
Authorization:Bearer v^1.1#i^1#p^3#I^3#r^0#f^0#t^H4sIAAAAA...SggHgAA

 

How the header is quoted or encoded/decoded is up to your server language. 

Your header appears to be correctly formatted for Python if it looks like this: 

headers = {
    "X-EBAY-C-MARKETPLACE-ID": "EBAY_GB",
    "Authorization": "Bearer v^1.1#i^1#p^3#I^3#r^0#f^0#t^H4sIAAAAA...SggHgAA"
}

Others have reported issues with Postman when making calls, but I don't have any details. Sorry.

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 4 of 4
latest reply