Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 error on batch_product_details #36

Open
hruhland-mtm opened this issue Feb 3, 2023 · 5 comments
Open

401 error on batch_product_details #36

hruhland-mtm opened this issue Feb 3, 2023 · 5 comments

Comments

@hruhland-mtm
Copy link

hruhland-mtm commented Feb 3, 2023

I'm attempting to use the batch product details API like this (is there documentation on how you are supposed to do this? I'm basing it off the keyword_search example):

from digikey.v3.batchproductdetails import BatchProductDetailsRequest

...

batch_request = BatchProductDetailsRequest(products=['MMSZ5231B-FDICT-ND', 'BZX84C5V6-FDICT-ND'])
parts = digikey.batch_product_details(body=batch_request)

This results in the following error:

ApiException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 03 Feb 2023 19:35:18 GMT', 'Content-Type': 'application/json', 'Content-Length': '228', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '', 'Access-Control-Allow-Headers': 'origin, x-requested-with, accept, content-type, authorization,x-digikey-client-id, x-digikey-locale-site, x-digikey-locale-language, x-digikey-locale-currency, x-digikey-locale-shiptocountry, x-digikey-customer-id', 'Access-Control-Max-Age': '3628800', 'Access-Control-Allow-Methods': 'POST', 'X-DIGIKEY-REQUEST-ID': '5d4263b6-648e-4996-811e-f03373f8d46d', 'Set-Cookie': '[hiding cookie string for security]; Path=/; Secure; HTTPOnly'})
HTTP response body: {"ErrorResponseVersion":"3.0.0.0","StatusCode": 401,"ErrorMessage":"Invalid Client-Id","ErrorDetails":"X-DIGIKEY-Client-Id invalid for requested resource","RequestId":"5d4263b6-648e-4996-811e-f03373f8d46d","ValidationErrors":[]}

I can successfully use keyword_search and product_details so it seems like my client ID must be correct. Is there some other API permissions I need to enable on my digikey account?

Edit: Perhaps this is related? https://forum.digikey.com/t/x-digikey-client-id-invalid-for-requested-resource/26675

@WalanLynkz
Copy link

Got the same issu here, did a fix was found in the end ?

@WalanLynkz
Copy link

After talking with a techsupport at Digikey, it seems like the BatchProductDetails API is now depredicated.

@hruhland-mtm
Copy link
Author

Thanks for figuring this out, in the end I just made many more calls to the API than I expected to and implemented a cache to avoid exceeding the rate limit.

I assume the best resolution to this will be removing the batchProductDetails functionality from the library.

@WalanLynkz
Copy link

I will do the same, I hope @peeter123 will update this because it is realy misleading in DK API documentation and having a place somewhere where it's clarified may help others ;).

@PatrickChawah
Copy link

What about the myLists API? Does it do the same?
The ProductInformation V4 is out. Is there any will of updating ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants