Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member253429
Discoverer
Service Ticket Intelligence is a deep learning business service under SAP AI Business Services Portfolio that leverages the Natural Language Processing capabilities to extract and enrich the semantical information for classifying the unstructured data and providing recommendations along with sentiment analysis. For an introduction to STI, you can refer to the blog post here.

This machine learning service takes historical data from service requests and from channels like emails, chat, etc. and returns the Category/Classification prediction with a confidence level. See the full feature scope.

In this blog, we will see how to set up the trial account on the SAP Cloud Platform and test the STI service yourself.

Sections in this blog

  • Trying out Service Ticket Intelligence in Postman.

  • Trying out Service Ticket Intelligence in Swagger UI.


Prerequisite

You can create a free trial account on the SAP Cloud Platform by following these steps which also covers details on the privileges available with Enterprise versus Trial Accounts.

Once you are done with the trial account creation your account should look like this.


Enter your trial account. If you are accessing your trial account for the first time you can choose the region and other entitlements as mentioned in the following tutorial. You can search for the Service Ticket Intelligence Trial to add it to the service plan (as mentioned in Step 2 of the tutorial). Choose the default plan and save your entitlements.

Note: In Trial setup, the quota for services is predefined and you won’t be able to change the configure of the entitlements.

In Step 4 of the above-mentioned tutorial, access the Service Market Place, and search for Service Ticket Intelligence. Click the tile to access the service.


Follow Step 5 to create the service instance and service keys with the defaults. You will need the service keys values to create your ‘access_token’. Please make sure to have a local copy of the service keys.


Service Ticket Intelligence service has built-in Swagger UI making it easier to access the API endpoints and test the service. However, the service can also be tested using the Postman tool.

 

Trying out Service Ticket Intelligence in Postman


 

1.Setting up the Postman Environment:


You can download the API environment and URL collection from Github  (Copy only the JSON files).

Go to the Postman tool and import the 2 JSON files into Postman. On expanding the collection, you can see the endpoints available for STI.


To set up the environment select the dropdown for Environment available on the top right corner and change it to “Env for STI Sample Collection”.

2.Updating the Environment variables:


You can have a quick view of the environment variables by clicking on the button next to the “Environment”.



You can see the default variables with empty values. Now set the “initial” and “current” values based on the values of your service key.

Click on “Manage Environment” and select the environment “Env for STI sample collection”. This will open an editable view of the existing variables.

Fill the values for the following variables and click on the 'Update'.

uaa_url

sti_service_url

Now our environment is ready, you can access any of the endpoints to see the request to the API and the response.

3.Accessing the Endpoints:


 

Example 1: Get Access Token

Select the request ‘Get Access Token’ from the collection.

Go to the ‘Authorization’ tab and fill the uaa-clientId and password (uaa-clientsecret) from uaa section of your service key.


If the request is processed successfully, you’ll get “access_token” as a response. Update the access_token in the environment variables. You need this for further requests.

Example 2: Upload Classification Training File

From the environment, you already get a predefined dataset. The file is uploaded as part of the body of the post request using Base64 encoding.


Your response looks like this.


 


Here you can see your model_id with the model_status=’NEW’.

Start the model training. You can check the progress and the current model status using the request “Get model status”.



Once your model is trained and ready, you can use the PUT request ‘Activate model’ to activate the model that you just trained.


 

Example 4: Classify single message – Inference call

You can start making inference calls to your active model by using the request ‘classify single message’. In the body of the request change the “value”

{

"business_object": "ticket",

"messages":[  { "id": 2001, "contents": [{"field": "description", "value": "Enter your text here" }]}

] }



You’ll get the response with the classification category and confidence level.

Note: If you are using your own dataset to test the service, make sure to use a bigger dataset for better accuracy.

 

Trying out Service Ticket Intelligence in Swagger UI


 

To access Swagger UI,    /sti to the ‘sti_service_url’ from the service keys. You should get this page:


To be able to use the endpoints you first need to authorize yourself. Please follow the steps in the tutorial “Get OAuth Access Token” to get the bearer token. Make a local copy of the bearer <access token> as we need it in further steps.

On Swagger UI, please click on the “Authorize” button and enter the bearer token (apiKey) in the format shown below.

bearer <access_token>


Click on Authorize and Close.

Once authorized you can click on any endpoint name to expand it, click Try it out, and then Execute.



You’ll see the response in JSON format.

Conclusion:


I hope this blog post helps you in getting started and trying out the Service Ticket Intelligence API.

Would you like more ways to try out the API? Please leave your comments.