Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
LemonWiki共筆
Search
Search
Appearance
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Troubleshooting of Azure Cognitive Services API
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[https://azure.microsoft.com/zh-tw/services/cognitive-services/computer-vision/ 電腦視覺 | Microsoft Azure] == How to fix the error: invalid subscription key or wrong API endpoint == Error message : <pre>{"error":{"code":"401","message":"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}</pre> Solution: * Verify the API endpoint URL * Verify the subscription key and add it to the request header Example command edited from the API document<ref>[https://docs.microsoft.com/zh-tw/azure/cognitive-services/Computer-vision/quickstarts-sdk/client-library?pivots=programming-language-rest-api&tabs=visual-studio 快速入門:光學字元辨識 (OCR) 用戶端程式庫或 REST API - Azure Cognitive Services | Microsoft Docs]</ref> <pre> curl -v -X POST "<API endpoint>" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <subscription key>" --data-ascii "{\"url\":\"<image URL>\"}" </pre> <pre> curl -v -X POST "https://westcentralus.api.cognitive.microsoft.com/vision/v3.2/read/analyze" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <subscription key>" --data-ascii "{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Atomist_quote_from_Democritus.png/338px-Atomist_quote_from_Democritus.png\"}" </pre> == How to fix the error: Failed to download image from input URL == Error message : <pre>{"error":{"code":"FailedToDownloadImage","message":"Failed to download image from input URL."}}</pre> Solution: * Check the form data submitted * Check the image URL == How to fix the error: Unsupported media type == Error message : <pre>{"error":{"code":"BadArgument","message":"Unsupported media type."}}</pre> Solution: Add this item to request header : <pre>Content-Type: application/json</pre> == Related pages == * [https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api/operations/AnalyzeReceipt Cognitive Services APIs Reference] * [[Troubleshooting of HTTP errors]] == References == <references/> {{Template:Troubleshooting}} [[Category:Machine Learning]] [[Category:Data Science]] [[Category:Tool]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki共筆:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:Troubleshooting
(
edit
)