Skip to Content

Use the Text Classification API from a REST Client

test
0 %
Use the Text Classification API from a REST Client
Details
// Explore More Tutorials

Use the Text Classification API from a REST Client

2019-03-22

Discover how to call the Text Classification 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 Text Classification

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

Step 1: The Text Classification Service

The Text Classification service classifies text into a set categories, based on a pre-trained text classification model.

The input text is provided using form data (as an element named texts in the form data).

The service will return a JSON response that includes the categories predictions along with a score.

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.

Postman

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
HTTP Method POST
URL the value for TEXT_CLASSIFIER_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, keep form-data selected.

Add a new key named texts and switch it to Text.

Paste the following value:

Ambidextrous shape for all-day comfort.
Optical tracking with 800 dpi sensitivity for precise cursor control.
Works right out of the box just plug and play.
Connector/Port/Interface: USB Left/Right
Hand Use: Left/Right
Mouse Technology: Optical
Wired/Wireless: Wired.

Add a new key named texts and switch it to Text.

Paste the following value:

Get crisp, clear, high-resolution views of your graphics
and data projects with a 1000:1 contrast ratio,
sharp resolutions to 1440 x 900, and fast 5 ms response time
Postman

Click on Send.

You should receive a response that includes a series of entries like this:

Postman
{
    "label": "mice",
    "score": 0.9873610377877724
}
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 previous test.
×

Next Steps

Back to top