Manage your cognitive processes with IBM Watson and API Connect
Follow 5 simple steps from exposing the Swagger file to publishing the API
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.
Get the Swagger file
- Go to the Watson API Explorer page.
- Under Language, click Language Translator, or go to the Language Translator page.
- In the lower-right corner of the page, right-click the button, and click Copy Link.
Load the Swagger file into API Connect
- Log in to API Connect.
- On the Drafts page, click the APIs tab.
- Click Add, and select Import API from a file or URL.
- In the Import OpenAPI (Swagger) box, click the Or import from URL link.
- In the URL field, right-click, and select Paste.
https://online.swagger.io/validator/debug?url=from the beginning of the URL.
- Click the Add a Product check box.
- Under Info, set the Product Title field to
Watson Language Translator.
- Click Import.
Deploy the Watson API in Bluemix
- Log in to IBM Bluemix at:
- From the hamburger menu in the upper left corner, select Services and then click Watson to go to Watson Services.
- On the next page, click Create Watson service.
- Click Language Translator.
- Click Create.
- On the next page, under Getting started on the left side, click Service Credentials.
- 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.
Create the assembly for the API
- In API Connect, go to the API that you created in Step 2.
- Click Assemble.
- Click Create Assembly.
- Drag the Proxy Policy from the toolbox to the canvas.
- Refer to the Service Credentials that you viewed in Step 3, and set the following details:
- User name
- 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.
Publish the API
- In IBM API Connect, on the Drafts tab, click the APIs tab.
- Click Language Translator.
- 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.
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.
The author thanks Dennis Ashby for his review of this article.
- Translate text using the Watson Language Translator service
- express-no-stress: Build awesome APIs with Express.js and Swagger
- API Connect Developer Center
- Watson Developer Center
- Watson services in Bluemix