question

jewelrytoys avatar image
0 Likes"
jewelrytoys asked

Taxonomy calls returning HTTP 400 error

I am trying to implement Taxonomy calls as Trading API Item Specifics is going away. I have converted all my trading API calls to OAuth2 successfully, but Taxonomy calls like getDefaultCategoryTreeId are returning HTTP 400. My call details:

scheme: GET
uri: https://api.sandbox.ebay.com/commerce/taxonomy/v1/get_default_category_tree_id?marketplace_id=EBAY_US&
headers: Authorization:Bearer v^1.1#i^...dBkAAA==
Accept:application/json
Content-Type:application/json
Accept-Encoding:gzip
payload: [empty]

I have spent much time on this, and any help is greatly appreciated.

http bad request
· 2
10 |600

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

maybe wrong missing scope
0 Likes 0 ·

Thanks for the suggestion. I constructed the auth code using the recommended list of sandbox scopes, so I think I'm OK there, esp. as other APIs work. GetDefaultCategoryTreeId only requires the first scope, 'https://api.ebay.com/oauth/api_scope'

sandbox_scope = ' '.join(['https://api.ebay.com/oauth/api_scope',
'https://api.ebay.com/oauth/api_scope/buy.order.readonly',
...
'https://api.ebay.com/oauth/api_scope/commerce.notification.subscription.readonly',])
0 Likes 0 ·
ardonis-2000 avatar image
0 Likes"
ardonis-2000 answered

Hi,

check the granted oauth-scopes of your developer account (https://developer.ebay.com/my/keys and click on "OAuth Scopes"). You need access to the scope: https://api.ebay.com/oauth/api_scope/metadata.insights if you plan on using taxanomy-api functions.

I've asked the premium support. Their answer was: "After carefully reviewing, your request for Buyer Demand data access is rejected by the Business Unit."

· 1
10 |600

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

Thanks for telling me about metadata.insights; I didn't have that scope. But getDefaultCatgeoryId only requires the basic api_scope, and anyway, I would expect it to return HTTP 200 and eBay error 931 Auth token is invalid.
0 Likes 0 ·
jewelrytoys avatar image
0 Likes"
jewelrytoys answered

Followup: simplified code that fails. Expected HTTP 200, eBay 931.

import http.client as httplib
url = 'api.sandbox.ebay.com'
path = 'commerce/taxonomy/v1/get_default_category_tree_id?marketplace_id=EBAY_US'
access_token = 'v^1.1#....FAILS.WHETHER.GOOD.OR.BAD.TOKEN....bAAA='
headers = {
"Authorization":'Bearer ' + access_token,
'Accept':'application/json',
'Content-Type':'application/json',
}
connection = httplib.HTTPSConnection(url)
connection.request('GET', path, '', headers)
response = connection.getresponse()
code = response.status
print(f'{code=}')
connection.close()
· 3
10 |600

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

as always: because (just a feeling, 50% is not working in sandbox) did u test in production ?
0 Likes 0 ·

My bad -- I omitted a character. (Path should start with a slash.) Moral of the story: do NOT eyeball two inputs to check that they are the same.

0 Likes 0 ·
...continued.

They looked identical to my eye, but they weren't I had left the starting slash of the path out.

I fixed that in my Taxonomy call, and it worked.

I doubt that your problem is the same, but it may give you an idea about how to narrow down the problem.

Lastly, my thanks to everyone who offered help here.

0 Likes 0 ·
jennyre_79 avatar image
0 Likes"
jennyre_79 answered

Thanks to this article I can learn more. Expand my knowledge and abilities. Actually the article is very real.

10 |600

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.