Step 6: Publish Watson Discovery Service - ruchikajulka/Tutorial--IBM-Watson-Discovery GitHub Wiki

Step 6: Publish Watson Discovery Service

In the next few steps, we will see how we can deploy/publish the Watson discovery service as an API.

  • Keep a note of the important api parameters by clicking on to th “api” button

  • As shown below from the main dashboard screen, we will get the auto-generated service URL

Next, we will create a cloud function by following the below steps –

  • Search for function as shown below:

  • To create a function, we must define an action as shown below and then click “create”

  • Now we will define the parameters for the action, add the following 4 parameters and enter the parameter values the same as what we captured previously (by clicking “API” button”). Click “Save”.

  • Next, Go to the Code tab and copy the code from code.js file, you can find the code.js file under the code folder. Click “Invoke” to test your cloud function.

  • The last step is to enable cloud function as web action i.e. expose it as API. Keep a note of this HTTP URL, this will be used by an application which will call this service.