Troubleshooting of Azure Cognitive Services API: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 23: | Line 23: | ||
Solution: Add this item to request header | Solution: Add this item to request header | ||
: <pre>Content-Type: application/json</pre> | : <pre>Content-Type: application/json</pre> | ||
== Related pages == | |||
* [[Troubleshooting of HTTP errors]] | |||
== References == | == References == | ||
Revision as of 13:56, 21 April 2022
How to fix the error: invalid subscription key or wrong API endpoint
Error message
{"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."}}
Solution:
- Verify the API endpoint
- Verify the subscription key and add to request header
Example command edited from the API document[1]
curl -v -X POST "<API endpoint>" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <subscription key>" --data-ascii "{\"url\":\"<image URL>\"}"
How to fix the error: Unsupported media type
Error message
{"error":{"code":"BadArgument","message":"Unsupported media type."}}
Solution: Add this item to request header
Content-Type: application/json
Related pages
References
Troubleshooting of ...
- PHP, cUrl, Python, selenium, HTTP status code errors
- Database: SQL syntax debug, MySQL errors, MySQLTuner errors or PostgreSQL errors
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, Docker, FTP problems, online conference software
- Test connectivity for the web service, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template