Azure Translation in VB

I am trying, for the first time, to make use of Azure Cognitive Services, translation service.

I cannot find a simple example to use this in VB.net

Can anyone point me to, or send me, such an example?
LVL 1
rpmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical SpecialistCommented:
These cognitive services are just REST endpoints

Here is a call with CURL
curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=en&to=zh-Hans" -H "Ocp-Apim-Subscription-Key: <client-secret>" -H "Content-Type: application/json" -d "[{'Text':'Hello, what is your name?'}]"

Open in new window


Here are sample REST examples
https://www.example-code.com/vbnet/rest.asp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rpmAuthor Commented:
Thanks for your post, I started by trying your above URL directly in Chrome. I inserted my Key1 in place of <client-secret> and pasted the whole resulting URL into Chrome. This responded with:

{"code":405000,"message":"The request method is not supported for the requested resource."}

Am I doing something wrong, or cannot I simply use the URL in chrome?

I must admit to being a complete newbie on this sort of thing.
Shaun VermaakTechnical SpecialistCommented:
Am I doing something wrong, or cannot I simply use the URL in chrome?
Install Postman or the Postman Chrome extension. Some requests are POST etc. not GET. Browsers only do GET requests
 Acronis Global Cyber Summit 2019 in Miami

The Acronis Global Cyber Summit 2019 will be held at the Fontainebleau Miami Beach Resort on October 13–16, 2019, and it promises to be the must-attend event for IT infrastructure managers, CIOs, service providers, value-added resellers, ISVs, and developers.

rpmAuthor Commented:
Ok, that's progress!

I posted the URL, as a POST in Postman. This time I got ...

{
    "error": {
        "code": 401000,
        "message": "The request is not authorized because credentials are missing or invalid."
    }
}

Am I putting the wrong key in?
rpmAuthor Commented:
Has nobody got a simple example in VB for using the API, I am going around in circles?
Shaun VermaakTechnical SpecialistCommented:
Am I putting the wrong key in?
Yes, get a key from the Portal
rpmAuthor Commented:
Thanks for your help, with this help, I got there in the end!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.