Skip to Content

Use the Language Detection API from a REST Client

0 %
Use the Language Detection API from a REST Client
// Explore More Tutorials

Use the Language Detection API from a REST Client


Discover how to call the Language Detection API from a REST Client like Postman

You will learn

  • Call an API from a REST client like Postman
  • The basics about Machine Learning Foundation Service for Language Detection

Note: This service was in alpha version when this tutorial was released.

Step 1: The Language Detection Service

The Language Detection service identifies the language of a given piece of text.

The input text is provided using the request body in a JSON format.

The service will return a JSON response that includes a two-character language ID along with the following series of properties:

Property Description
confidence Carries the prediction confidence score within the range [0,1], 0 being lowest and 1 being highest. For example: confidence value 1 means 100%. 0.1 means 10%
langCode The code used by language as ID.
langStr The English language expansion of the language ID

For more details, you can check the following link:

Log on to answer question
Step 2: Call the API

Open a new tab in Postman.

Make sure that the my-ml-foundation environment is selected.

On the Authorization tab, select Bearer Token, then enter {{OAuthToken}} as value.


Note:: the OAuthToken environment variable can be retrieved following the Get your OAuth Access Token using a REST Client tutorial.

Fill in the following additional information:

Field Name Value
URL the value for LANG_DETECTION_API_URL in your service key

Note As a reminder, the URL depends on you Cloud Platform landscape region but for the trial landscape only Europe (Frankfurt) provide access to the Machine Learning Foundation services.

On the Body tab, select raw then select JSON (application/json) instead of Text.

And in the body area paste the following content:

{"message":"Je suis un développeur SAP"}

Click on Send.

You should receive a response that includes the detected language:

    "detections": [
            "langCode": "fr",
            "confidence": 1,
            "langStr": "French"
Log on to answer question
Step 3: Validate your results

Provide an answer to the question below then click on Validate.

Paste the full response returned with the following message: "ich liebe das SAP-Entwicklerzentrum"

Next Steps

Back to top