0

I'm trying to access my assistant but I'm getting a 404 Not Found error when inserting the iam_api_key and the url provided in the dahsboard. And I can't find the password in the dahsboard.

I'm working with Node.js. I've tried to create other service credentials but nothing worked

{
    username: '{api-key}',
    password: '{password}', // I can't find this
    // OR even
    iam_apikey: '{api-key}'
    url: '{url}',
    version:  '{version}',
    disable_ssl_verification: true,
}

{ Not Found: Resource not found

{ ... }

at at process._tickCallback (internal/process/next_tick.js:188:7) name: 'Not Found', code: 404, message: 'Resource not found',
body: '{"error":"Resource not found","code":404}', headers: { 'x-backside-transport': 'FAIL FAIL', 'content-type': 'application/json; charset=utf-8', 'access-control-allow-origin': '*', 'access-control-allow-methods': 'GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS', 'access-control-allow-headers': 'Content-Type, Content-Length, Authorization, X-Watson-Authorization-Token, X-WDC-PL-OPT-OUT, X-Watson-UserInfo, X-Watson-Learning-Opt-Out, X-Watson-Metadata', 'access-control-max-age': '3600', 'content-security-policy': 'default-src \'none\'', 'x-dns-prefetch-control': 'off', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=31536000;', 'x-download-options': 'noopen', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-global-transaction-id': '{x-global-transaction-id}', 'x-dp-watson-tran-id': '{x-dp-watson-tran-id}', 'x-dp-transit-id': '{x-dp-transit-id}', 'content-length': '41', 'x-edgeconnect-midmile-rtt': '124', 'x-edgeconnect-origin-mex-latency': '142', date: 'Wed, 19 Jun 2019 20:38:08 GMT', connection: 'close' } }

data_henrik
  • 16,724
  • 2
  • 28
  • 49
Joshua jo
  • 3
  • 3
  • You may also have problems with your credentials, but a 404 indicates a more fundamental problem in that you are not able to find the service. Which means that either the url endpoint you are using is wrong, or you are being blocked from finding the endpoint. – chughts Jun 21 '19 at 09:55

2 Answers2

1

You have to use either the api key OR the username / password combination. The API docs for IBM Watson Assistant have code samples for Node.js:

const AssistantV2 = require('ibm-watson/assistant/v2');

const assistant = new AssistantV2({
  version: '{version}',
  iam_apikey: '{apikey}',
  url: '{url}'
});
data_henrik
  • 16,724
  • 2
  • 28
  • 49
0

Use this code as well. It's working on me. I added serviceUrl and headers. Make sure to add the correct service URL according to the assistant URL.

const assistant = new AssistantV2({
  version: "2019-02-28",
  authenticator: authenticator,
  url: process.env.WATSON_ASSISTANT_URL,
  serviceUrl: "https://api.us-south.assistant.watson.cloud.ibm.com",
  headers: {
    "X-Watson-Learning-Opt-Out": "true",
  },
});

Refer more - https://cloud.ibm.com/apidocs/assistant-v2?code=node#endpoint-cloud

Thirasha
  • 193
  • 2
  • 8