SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Call SAP Conversational AI API with OAuth (Postman)

Retrieve an OAuth token and use it to call the SAP Conversational AI API, using Postman.

Overview

🎓 beginner 20 min. SAP Conversational AiBeginnerMachine LearningArtificial Intelligence

You will learn

  • โœ”How to retrieve an OAuth token for use with SAP Conversational AI API
  • โœ”How to call SAP Conversational AI API with an OAuth token
  • โœ”How to set up a Postman collection to call the APIs
Unknown U Unknown November 4, 2022
Created by September 22, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

This tutorial is a companion to the tutorial Call SAP Conversational AI API Using OAuth, which was a more sophisticated setup for calling SAP Conversational AI APIs using a Python server. Here, you will use Postman to more simply show how to retrieve an OAuth token and then call the API.

In Postman, you will set up 3 requests, and put them in a collection so they can be run together and pass arguments to each other:

  • start: This request is a dummy request, but let’s us at the start test whether we already have an OAuth token. If yes, we skip the request for getting a token.

  • get-oauth-credentials: This request takes our chatbot credentials and calls the OAuth service to retrieve a new OAuth token.

  • request: This request is the basic SAP Conversational AI Runtime API for sending an utterance to the NLP. (We could have also used the dialog Runtime API.)

This tutorial also shows off some of the functionality of Postman, from pre-request scripts, to tests, to setting and get environment data in order to pass between requests. It would have been simpler to use the built-in Postman OAuth authentication feature.


Step 1 Create Postman environment
โ€”

We will need to create a Postman environment to store the various credentials for the OAuth and Runtime API credentials.

  1. Open Postman.

  2. In the top-left, click New+.

    New
    New

    Select Environment.

    New
    New

  3. Call the environment OAuth, and create 3 variables:

    • clientid

    • secret

    • requesttoken

    New
    New

  4. Click Update.

Keep the Manage Environments window open. In the next step we will get your credentials and store them in the environment.

The URLs in this tutorial are for the community edition. We could have added the URLs in the environment so the entire setup would have also worked for the enterprise edition.

Step 2 Get and store chatbot credentials
+
Step 3 Create request to start run
+
Step 4 Create request to get OAuth token
+
Step 5 Create request to call chatbot API
+
Step 6 Run collection
+
Step 7 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Create Postman environment 2. Get and store chatbot credentials 3. Create request to start run 4. Create request to get OAuth token 5. Create request to call chatbot API 6. Run collection 7. Test yourself

Learn more →