Skip to content

yoshioterada/JAX-RS-Cognitive-HoL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAX-RS RESTful Web Service to Cognitive Services HoL

This is a Hands on Lab contents for creating Cognitive Services by Java RESTful Web Service(JAX-RS).

Note :

Since 2017/1/17, the Cognitive service endpoint URL had changed to https://westus.api.cognitive.microsoft.com/face/v1.0?WT.mc_id=java-0000-yoterada.

Even now you are using the OLD url (https://api.projectoxford.ai/face/v1.0/ ), please modify the URL ASAP? The old API endpoints will be deprecated 90 days(on 4/15).

Preparation

Then you can see following screen. Cognitive Services Site

Then you can see following screen. So please "Sign up" by using (Microsoft account or GitHub or LinkedIn) account ? Get Started for free

3. Get the Key of Face & Emotion API

After sign up the account, you can see following screen. If you get the key to access the cognitieve services, you can try it.
For example, Please search the key of "Face" and "Emotion" API as follows? Face & Emotion Key Then Please push the link of "Show"? You will be able see the access key like following detital number "3eef5*********************192a87". Face & Emotion Access Key

After you get the access key, please go to the Face API site? Please push the menu of "APIs" on top of the screen? Then advanced menu will be showed and push the link of "Face"? APIs
Then following "Face API" document site will be showed. Face API document site

5. Push API Reference button

After you push the button, folliwng screen will be showed. API Reference site

If you scroll down the screen, you can see the Open API Testing Console button. The please push the button? Open API Testing Console

7. Input Parameters

If you push the button, some inpute text field will be showed on the screen. Then please input some parameters ? Especially pleaes input following parameters ?
Input Parameters
A. returnFaceAttributes : age,gender,smile,facialhair,headpose,glasses
B. Ocp-Apim-Subscription-Key : 3eef5*********************192a87
Please input the Access key to the above field ?
Request body C. Request body :
{
"url":"https://pbs.twimg.com/profile_images/1765776666/s-abetwitter1.png"
}
Please write the url of the picture (which is included a person who want to evaluate).

8. Push "Send" button

After input the parameters, please scroll down and you will be able to see the "Send" button. Then please push the button? Push Send button

9. Confirm the Response

If there is no problem on the request and response, you can see following screen with Response Status Code as 200. If you can't get the response status code as 200, there is some miss configuration or request. So pleas modify the above configuration again ? Confirm the Response

10. Confirm the Request URL and Request Body.

In order to create the application, you need to understand the HTTP method call, URL and Request body. So please understand what kind of the information is needed for the service invocation ?

POST https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender,smile,facialhair,headpose,glasses&WT.mc_id=java-0000-yoterada HTTP/1.1
Content-Type: application/json
Host: westus.api.cognitive.microsoft.com
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{
    "url":"https://pbs.twimg.com/profile_images/1765776666/s-abetwitter1.png"
}

11. Next (Create Java Application)

Create Cognitive Java Application with JAX-RS

Note :

Since 2017/1/17, the Cognitive service endpoint URL had changed to https://westus.api.cognitive.microsoft.com/face/v1.0?WT.mc_id=java-0000-yoterada.

Even now you are using the OLD url (https://api.projectoxford.ai/face/v1.0/ ), please modify the URL ASAP? The old API endpoints will be deprecated 90 days(on 4/15).


About

This is HoL of Cognitive Service with JAX-RS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages