IBM Watson Assistant service call returning 404 error message

156 Views Asked by At

I am using this code to call my watson assistant service but getting 404 error message

IamAuthenticator authenticator = new IamAuthenticator(apiKey);
Assistant assistant = new Assistant(version, authenticator);
assistant.setServiceUrl(serviceUrl);
CreateSessionOptions options = new CreateSessionOptions.Builder(assistantId).build();
assistant.createSession(options);
SessionResponse response = assistant.createSession(options).execute().getResult();

I got the URL,apiKey, and assistantId from assistant settings->Assistant IDs and API details

I am not sure what I am missing any idea???

I tried the URL with curl, soapui but nothing is working same error 404

1

There are 1 best solutions below

0
Simon O'Doherty On

Error 404 normally means you have ServiceUrl or Assistant_id incorrect.

Check the following.

  1. That your URL is pointing to the right instance Geo. Go to your assistant settings and you will find the URL. More details on how to find this:
  2. Check that your assistant_id is correct. From the API documentation.

The assistant ID or the environment ID of the environment where the assistant is deployed, depending on the type of request:

  • For message, session, and log requests, specify the environment ID of the environment where the assistant is deployed.
  • For all other requests, specify the assistant ID of the assistant.

To find the environment ID or assistant ID in the Watson Assistant user interface, open the assistant settings and scroll to the Environments section.

Note: If you are using the classic Watson Assistant experience, always use the assistant ID. To find the assistant ID in the user interface, open the assistant settings and click API Details.