Contents


Manage your cognitive processes with IBM Watson and API Connect

Follow 5 simple steps from exposing the Swagger file to publishing the API

Comments

IBM® Watson® is an AI platform that helps businesses to uncover insights, engage in new ways, and make decisions with more confidence. The numerous Watson APIs that are available both analyze and process data. IBM API Connect™ provides a way to control back-end systems, such as the ones you run inside your organization or services that you run on IBM Bluemix®.

This tutorial demonstrates how you can expose the Swagger file for IBM Watson as an API in API Connect. By having access to Watson APIs in API Connect, you can control and track usage of how your organization is using Watson.

The steps in this tutorial use the Watson Language Translator API as an example. However, you can use these steps for any Watson APIs.

1

Get the Swagger file

  1. Go to the Watson API Explorer page.
  2. Under Language, click Language Translator, or go to the Language Translator page.
  3. In the lower-right corner of the page, right-click the VALID                         {...} button, and click Copy Link.
2

Load the Swagger file into API Connect

  1. Log in to API Connect.
  2. On the Drafts page, click the APIs tab.
  3. Click Add, and select Import API from a file or URL. Clicking Add to import the API
  4. In the Import OpenAPI (Swagger) box, click the Or import from URL link. Importing the API
    Importing the API
  5. In the URL field, right-click, and select Paste.
  6. Remove https://online.swagger.io/validator/debug?url= from the beginning of the URL.
  7. Click the Add a Product check box.
  8. Under Info, set the Product Title field to Watson Language Translator.
  9. Click Import.
3

Deploy the Watson API in Bluemix

  1. Log in to IBM Bluemix at: https://console.bluemix.net/dashboard/.
  2. From the hamburger menu in the upper left corner, select Services and then click Watson to go to Watson Services. Watson Services
  3. On the next page, click Create Watson service.
  4. Click Language Translator. Language Translator
    Language Translator
  5. Click Create.
  6. On the next page, under Getting started on the left side, click Service Credentials.
  7. In the right pane, in the Service credentials box (see the following figure), click View Credentials. The URL, user name, and password credentials are required in Step 4. Service credentials
    Service credentials
4

Create the assembly for the API

  1. In API Connect, go to the API that you created in Step 2.
  2. Click Assemble.
  3. Click Create Assembly.
  4. Drag the Proxy Policy from the toolbox to the canvas.
  5. Refer to the Service Credentials that you viewed in Step 3, and set the following details:
    1. URL
    2. User name
    3. Password
  6. Click the Save (disk icon) in the upper-right corner of the window.

If you require more configuration, such as security, you can extend the API in the Design view to add these functions.

5

Publish the API

  1. In IBM API Connect, on the Drafts tab, click the APIs tab. API                     Connect menu
    API Connect menu
  2. Click Language Translator.
  3. Click the Save icon in the upper-right corner. Then, select the catalog that you want to deploy the API into. In this example, the API is deployed to the Sandbox catalog. Deploying the API to the catalog

Conclusion

In this article, you learned how to locate the Watson Swagger file and load it into API Connect. You then created an assembly, deployed a Watson Service, and published it as an API. You can use these same steps for any Watson APIs.

Ready to get started? Use the Language Translator API to translate text from one language to another for specific domains. Then, see how else you can use other Watson services, such as the Tone Analyzer API to analyze the tone of support transcripts or the Conversation API to automate interactions with your users, using virtual agents and chat bots.

Acknowledgments

The author thanks Dennis Ashby for his review of this article.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Middleware, Cloud computing
ArticleID=1047540
ArticleTitle=Manage your cognitive processes with IBM Watson and API Connect
publish-date=07122017