Getting 401/404 errors with Microsoft Azure Cognitive Services API - azure

I followed the directions from https://learn.microsoft.com/en-us/rest/api/computervision/3.1/describeimage/describeimage but each time I fill in my endpoint, as https://[resource_name].cognitiveservices.azure.com or https://southcentralus.api.cognitive.microsot.com, I get a 404 or 401 error, respectively. I've checked to make sure the image url I specify works and loads fine withOUT a 404. Can anyone help?

You can use both hosts below to send request:
https://<your service name>.cognitiveservices.azure.com
https://<your service loaction>.api.cognitive.microsoft.com
You can find all of then on Azure Portal=>Cognitive services=>your service =>Keys and Endpoint:
You should involve key as request header:Ocp-Apim-Subscription-Key to avoid 401 error just as below:
Let me know if you have any more questions.

Related

LinkedIn V2 API return not found when called from Azure API Management

I am trying to call LinkedIn V2 API from Azure API Management, specifically the ugcPost API:
https://api.linkedin.com/v2/ugcPosts
When the ugcPost API is called from our personal computer, the API is able to return the response successfully. However, when we attempt to call the ugcPost from Azure API Management, it responds back with status 404 (Resource not found).
{
"serviceErrorCode": 0,
"message": "Resource ugcPosts does not exist",
"status": 404
}
Has anyone faced similar issue? Is there something in the LinkedIn Developer portal that we have to tweak for this to work?
Apparently, it is an issue with the URL configuration that somehow append my base API URL causing the final URL to be incorrect (e.g. https://api.linkedin.com/v2/ugcPosts/v2/ugcPosts).
After some URL reconfiguration, it is working fine now.

Microsoft appcenter service url for Azure Dev Ops url not found

I'm trying to publish app from Azure DevOps to appcenter.ms
I have code building and artifacts are being generated. However, step to upload the app to appcenter always fails with the same error:
2019-01-28T14:40:34.0252515Z ##[error]"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST //apps//company/appname//release_uploads</pre>\n</body>\n</html>\n"
http response code: 404
I have added a service connection under Azure DevOps:
Name: api
Server URL: https://api.appcenter.ms
API Token: XXXXX
I'm using App Center Distribute step to publish.
Under build config I got app slug set correctly. What API endpoint I should use?
You can use this endpoint. I've got this issue too and stuck up for days trying to find the right answer but no reference says they change the endpoint.
Server URL: https://api.mobile.azure.com/v0.1
Although the instructions currently suggest otherwise I had success in using the org style APP SLUG setting and it fixed my issue.
{user}/{appname} is the format that worked for me.

Getting an "unauthorized_client" when tryging to get a new access token, why?

I'm developing an API using VS 2017, which I'm testing using Postman. I've been following this blog post Getting started with Windows Azure AD Authentication using Postman. I finally got it to give me an access token and a refresh token. About 3 quarters of the way through the post I came across this:
resource : https://management.core.windows.net
which has to be put into Postman (I'm using the Windows app version of Postman). I wasn't sure what that was for, so I left it off. I eventually got an access token and a refresh token, but when I when to get more info for all subscriptions, I got errors saying that I had specified a valid resource. So, I thought what I'd have to do was start over again, but re-authenticating and getting a code from Azure. I did so, and put that into Postman, as the blog post instructs. However, issuing this POST results in this error:
"error": "unauthorized_client",
"error_description": "AADSTS70002: Error validating credentials. AADSTS65005: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client's application registration. Client app ID: d37abf69-42ce-4571-b146-f3422e73f041. Resource value from request: https://management.core.windows.net. Resource app ID: 797f4846-ba00-4fd7-ba43-dac1f8f63013. List of valid resources from app registration: 00000002-0000-0000-c000-000000000000.\r\nTrace ID: 9f028899-6d03-409e-8db4-4e9905000300\r\nCorrelation ID: ec253a1b-9fdc-495f-9310-6b40a42e5d93\r\nTimestamp: 2018-11-19 22:20:02Z",
"error_codes": [
70002,
65005
]
I don't understand why nor what I could have done wrong. I've prespecified the resource as the tutorial instructed, so what have I done wrong?
Looking at the error message, it seems you could have missed adding relevant permissions for "Windows Azure Service Management API" to your app registration.
Steps:
Go to Azure Portal > Azure AD > App registrations > Your app (with app id: d37abf69-42ce-4571-b146-f3422e73f041)
Go to Settings > Required permissions > Add > Select "Windows Azure Service Management API"
Select the relevant permission under Delegated permissions section. Click on select and then "Done". You should get a notification in portal that successfully added permissions. You should see Windows Azure Service Management API listed under required permissions as well.
After these steps, continue as per the blog post you've mentioned with Postman steps to get the access token again.
I found myself in the same situation when i was trying to setup Postman. Its not as complicated as most blogs make seem. I created a tutorial to try to make the process easy.
http://hazelnest.com/blog/blog/2018/11/17/azure-postman-configuration/
https://youtu.be/2bfgeBKRxl4
Hope this helps.

Using webhooks on dialogflow to Azure logic apps

Hi I want to use webhooks on Dialogflow to pass data to Azure logic apps(Http Request). I need your help since this isnt working well somehow.
Here is my settings.
Then, following message is returned.
"webhookStatus": {
"code": 16,
"message": "Webhook call failed. Error: 401 Unauthorized"
If I try same command on RestAPI Testing(Chrome Extention), it succeed.
What Shal I fix? Thank you for your help!
The problem is url Azure logicapp encoding.
You have to trasform url %2F to /
You have to do this change sp param
https://prod.zone.logic.azure.com:443/workflows/XXXXXXX/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=XXXX_XXXXX
https://prod.zone.logic.azure.com:443/workflows/XXXXXXX/triggers/manual/paths/invoke?api-version=2016-10-01&sp=/triggers/manual/run&sv=1.0&sig=XXXX_XXXXX
So You can use Azure Api Management. if you do not want to traform the url
Aldo Flores
#alduar
Dialogflow's fulfillment webhook requires that your endpoint be "publicly accessible". If your webhook endpoint requires basic authentication or certian HTTP headers to be present you can configure them in Dialogflow's console where you enter your webhook URL:
If your endpoint has other access restrictions (IP filtering, etc.) you'll need to disable them for Dialogflow to be able to access your endpoint.
Source: https://dialogflow.com/docs/fulfillment#requirements

Error when going live on Docusign API

After developing in the sandbox, we got our api key approved and promoted to a live account.
Since then we've been getting the following response -
response: {
"errorCode": "ACCOUNT_LACKS_PERMISSIONS",
"message": "This Account lacks sufficient permissions."
}
http code: 401
exeucted at: 2017-05-17 15:03:59
Based on my research and according to ACCOUNT_LACKS_PERMISSIONS error when creating envelope
A setting needs to be switched on the backend at Docusign. The user mentions -
"They changed a setting called In Session to Enabled in API section near limiter that only the account manager or tier 2 support can change. All is well."
The account ID is 30953035
API username bcbffa28-a316-473e-b2b7-48d964d909a7
The API request is below. This was working just fine under a Demo account. I've even upgraded to the Intermediate API in the hopes that it will resolve my issues but no dice.
Support says that I need to post here...
This is caused by a bad account baseUrl that's being used in the request. When your integration performs authentication for a given user, if you are using Legacy auth (X-DocuSign-Authentication header) then you need to point to the following /login_information endpoint for the live system:
https://www.docusign.net/restapi/v2/login_information
When you get the response you then need to parse the baseUrl value that was returned and use that sub-domain for subsequent API requests. (Note that there are multiple sub-domains in the live system such as NA1, NA2, EU, etc)
The baseUrl that's returned will look something like:
https://na2.docusign.net/restapi/v2/accounts/12345/envelopes
Make sure you configure your code to read this sub-domain and use in subsequent requests, otherwise you if you simply use www for instance you will not be hitting the correct account endpoint and you'll receive the "Account lacks permissions" error you're receiving.
Ergin's answer seems to work; however, he does not state which part of the baseUrl to keep after parsing. In his example the baseUrl = "https://na2.docusign.net/restapi/v2/accounts/12345/envelopes" In all subsequent calls after authApi.Login(); use "https://na2.docusign.net/restapi" as the URL and that should eliminate the error message.

Resources