0

I have a translator app in azure and it's connected with VNET and an app service which is also connected with VNET both have different subnets but while calling the translate api it's returning

{ "StatusCode": 404, "Content": "{\"error\":{\"code\":\"404\",\"message\": \"Resource not found\"}}" }

this is the endpoint, I'm including the required headers `https://{MYDOMAIN}.cognitiveservices.azure.com/translate?api-version=3.0&to=it

I've tried alot but still getting 404, if anyone experienced same?

asked Mar 5 at 7:48
1
  • Check the private endpoint DNS resolution, ensure the App Service’s VNET is linked to the Translator API’s private DNS zone. Commented Mar 6 at 10:14

1 Answer 1

0

Use the below endpoint in the Azure Portal under the Translator resource. Make sure the Virtual Network and Text translator resources are in same region.

https://<ResourceName>.cognitiveservices.azure.com/translator/text/v3.0/translate?api-version=3.0

enter image description here

If you are using a private endpoint, the Translator domain has to resolve to the private IP address. That happens through a Private DNS Zone named privatelink.cognitiveservices.azure.com, with a record that points to the private endpoint. Without that, the domain won’t resolve correctly inside the VNET.

The App Service should be integrated with the VNET using regional integration, ensuring that all outbound traffic is routed through the VNET. The Route All option in the integration settings enables this by directing requests, such as those to the Translator API, through the VNET instead of the public internet.

Try the below curl command :

curl -X POST "https://<ResourceName>.cognitiveservices.azure.com/translator/text/v3.0/translate?api-version=3.0&from=en&to=fr&to=zu" -H "Ocp-Apim-Subscription-Key: <SubscriptionKey>" -H "Ocp-Apim-Subscription-Region: eastus" -H "Content-Type: application/json" --data "[{\"text\":\"Hello Kamali. How are you?\"}]"

Output :

enter image description here

The API needs all three headers: subscription key, region, and content type. Without the region header, the request will often fail even if everything else is right.

On the networking side, if the Translator resource is restricted to selected networks, traffic from the app has to go through the private endpoint. Temporarily setting the Translator to accept all networks can help confirm whether the issue is with the access controls.

answered Apr 2 at 12:38
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.