Introduction

IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual filtering of results.

This documentation describes Java SDK major version 9. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Node SDK major version 6. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Python SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Ruby SDK major version 2. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes .NET Standard SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Go SDK major version 2. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Swift SDK major version 4. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Unity SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created after that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created after that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

This API reference applies to Premium Discovery instances created after 16 July 2020. For more information about features in Discovery Premium instances created before that date, see the v1 API.

The IBM Watson Unity SDK has the following requirements.

  • The SDK requires Unity version 2018.2 or later to support Transport Layer Security (TLS) 1.2.
    • Set the project settings for both the Scripting Runtime Version and the Api Compatibility Level to .NET 4.x Equivalent.
    • For more information, see TLS 1.0 support.
  • The SDK doesn't support the WebGL projects. Change your build settings to any platform except WebGL.

For more information about how to install and configure the SDK and SDK Core, see https://github.com/watson-developer-cloud/unity-sdk.

The code examples on this tab use the client library that is provided for Java.

Maven

<dependency>
  <groupId>com.ibm.watson</groupId>
  <artifactId>ibm-watson</artifactId>
  <version>9.0.2</version>
</dependency>

Gradle

compile 'com.ibm.watson:ibm-watson:9.0.2'

GitHub

The code examples on this tab use the client library that is provided for Node.js.

Installation

npm install ibm-watson@^6.0.3

GitHub

The code examples on this tab use the client library that is provided for Python.

Installation

pip install --upgrade "ibm-watson>=5.1.0"

GitHub

The code examples on this tab use the client library that is provided for Ruby.

Installation

gem install ibm_watson

GitHub

The code examples on this tab use the client library that is provided for Go.

go get -u github.com/watson-developer-cloud/go-sdk@v2.0.2

GitHub

The code examples on this tab use the client library that is provided for Swift.

Cocoapods

pod 'IBMWatsonDiscoveryV2', '~> 4.1.0'

Carthage

github "watson-developer-cloud/swift-sdk" ~> 4.1.0

Swift Package Manager

.package(url: "https://github.com/watson-developer-cloud/swift-sdk", from: "4.1.0")

GitHub

The code examples on this tab use the client library that is provided for .NET Standard.

Package Manager

Install-Package IBM.Watson.Discovery.v2 -Version 5.1.0

.NET CLI

dotnet add package IBM.Watson.Discovery.v2 --version 5.1.0

PackageReference

<PackageReference Include="IBM.Watson.Discovery.v2" Version="5.1.0" />

GitHub

The code examples on this tab use the client library that is provided for Unity.

GitHub

Authentication

IBM Cloud services use IBM Cloud Identity and Access Management (IAM) to authenticate. With IBM Cloud Pak for Data, you pass a bearer token.

IBM Cloud

For IBM Cloud instances, you authenticate to the API by using IBM Cloud Identity and Access Management (IAM).

You can pass either a bearer token in an authorization header or an API key. Tokens support authenticated requests without embedding service credentials in every call. API keys use basic authentication. For more information, see Authenticating to Watson services.

  • For testing and development, you can pass an API key directly.
  • For production use, unless you use the Watson SDKs, use an IAM token.

If you pass in an API key, use apikey for the username and the value of the API key as the password. For example, if the API key is f5sAznhrKQyvBFFaZbtF60m5tzLbqWhyALQawBg5TjRI in the service credentials, include the credentials in your call like this:

curl -u "apikey:f5sAznhrKQyvBFFaZbtF60m5tzLbqWhyALQawBg5TjRI"

For IBM Cloud instances, the SDK provides initialization methods for each form of authentication.

  • Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
  • Use the access token to manage the lifecycle yourself. You must periodically refresh the token.

For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.

IBM Cloud. Replace {apikey} and {url} with your service credentials.

curl -X {request_method} -u "apikey:{apikey}" "{url}/v2/{method}"

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("{url}");

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { IamAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
});

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('{url}')

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "{url}"

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/discoveryv2"
)

func main() {
  authenticator := &core.IamAuthenticator{
    ApiKey: "{apikey}",
  }

  options := &discoveryv2.DiscoveryV2Options{
    Version: "{version}",
    Authenticator: authenticator,
  }

  discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

  if discoveryErr != nil {
    panic(discoveryErr)
  }

  discovery.SetServiceURL("{url}")
}

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "{url}"

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

IBM Cloud. SDK managing the IAM token. Replace {apikey}, {version}, and {url}.

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

Cloud Pak for Data

For Cloud Pak for Data, you pass a bearer token in an Authorization header to authenticate to the API. The token is associated with a username.

  • For testing and development, you can use the bearer token that's displayed in the Cloud Pak for Data web client. To find this token, view the details for the provisioned service instance. The details also include the service endpoint URL. Don't use this token in production because it does not expire.
  • For production use, create a user in the Cloud Pak for Data web client to use for authentication. Generate a token from that user's credentials with the POST preauth/validateAuth method.

For Cloud Pak for Data instances, pass either username and password credentials or a bearer token that you generate to authenticate to the API. Username and password credentials use basic authentication. However, the SDK manages the lifecycle of the token. Tokens are temporary security credentials. If you pass a token, you maintain the token lifecycle.

For production use, create a user in the Cloud Pak for Data web client to use for authentication, and decide which authentication mechanism to use.

  • To have the SDK manage the lifecycle of the token, use the username and password for that new user in your calls.
  • To manage the lifecycle of the token yourself, generate a token from that user's credentials. Call the POST preauth/validateAuth method to generate the token, and then pass the token in an Authorization header in your calls. You can see an example of the method on the Curl tab.

Don't use the bearer token that's displayed in the web client for the instance except during testing and development because that token does not expire.

To find your value for {cpd_cluster_host}, {:port}, and {instance_id}, view the service credentials by viewing the details for the provisioned service instance in the Cloud Pak for Data web client.

Cloud Pak for Data. Generating a bearer token. The response includes an accessToken property.

Replace {cpd_cluster_host} and {port} with the details for the service instance. Replace {username} and {password} with your Cloud Pak for Data credentials.

curl -k -u "{username}:{password}" "https://{cpd_cluster_host}{:port}/v1/preauth/validateAuth"

Authenticating to the API. Replace {accessToken} with your details.

curl -H "Authorization: Bearer {accessToken}" "{url}/v2/{method}"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}',
  }),
  serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
});

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}',
    'https://{cpd_cluster_host}{:port}'
)

discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api')

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::CloudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/discoveryv2"
)

func main() {
  authenticator := &core.CloudPakForDataAuthenticator{
    URL: "https://{cpd_cluster_host}{:port}",
    Username: "{username}",
    Password: "{password}",
  }

  options := &discoveryv2.DiscoveryV2Options{
    Version: "{version}",
    Authenticator: authenticator,
  }

  discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

  if discoveryErr != nil {
    panic(discoveryErr)
  }

  discovery.SetServiceURL("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api")
}

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

let authenticator = WatsonCloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. Replace {version} with the service version date. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Access between services

Your application might use more than one Watson service. You can grant access between services and you can grant access to more than one service for your applications.

For IBM Cloud services, the method to grant access between Watson services varies depending on the type of API key. For more information, see IAM access.

  • To grant access between IBM Cloud services, create an authorization between the services. For more information, see Granting access between services.
  • To grant access to your services by applications without using user credentials, create a service ID, add an API key, and assign access policies. For more information, see Creating and working with service IDs.

Make sure that you use an endpoint URL that includes the service instance ID (for example, https://api.us-south.discovery.watson.cloud.ibm.com/instances/6bbda3b3-d572-45e1-8c54-22d6ed9e52c2). You can find the instance ID in two places:

  • By clicking the service instance row in the Resource list. The instance ID is the GUID in the details pane.
  • By clicking the name of the service instance in the list and looking at the credentials URL.

    If you don't see the instance ID in the URL, you can add new credentials from the Service credentials page.

Because the Cloud Pak for Data bearer token is associated with a username, you can use the token for all CPD Watson services that are associated with the username.

Endpoint URLs

Identify the base URL for your service instance.

IBM Cloud URLs

The base URLs come from the service instance. To find the URL, view the service credentials by clicking the name of the service in the Resource list. Use the value of the URL. Add the method to form the complete API endpoint for your request.

The following example URL represents a Discovery instance that is hosted in Washington DC:

https://api.us-east.discovery.watson.cloud.ibm.com/instances/6bbda3b3-d572-45e1-8c54-22d6ed9e52c2

The following URLs represent the base URLs for Discovery. When you call the API, use the URL that corresponds to the location of your service instance.

  • Dallas: https://api.us-south.discovery.watson.cloud.ibm.com
  • Washington DC: https://api.us-east.discovery.watson.cloud.ibm.com
  • Frankfurt: https://api.eu-de.discovery.watson.cloud.ibm.com
  • Sydney: https://api.au-syd.discovery.watson.cloud.ibm.com
  • Tokyo: https://api.jp-tok.discovery.watson.cloud.ibm.com
  • London: https://api.eu-gb.discovery.watson.cloud.ibm.com
  • Seoul: https://api.kr-seo.discovery.watson.cloud.ibm.com

Set the correct service URL by calling the setServiceUrl() method of the service instance.

Set the correct service URL by specifying the serviceUrl parameter when you create the service instance.

Set the correct service URL by calling the set_service_url() method of the service instance.

Set the correct service URL by specifying the service_url property of the service instance.

Set the correct service URL by calling the SetServiceURL() method of the service instance.

Set the correct service URL by setting the serviceURL property of the service instance.

Set the correct service URL by calling the SetServiceUrl() method of the service instance.

Set the correct service URL by calling the SetServiceUrl() method of the service instance.

Dallas API endpoint example for services managed on IBM Cloud

curl -X {request_method} -u "apikey:{apikey}" "https://api.us-south.discovery.watson.cloud.ibm.com/instances/{instance_id}"

Your service instance might not use this URL

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("https://api.us-east.discovery.watson.cloud.ibm.com");

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { IamAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: 'https://api.us-east.discovery.watson.cloud.ibm.com',
});

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('https://api.us-east.discovery.watson.cloud.ibm.com')

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "https://api.us-east.discovery.watson.cloud.ibm.com"

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

if discoveryErr != nil {
  panic(discoveryErr)
}

discovery.SetServiceURL("https://api.us-east.discovery.watson.cloud.ibm.com")

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "https://api.us-east.discovery.watson.cloud.ibm.com"

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://api.us-east.discovery.watson.cloud.ibm.com");

Default URL

https://api.us-south.discovery.watson.cloud.ibm.com

Example for the Washington DC location

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://api.us-east.discovery.watson.cloud.ibm.com");

Cloud Pak for Data URLs

For services installed on Cloud Pak for Data, the base URLs come from the cluster and add-on service instance. The URL follows this pattern:

https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api
  • {cpd_cluster_host} represents the name or IP address of your deployed cluster. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.
  • {port} represents the port number on which the service listens.
  • {release} represents the release name that was specified when the Helm chart was installed.
  • {instance_id} represents the identifier of the service instance.

To find the base URL, view the details for the service instance from the Cloud Pak for Data web client.

Use that URL in your requests to Discovery v2.

Set the URL by calling the setServiceUrl() method of the service instance.

Set the correct service URL by specifying the serviceUrl parameter when you create the service instance.

Set the correct service URL by specifying the url parameter when you create the service instance or by calling the set_url() method of the service instance.

Set the correct service URL by specifying the url parameter when you create the service instance or by calling the url= method of the service instance.

Set the correct service URL by specifying the URL parameter when you create the service instance or by calling the SetURL= method of the service instance.

Set the correct service URL by setting the serviceURL property of the service instance.

Set the correct service URL by calling the SetEndpoint() method of the service instance.

Set the correct service URL by setting the Url property of the service instance.

Endpoint example for Cloud Pak for Data

curl -X {request_method} -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api/v2/{method}"

Endpoint example for Cloud Pak for Data

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Endpoint example for Cloud Pak for Data

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}',
  }),
  serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
});

Endpoint example for Cloud Pak for Data

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}',
    'https://{cpd_cluster_host}{:port}'
)

discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api')

Endpoint example for Cloud Pak for Data

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::CLoudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

Endpoint example for Cloud Pak for Data

discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

if discoveryErr != nil {
  panic(discoveryErr)
}

discovery.SetServiceURL("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api")

Endpoint example for Cloud Pak for Data

let authenticator = CloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

Endpoint example for Cloud Pak for Data

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Endpoint example for Cloud Pak for Data

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

Disabling SSL verification

All Watson services use Secure Sockets Layer (SSL) (or Transport Layer Security (TLS)) for secure connections between the client and server. The connection is verified against the local certificate store to ensure authentication, integrity, and confidentiality.

If you use a self-signed certificate, you need to disable SSL verification to make a successful connection.

Enabling SSL verification is highly recommended. Disabling SSL jeopardizes the security of the connection and data. Disable SSL only if necessary, and take steps to enable SSL as soon as possible.

To disable SSL verification for a curl request, use the --insecure (-k) option with the request.

To disable SSL verification, create an HttpConfigOptions object and set the disableSslVerification property to true. Then, pass the object to the service instance by using the configureClient method.

To disable SSL verification, set the disableSslVerification parameter to true when you create the service instance.

To disable SSL verification, specify True on the set_disable_ssl_verification method for the service instance.

To disable SSL verification, set the disable_ssl_verification parameter to true in the configure_http_client() method for the service instance.

To disable SSL verification, call the DisableSSLVerification method on the service instance.

To disable SSL verification, call the disableSSLVerification() method on the service instance. You cannot disable SSL verification on Linux.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

To disable SSL verification, create an HttpConfigOptions object and set the disableSslVerification property to true. Then, pass the object to the service instance by using the configureClient method.

To disable SSL verification, set the disableSslVerification parameter to true when you create the service instance.

To disable SSL verification, specify True on the set_disable_ssl_verification method for the service instance.

To disable SSL verification, set the disable_ssl_verification parameter to true in the configure_http_client() method for the service instance.

To disable SSL verification, call the DisableSSLVerification method on the service instance.

To disable SSL verification, call the disableSSLVerification() method on the service instance. You cannot disable SSL verification on Linux.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

Example to disable SSL verification with a service managed on IBM Cloud. Replace {apikey} and {url} with your service credentials.

curl -k -X {request_method} -u "apikey:{apikey}" "{url}/{method}"

Example to disable SSL verification with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("{url}");

HttpConfigOptions configOptions = new HttpConfigOptions.Builder()
  .disableSslVerification(true)
  .build();
discovery.configureClient(configOptions);

Example to disable SSL verification with a service managed on IBM Cloud

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { IamAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
  disableSslVerification: true,
});

Example to disable SSL verification with a service managed on IBM Cloud

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('{url}')

discovery.set_disable_ssl_verification(True)

Example to disable SSL verification with a service managed on IBM Cloud

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "{url}"

discovery.configure_http_client(disable_ssl_verification: true)

Example to disable SSL verification with a service managed on IBM Cloud

discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

if discoveryErr != nil {
  panic(discoveryErr)
}

discovery.SetServiceURL("{url}")

discovery.DisableSSLVerification()

Example to disable SSL verification with a service managed on IBM Cloud

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "{url}"

discovery.disableSSLVerification()

Example to disable SSL verification with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.DisableSslVerification(true);

Example to disable SSL verification with a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.DisableSslVerification = true;

Example to disable SSL verification with an installed service

curl -k -X {request_method} -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api/v2/{method}"

Example to disable SSL verification with an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api";

HttpConfigOptions configOptions = new HttpConfigOptions.Builder()
  .disableSslVerification(true)
  .build();
discovery.configureClient(configOptions);

Example to disable SSL verification with an installed service

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}',
  }),
  serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
  disableSslVerification: true,
});

Example to disable SSL verification with an installed service

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}'
)

discovery = DiscoveryV2(
    version='{version}',
    authenticator=authenticator
)

discovery.set_service_url('https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api')

discovery.set_disable_ssl_verification(True)

Example to disable SSL verification with an installed service

require "ibm_watson/authenticators"
require "ibm_watson/discovery_v2"
include IBMWatson

authenticator = Authenticators::CLoudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

discovery.configure_http_client(disable_ssl_verification: true)

Example to disable SSL verification with an installed service

discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

if discoveryErr != nil {
  panic(discoveryErr)
}

discovery.SetServiceURL("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api")

discovery.DisableSSLVerification()

Example to disable SSL verification with an installed service

let authenticator = WatsonCloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"

discovery.disableSSLVerification()

Example to disable SSL verification with an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

discovery.DisableSslVerification(true);

Example to disable SSL verification with an installed service

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

discovery.DisableSslVerification = true;

Versioning

API requests require a version parameter that takes a date in the format version=YYYY-MM-DD. When we change the API in a backwards-incompatible way, we release a new version date.

Send the version parameter with every API request. The service uses the API version for the date you specify, or the most recent version before that date. Don't default to the current date. Instead, specify a date that matches a version that is compatible with your app, and don't change it until your app is ready for a later version.

Specify the version to use on API requests with the version parameter when you create the service instance. The service uses the API version for the date you specify, or the most recent version before that date. Don't default to the current date. Instead, specify a date that matches a version that is compatible with your app, and don't change it until your app is ready for a later version.

This documentation describes the current version of Discovery, 2019-11-22. In some cases, differences in earlier versions are noted in the descriptions of parameters and response models.

Error handling

Discovery uses standard HTTP response codes to indicate whether a method completed successfully. HTTP response codes in the 2xx range indicate success. A response in the 4xx range is some sort of failure, and a response in the 5xx range usually indicates an internal system error that cannot be resolved by the user. Response codes are listed with the method.

ErrorResponse

Name Description
code
integer
The HTTP response code.
error
string
General description of an error.

The Java SDK generates an exception for any unsuccessful method invocation. All methods that accept an argument can also throw an IllegalArgumentException.

Exception Description
IllegalArgumentException An invalid argument was passed to the method.

When the Java SDK receives an error response from the Discovery service, it generates an exception from the com.ibm.watson.developer_cloud.service.exception package. All service exceptions contain the following fields.

Field Description
statusCode The HTTP response code that is returned.
message A message that describes the error.

When the Node SDK receives an error response from the Discovery service, it creates an Error object with information that describes the error that occurred. This error object is passed as the first parameter to the callback function for the method. The contents of the error object are as shown in the following table.

Error

Field Description
code The HTTP response code that is returned.
message A message that describes the error.

The Python SDK generates an exception for any unsuccessful method invocation. When the Python SDK receives an error response from the Discovery service, it generates an ApiException with the following fields.

Field Description
code The HTTP response code that is returned.
message A message that describes the error.
info A dictionary of additional information about the error.

When the Ruby SDK receives an error response from the Discovery service, it generates an ApiException with the following fields.

Field Description
code The HTTP response code that is returned.
message A message that describes the error.
info A dictionary of additional information about the error.

The Go SDK generates an error for any unsuccessful service instantiation and method invocation. You can check for the error immediately. The contents of the error object are as shown in the following table.

Error

Field Description
code The HTTP response code that is returned.
message A message that describes the error.

The Swift SDK returns a WatsonError in the completionHandler any unsuccessful method invocation. This error type is an enum that conforms to LocalizedError and contains an errorDescription property that returns an error message. Some of the WatsonError cases contain associated values that reveal more information about the error.

Field Description
errorDescription A message that describes the error.

When the .NET Standard SDK receives an error response from the Discovery service, it generates a ServiceResponseException with the following fields.

Field Description
Message A message that describes the error.
CodeDescription The HTTP response code that is returned.

When the Unity SDK receives an error response from the Discovery service, it generates an IBMError with the following fields.

Field Description
Url The URL that generated the error.
StatusCode The HTTP response code returned.
ErrorMessage A message that describes the error.
Response The contents of the response from the server.
ResponseHeaders A dictionary of headers returned by the request.

Example error handling

try {
  // Invoke a method
} catch (NotFoundException e) {
  // Handle Not Found (404) exception
} catch (RequestTooLargeException e) {
  // Handle Request Too Large (413) exception
} catch (ServiceResponseException e) {
  // Base class for all exceptions caused by error responses from the service
  System.out.println("Service returned status code "
    + e.getStatusCode() + ": " + e.getMessage());
}

Example error handling

discovery.method(params)
  .catch(err => {
    console.log('error:', err);
  });

Example error handling

from ibm_watson import ApiException
try:
    # Invoke a method
except ApiException as ex:
    print "Method failed with status code " + str(ex.code) + ": " + ex.message

Example error handling

require "ibm_watson"
begin
  # Invoke a method
rescue IBMWatson::ApiException => ex
  print "Method failed with status code #{ex.code}: #{ex.error}"
end

Example error handling

import "github.com/watson-developer-cloud/go-sdk/discoveryv2"

// Instantiate a service
discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

// Check for errors
if discoveryErr != nil {
  panic(discoveryErr)
}

// Call a method
result, response, responseErr := discovery.MethodName(&methodOptions)

// Check for errors
if responseErr != nil {
  panic(responseErr)
}

Example error handling

discovery.method() {
  response, error in

  if let error = error {
    switch error {
    case let .http(statusCode, message, metadata):
      switch statusCode {
      case .some(404):
        // Handle Not Found (404) exception
        print("Not found")
      case .some(413):
        // Handle Request Too Large (413) exception
        print("Payload too large")
      default:
        if let statusCode = statusCode {
          print("Error - code: \(statusCode), \(message ?? "")")
        }
      }
    default:
      print(error.localizedDescription)
    }
    return
  }

  guard let result = response?.result else {
    print(error?.localizedDescription ?? "unknown error")
    return
  }

  print(result)
}

Example error handling

try
{
    // Invoke a method
}
catch(ServiceResponseException e)
{
    Console.WriteLine("Error: " + e.Message);
}
catch (Exception e)
{
    Console.WriteLine("Error: " + e.Message);
}

Example error handling

// Invoke a method
discovery.MethodName(Callback, Parameters);

// Check for errors
private void Callback(DetailedResponse<ExampleResponse> response, IBMError error)
{
    if (error == null)
    {
        Log.Debug("ExampleCallback", "Response received: {0}", response.Response);
    }
    else
    {
        Log.Debug("ExampleCallback", "Error received: {0}, {1}, {3}", error.StatusCode, error.ErrorMessage, error.Response);
    }
}

Data handling

Additional headers

Some Watson services accept special parameters in headers that are passed with the request.

You can pass request header parameters in all requests or in a single request to the service.

To pass a request header, use the --header (-H) option with a curl request.

To pass header parameters with every request, use the setDefaultHeaders method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, use the addHeader method as a modifier on the request before you execute it.

To pass header parameters with every request, specify the headers parameter when you create the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, use the headers method as a modifier on the request before you execute it.

To pass header parameters with every request, specify the set_default_headers method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, include headers as a dict in the request.

To pass header parameters with every request, specify the add_default_headers method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, specify the headers method as a chainable method in the request.

To pass header parameters with every request, specify the SetDefaultHeaders method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, specify the Headers as a map in the request.

To pass header parameters with every request, add them to the defaultHeaders property of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, pass the headers parameter to the request method.

To pass header parameters in a single request, use the WithHeader() method as a modifier on the request before you execute it. See Data collection for an example use of this method.

To pass header parameters in a single request, use the WithHeader() method as a modifier on the request before you execute it.

Example header parameter in a request

curl -X {request_method} -H "Request-Header: {header_value}" "{url}/v2/{method}"

Example header parameter in a request

ReturnType returnValue = discovery.methodName(parameters)
  .addHeader("Custom-Header", "{header_value}")
  .execute();

Example header parameter in a request

const parameters = {
  {parameters}
};

discovery.methodName(
  parameters,
  headers: {
    'Custom-Header': '{header_value}'
  })
   .then(result => {
    console.log(response);
  })
  .catch(err => {
    console.log('error:', err);
  });

Example header parameter in a request

response = discovery.methodName(
    parameters,
    headers = {
        'Custom-Header': '{header_value}'
    })

Example header parameter in a request

response = discovery.headers(
  "Custom-Header" => "{header_value}"
).methodName(parameters)

Example header parameter in a request

result, response, responseErr := discovery.MethodName(
  &methodOptions{
    Headers: map[string]string{
      "Accept": "application/json",
    },
  },
)

Example header parameter in a request

let customHeader: [String: String] = ["Custom-Header": "{header_value}"]
discovery.methodName(parameters, headers: customHeader) {
  response, error in
}

Example header parameter in a request for a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

discovery.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for an installed service

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");

discovery.WithHeader("Custom-Header", "header_value");

Response details

The Discovery service might return information to the application in response headers.

To access all response headers that the service returns, include the --include (-i) option with a curl request. To see detailed response data for the request, including request headers, response headers, and extra debugging information, include the --verbose (-v) option with the request.

Example request to access response headers

curl -X {request_method} {authentication_method} --include "{url}/v2/{method}"

To access information in the response headers, use one of the request methods that returns details with the response: executeWithDetails(), enqueueWithDetails(), or rxWithDetails(). These methods return a Response<T> object, where T is the expected response model. Use the getResult() method to access the response object for the method, and use the getHeaders() method to access information in response headers.

Example request to access response headers

Response<ReturnType> response = discovery.methodName(parameters)
  .executeWithDetails();
// Access response from methodName
ReturnType returnValue = response.getResult();
// Access information in response headers
Headers responseHeaders = response.getHeaders();

All response data is available in the Response<T> object that is returned by each method. To access information in the response object, use the following properties.

Property Description
result Returns the response for the service-specific method.
headers Returns the response header information.
status Returns the HTTP status code.

Example request to access response headers

discovery.methodName(parameters)
  .then(response => {
    console.log(response.headers);
  })
  .catch(err => {
    console.log('error:', err);
  });

The return value from all service methods is a DetailedResponse object. To access information in the result object or response headers, use the following methods.

DetailedResponse

Method Description
get_result() Returns the response for the service-specific method.
get_headers() Returns the response header information.
get_status_code() Returns the HTTP status code.

Example request to access response headers

discovery.set_detailed_response(True)
response = discovery.methodName(parameters)
# Access response from methodName
print(json.dumps(response.get_result(), indent=2))
# Access information in response headers
print(response.get_headers())
# Access HTTP response status
print(response.get_status_code())

The return value from all service methods is a DetailedResponse object. To access information in the response object, use the following properties.

DetailedResponse

Property Description
result Returns the response for the service-specific method.
headers Returns the response header information.
status Returns the HTTP status code.

Example request to access response headers

response = discovery.methodName(parameters)
# Access response from methodName
print response.result
# Access information in response headers
print response.headers
# Access HTTP response status
print response.status

The return value from all service methods is a DetailedResponse object. To access information in the response object or response headers, use the following methods.

DetailedResponse

Method Description
GetResult() Returns the response for the service-specific method.
GetHeaders() Returns the response header information.
GetStatusCode() Returns the HTTP status code.

Example request to access response headers

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/discoveryv2"
)
result, response, responseErr := discovery.MethodName(
  &methodOptions{})
// Access result
core.PrettyPrint(response.GetResult(), "Result ")

// Access response headers
core.PrettyPrint(response.GetHeaders(), "Headers ")

// Access status code
core.PrettyPrint(response.GetStatusCode(), "Status Code ")

All response data is available in the WatsonResponse<T> object that is returned in each method's completionHandler.

Example request to access response headers

discovery.methodName(parameters) {
  response, error in

  guard let result = response?.result else {
    print(error?.localizedDescription ?? "unknown error")
    return
  }
  print(result) // The data returned by the service
  print(response?.statusCode)
  print(response?.headers)
}

The response contains fields for response headers, response JSON, and the status code.

DetailedResponse

Property Description
Result Returns the result for the service-specific method.
Response Returns the raw JSON response for the service-specific method.
Headers Returns the response header information.
StatusCode Returns the HTTP status code.

Example request to access response headers

var results = discovery.MethodName(parameters);

var result = results.Result;            //  The result object
var responseHeaders = results.Headers;  //  The response headers
var responseJson = results.Response;    //  The raw response JSON
var statusCode = results.StatusCode;    //  The response status code

The response contains fields for response headers, response JSON, and the status code.

DetailedResponse

Property Description
Result Returns the result for the service-specific method.
Response Returns the raw JSON response for the service-specific method.
Headers Returns the response header information.
StatusCode Returns the HTTP status code.

Example request to access response headers

private void Example()
{
    discovery.MethodName(Callback, Parameters);
}

private void Callback(DetailedResponse<ResponseType> response, IBMError error)
{
    var result = response.Result;                 //  The result object
    var responseHeaders = response.Headers;       //  The response headers
    var responseJson = reresponsesults.Response;  //  The raw response JSON
    var statusCode = response.StatusCode;         //  The response status code
}

Data collection (IBM Cloud)

By default, Discovery service instances managed on IBM Cloud that are not part of Premium plans log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public. Logging is disabled for services that are part of Premium plans.

To prevent IBM usage of your data for an API request, set the X-Watson-Learning-Opt-Out header parameter to true.

You must set the header on each request that you do not want IBM to access for general service improvements.

You can set the header by using the setDefaultHeaders method of the service object.

You can set the header by using the headers parameter when you create the service object.

You can set the header by using the set_default_headers method of the service object.

You can set the header by using the add_default_headers method of the service object.

You can set the header by using the SetDefaultHeaders method of the service object.

You can set the header by adding it to the defaultHeaders property of the service object.

You can set the header by using the WithHeader() method of the service object.

Example request with a service managed on IBM Cloud

curl -u "apikey:{apikey}" -H "X-Watson-Learning-Opt-Out: true" "{url}/{method}"

Example request with a service managed on IBM Cloud

Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Watson-Learning-Opt-Out", "true");

discovery.setDefaultHeaders(headers);

Example request with a service managed on IBM Cloud

const DiscoveryV2 = require('ibm-watson/discovery/v2');
const { IamAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV2({
  version: '{version}',
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
  headers: {
    'X-Watson-Learning-Opt-Out': 'true'
  }
});

Example request with a service managed on IBM Cloud

discovery.set_default_headers({'x-watson-learning-opt-out': "true"})

Example request with a service managed on IBM Cloud

discovery.add_default_headers(headers: {"x-watson-learning-opt-out" => "true"})

Example request with a service managed on IBM Cloud

import "net/http"

headers := http.Header{}
headers.Add("x-watson-learning-opt-out", "true")
discovery.SetDefaultHeaders(headers)

Example request with a service managed on IBM Cloud

discovery.defaultHeaders["X-Watson-Learning-Opt-Out"] = "true"

Example request with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

DiscoveryService discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.WithHeader("X-Watson-Learning-Opt-Out", "true");

Example request with a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var discovery = new DiscoveryService("{version}", authenticator);
discovery.SetServiceUrl("{url}");

discovery.WithHeader("X-Watson-Learning-Opt-Out", "true");

Synchronous and asynchronous requests

The Java SDK supports both synchronous (blocking) and asynchronous (non-blocking) execution of service methods. All service methods implement the ServiceCall interface.

  • To call a method synchronously, use the execute method of the ServiceCall interface. You can call the execute method directly from an instance of the service.
  • To call a method asynchronously, use the enqueue method of the ServiceCall interface to receive a callback when the response arrives. The ServiceCallback interface of the method's argument provides onResponse and onFailure methods that you override to handle the callback.

The Ruby SDK supports both synchronous (blocking) and asynchronous (non-blocking) execution of service methods. All service methods implement the Concurrent::Async module. When you use the synchronous or asynchronous methods, an IVar object is returned. You access the DetailedResponse object by calling ivar_object.value.

For more information about the Ivar object, see the IVar class docs.

  • To call a method synchronously, either call the method directly or use the .await chainable method of the Concurrent::Async module.

    Calling a method directly (without .await) returns a DetailedResponse object.

  • To call a method asynchronously, use the .async chainable method of the Concurrent::Async module.

You can call the .await and .async methods directly from an instance of the service.

Example synchronous request

ReturnType returnValue = discovery.method(parameters).execute();

Example asynchronous request

discovery.method(parameters).enqueue(new ServiceCallback<ReturnType>() {
  @Override public void onResponse(ReturnType response) {
    . . .
  }
  @Override public void onFailure(Exception e) {
    . . .
  }
});

Example synchronous request

response = discovery.method_name(parameters)

or

response = discovery.await.method_name(parameters)

Example asynchronous request

response = discovery.async.method_name(parameters)

Methods

List collections

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

Lists existing collections for the specified project.

GET /v2/projects/{project_id}/collections
(discovery *DiscoveryV2) ListCollections(listCollectionsOptions *ListCollectionsOptions) (result *ListCollectionsResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) ListCollectionsWithContext(ctx context.Context, listCollectionsOptions *ListCollectionsOptions) (result *ListCollectionsResponse, response *core.DetailedResponse, err error)
ServiceCall<ListCollectionsResponse> listCollections(ListCollectionsOptions listCollectionsOptions)
listCollections(params)
list_collections(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
list_collections(project_id:)
func listCollections(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ListCollectionsResponse>?, WatsonError?) -> Void)
ListCollections(string projectId)
ListCollections(Callback<ListCollectionsResponse> callback, string projectId)

Request

Instantiate the ListCollectionsOptions struct and set the fields to provide parameter values for the ListCollections method.

Use the ListCollectionsOptions.Builder to create a ListCollectionsOptions object that contains the parameter values for the listCollections method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The ListCollections options.

The listCollections options.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/collections?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.ListCollections(
        projectId: "{project_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.ListCollections(&discoveryv2.ListCollectionsOptions{
        ProjectID: core.StringPtr("{project_id}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    ListCollectionsOptions options = new ListCollectionsOptions.Builder()
      .projectId("{project_id}")
      .build();
    
    ListCollectionsResponse response = discovery.listCollections(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
    };
    
    discovery.listCollections(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.list_collections(
      project_id='{project_id}'
    ).get_result()
    
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.list_collections(
      project_id: "{project_id}"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.listCollections(projectID: "{project_id}") {
      response, error in
      
      guard let collections = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(collections)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    ListCollectionsResponse listCollectionsResponse = null;
    service.ListCollections(
        callback: (DetailedResponse<ListCollectionsResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "ListCollections result: {0}", response.Response);
            listCollectionsResponse = response.Result;
        },
        projectId: "{project_id}"
    );
    
    while (listCollectionsResponse == null)
        yield return null;

Response

Response object containing an array of collection details.

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Response object containing an array of collection details.

Example:
View

Status Code

  • Successful response.

  • Bad request.

Example responses
  • {
      "collections": [
        {
          "collection_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "name": "example"
        }
      ]
    }
  • {
      "collections": [
        {
          "collection_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "name": "example"
        }
      ]
    }

Create a collection

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

Create a new collection in the specified project.

POST /v2/projects/{project_id}/collections
(discovery *DiscoveryV2) CreateCollection(createCollectionOptions *CreateCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) CreateCollectionWithContext(ctx context.Context, createCollectionOptions *CreateCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
ServiceCall<CollectionDetails> createCollection(CreateCollectionOptions createCollectionOptions)
createCollection(params)
create_collection(self,
        project_id: str,
        name: str,
        *,
        description: str = None,
        language: str = None,
        enrichments: List['CollectionEnrichment'] = None,
        **kwargs
    ) -> DetailedResponse
create_collection(project_id:, name:, description: nil, language: nil, enrichments: nil)
func createCollection(
    projectID: String,
    name: String,
    description: String? = nil,
    language: String? = nil,
    enrichments: [CollectionEnrichment]? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)
CreateCollection(string projectId, string name, string description = null, string language = null, List<CollectionEnrichment> enrichments = null)
CreateCollection(Callback<CollectionDetails> callback, string projectId, string name, string description = null, string language = null, List<CollectionEnrichment> enrichments = null)

Request

Instantiate the CreateCollectionOptions struct and set the fields to provide parameter values for the CreateCollection method.

Use the CreateCollectionOptions.Builder to create a CreateCollectionOptions object that contains the parameter values for the createCollection method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the collection to be created.

WithContext method only

The CreateCollection options.

The createCollection options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • The language of the collection.

    Default: en

  • An array of enrichments that are applied to this collection.

Response

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

Status Code

  • The collection has been successfully created

  • Bad request.

  • Project not found.

No Sample Response

This method does not specify any sample responses.

Get collection

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

Get details about the specified collection.

GET /v2/projects/{project_id}/collections/{collection_id}
(discovery *DiscoveryV2) GetCollection(getCollectionOptions *GetCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetCollectionWithContext(ctx context.Context, getCollectionOptions *GetCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
ServiceCall<CollectionDetails> getCollection(GetCollectionOptions getCollectionOptions)
getCollection(params)
get_collection(self,
        project_id: str,
        collection_id: str,
        **kwargs
    ) -> DetailedResponse
get_collection(project_id:, collection_id:)
func getCollection(
    projectID: String,
    collectionID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)
GetCollection(string projectId, string collectionId)
GetCollection(Callback<CollectionDetails> callback, string projectId, string collectionId)

Request

Instantiate the GetCollectionOptions struct and set the fields to provide parameter values for the GetCollection method.

Use the GetCollectionOptions.Builder to create a GetCollectionOptions object that contains the parameter values for the getCollection method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The GetCollection options.

The getCollection options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

Status Code

  • Returns the specified collection details.

  • Collection or project not found.

No Sample Response

This method does not specify any sample responses.

Update a collection

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

Updates the specified collection's name, description, and enrichments.

POST /v2/projects/{project_id}/collections/{collection_id}
(discovery *DiscoveryV2) UpdateCollection(updateCollectionOptions *UpdateCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) UpdateCollectionWithContext(ctx context.Context, updateCollectionOptions *UpdateCollectionOptions) (result *CollectionDetails, response *core.DetailedResponse, err error)
ServiceCall<CollectionDetails> updateCollection(UpdateCollectionOptions updateCollectionOptions)
updateCollection(params)
update_collection(self,
        project_id: str,
        collection_id: str,
        *,
        name: str = None,
        description: str = None,
        enrichments: List['CollectionEnrichment'] = None,
        **kwargs
    ) -> DetailedResponse
update_collection(project_id:, collection_id:, name: nil, description: nil, enrichments: nil)
func updateCollection(
    projectID: String,
    collectionID: String,
    name: String? = nil,
    description: String? = nil,
    enrichments: [CollectionEnrichment]? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)
UpdateCollection(string projectId, string collectionId, string name = null, string description = null, List<CollectionEnrichment> enrichments = null)
UpdateCollection(Callback<CollectionDetails> callback, string projectId, string collectionId, string name = null, string description = null, List<CollectionEnrichment> enrichments = null)

Request

Instantiate the UpdateCollectionOptions struct and set the fields to provide parameter values for the UpdateCollection method.

Use the UpdateCollectionOptions.Builder to create a UpdateCollectionOptions object that contains the parameter values for the updateCollection method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the collection to be created.

WithContext method only

The UpdateCollection options.

The updateCollection options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The name of the collection.

    Constraints: 0 ≤ length ≤ 255

  • A description of the collection.

  • An array of enrichments that are applied to this collection.

Response

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

A collection for storing documents.

Status Code

  • Returns the updated collection details.

  • Bad request.

  • Collection or project not found.

No Sample Response

This method does not specify any sample responses.

Delete a collection

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

DELETE /v2/projects/{project_id}/collections/{collection_id}
(discovery *DiscoveryV2) DeleteCollection(deleteCollectionOptions *DeleteCollectionOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteCollectionWithContext(ctx context.Context, deleteCollectionOptions *DeleteCollectionOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollectionOptions)
deleteCollection(params)
delete_collection(self,
        project_id: str,
        collection_id: str,
        **kwargs
    ) -> DetailedResponse
delete_collection(project_id:, collection_id:)
func deleteCollection(
    projectID: String,
    collectionID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteCollection(string projectId, string collectionId)
DeleteCollection(Callback<object> callback, string projectId, string collectionId)

Request

Instantiate the DeleteCollectionOptions struct and set the fields to provide parameter values for the DeleteCollection method.

Use the DeleteCollectionOptions.Builder to create a DeleteCollectionOptions object that contains the parameter values for the deleteCollection method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteCollection options.

The deleteCollection options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Response type: object

Response type: object

Status Code

  • The collection has successfully been deleted.

  • Collection or project not found.

No Sample Response

This method does not specify any sample responses.

Query a project

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

POST /v2/projects/{project_id}/query
(discovery *DiscoveryV2) Query(queryOptions *QueryOptions) (result *QueryResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) QueryWithContext(ctx context.Context, queryOptions *QueryOptions) (result *QueryResponse, response *core.DetailedResponse, err error)
ServiceCall<QueryResponse> query(QueryOptions queryOptions)
query(params)
query(self,
        project_id: str,
        *,
        collection_ids: List[str] = None,
        filter: str = None,
        query: str = None,
        natural_language_query: str = None,
        aggregation: str = None,
        count: int = None,
        return_: List[str] = None,
        offset: int = None,
        sort: str = None,
        highlight: bool = None,
        spelling_suggestions: bool = None,
        table_results: 'QueryLargeTableResults' = None,
        suggested_refinements: 'QueryLargeSuggestedRefinements' = None,
        passages: 'QueryLargePassages' = None,
        **kwargs
    ) -> DetailedResponse
query(project_id:, collection_ids: nil, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, spelling_suggestions: nil, table_results: nil, suggested_refinements: nil, passages: nil)
func query(
    projectID: String,
    collectionIDs: [String]? = nil,
    filter: String? = nil,
    query: String? = nil,
    naturalLanguageQuery: String? = nil,
    aggregation: String? = nil,
    count: Int? = nil,
    `return`: [String]? = nil,
    offset: Int? = nil,
    sort: String? = nil,
    highlight: Bool? = nil,
    spellingSuggestions: Bool? = nil,
    tableResults: QueryLargeTableResults? = nil,
    suggestedRefinements: QueryLargeSuggestedRefinements? = nil,
    passages: QueryLargePassages? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<QueryResponse>?, WatsonError?) -> Void)
Query(string projectId, List<string> collectionIds = null, string filter = null, string query = null, string naturalLanguageQuery = null, string aggregation = null, long? count = null, List<string> _return = null, long? offset = null, string sort = null, bool? highlight = null, bool? spellingSuggestions = null, QueryLargeTableResults tableResults = null, QueryLargeSuggestedRefinements suggestedRefinements = null, QueryLargePassages passages = null)
Query(Callback<QueryResponse> callback, string projectId, List<string> collectionIds = null, string filter = null, string query = null, string naturalLanguageQuery = null, string aggregation = null, long? count = null, List<string> _return = null, long? offset = null, string sort = null, bool? highlight = null, bool? spellingSuggestions = null, QueryLargeTableResults tableResults = null, QueryLargeSuggestedRefinements suggestedRefinements = null, QueryLargePassages passages = null)

Request

Instantiate the QueryOptions struct and set the fields to provide parameter values for the Query method.

Use the QueryOptions.Builder to create a QueryOptions object that contains the parameter values for the query method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the query to be submitted.

WithContext method only

The Query options.

The query options.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A comma-separated list of collection IDs to be queried against.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

  • Number of results to return.

  • A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

  • A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the bias parameter.

  • When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

  • When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

  • Configuration for table retrieval.

  • Configuration for suggested refinements.

  • Configuration for passage retrieval.

  • curl -X POST -H "Authorization: Bearer {token}" -H "Content-Type: application/json" -d "{   \"collection_ids\": [      \"{collection_id_1}\",     \"{collection_id_2}\"   ],   \"query\": \"text:IBM\" }" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/query?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.Query(
        projectId: "{project_id}",
        query: "{field}:{value}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.Query(&discoveryv2.QueryOptions{
        ProjectID: core.StringPtr("{project_id}"),
        Query:     core.StringPtr("{field}:{value}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
    
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    QueryOptions options = new QueryOptions.Builder()
      .projectId("{project_id}")
      .query("{field}:{value}")
      .build();
    
    QueryResponse response = discovery.query(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      query: '{field}:{value}',
    };
    
    discovery.query(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.query(
      project_id='{project_id}',
      query='{field:value}'
    ).get_result()
    
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.query(
      project_id: "{project_id}",
      qhery: "{field}:{value}"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.query(projectID: "{project_id}") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    QueryResponse queryResponse = null;
    service.Query(
        callback: (DetailedResponse<QueryResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "Query result: {0}", response.Response);
            queryResponse = response.Result;
        },
        projectId: "{project_id}",
        query: "{field}:{value}"
    );
    
    while (queryResponse == null)
        yield return null;

Response

A response containing the documents and aggregations for the query.

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

A response containing the documents and aggregations for the query.

Example:
View

Status Code

  • Query executed successfully.

  • Project has no collections.

  • Bad request.

Example responses
  • {
      "matching_results": 24,
      "retrieval_details": {
        "document_retrieval_strategy": "untrained"
      },
      "results": [
        {
          "id": "watson-generated ID"
        }
      ],
      "aggregations": [
        {
          "type": "term",
          "field": "field",
          "count": 1,
          "results": [
            {
              "key": "active",
              "matching_results": 34
            }
          ]
        }
      ]
    }
  • {
      "matching_results": 24,
      "retrieval_details": {
        "document_retrieval_strategy": "untrained"
      },
      "results": [
        {
          "id": "watson-generated ID"
        }
      ],
      "aggregations": [
        {
          "type": "term",
          "field": "field",
          "count": 1,
          "results": [
            {
              "key": "active",
              "matching_results": 34
            }
          ]
        }
      ]
    }

Get Autocomplete Suggestions

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

Returns completion query suggestions for the specified prefix.

GET /v2/projects/{project_id}/autocompletion
(discovery *DiscoveryV2) GetAutocompletion(getAutocompletionOptions *GetAutocompletionOptions) (result *Completions, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetAutocompletionWithContext(ctx context.Context, getAutocompletionOptions *GetAutocompletionOptions) (result *Completions, response *core.DetailedResponse, err error)
ServiceCall<Completions> getAutocompletion(GetAutocompletionOptions getAutocompletionOptions)
getAutocompletion(params)
get_autocompletion(self,
        project_id: str,
        prefix: str,
        *,
        collection_ids: List[str] = None,
        field: str = None,
        count: int = None,
        **kwargs
    ) -> DetailedResponse
get_autocompletion(project_id:, prefix:, collection_ids: nil, field: nil, count: nil)
func getAutocompletion(
    projectID: String,
    `prefix`: String,
    collectionIDs: [String]? = nil,
    field: String? = nil,
    count: Int? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Completions>?, WatsonError?) -> Void)
GetAutocompletion(string projectId, string prefix, List<string> collectionIds = null, string field = null, long? count = null)
GetAutocompletion(Callback<Completions> callback, string projectId, string prefix, List<string> collectionIds = null, string field = null, long? count = null)

Request

Instantiate the GetAutocompletionOptions struct and set the fields to provide parameter values for the GetAutocompletion method.

Use the GetAutocompletionOptions.Builder to create a GetAutocompletionOptions object that contains the parameter values for the getAutocompletion method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

    Default: 5

WithContext method only

The GetAutocompletion options.

The getAutocompletion options.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to Hot, Housing, or How do I upgrade. Possible completions are.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • The field in the result documents that autocompletion suggestions are identified from.

  • The number of autocompletion suggestions to return.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/autocompletions?collection_ids={collection_id_1},{collection_id_2}&prefix=ab&version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.GetAutocompletion(
        projectId: "{project_id}",
        prefix: "Ho",
        count: 5
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
       }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.GetAutocompletion(&discoveryv2.GetAutocompletionOptions{
        ProjectID: core.StringPtr("{project_id}"),
        Prefix:    core.StringPtr("Ho"),
        Count:     core.Int64Ptr(5),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    GetAutocompletionOptions options = new GetAutocompletionOptions.Builder()
      .projectId("{project_id}")
      .prefix("Ho")
      .count(5L)
      .build();
    
    Completions response = discovery.getAutocompletion(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      prefix: 'Ho',
      count: 5,
    };
    
    discovery.getAutocompletion(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.get_autocompletion(
      project_id='{project_id}',
      prefix='Ho',
      count=5
    ).get_result()
    
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.get_autocompletion(
      project_id: "{project_id}",
      prefix: "Ho",
      count: 5
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.getAutocompletion(projectID: "{project_id}", collectionIDs: [collectionID], prefix: "Ho") {
      response, error in
      
      guard let suggestions = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(suggestions)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    Completions completionsResponse = null;
    service.GetAutocompletion(
        callback: (DetailedResponse<Completions> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "GetAutocompletion result: {0}", response.Response);
            completionsResponse = response.Result;
        },
        projectId: "{project_id}",
        prefix: "Ho",
        count: 5
    );
    
    while (completionsResponse == null)
        yield return null;

Response

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

An object containing an array of autocompletion suggestions.

Status Code

  • Object containing array of possible completions.

  • The specified field does not exist.

No Sample Response

This method does not specify any sample responses.

Query system notices

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training.

GET /v2/projects/{project_id}/notices
(discovery *DiscoveryV2) QueryNotices(queryNoticesOptions *QueryNoticesOptions) (result *QueryNoticesResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) QueryNoticesWithContext(ctx context.Context, queryNoticesOptions *QueryNoticesOptions) (result *QueryNoticesResponse, response *core.DetailedResponse, err error)
ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions)
queryNotices(params)
query_notices(self,
        project_id: str,
        *,
        filter: str = None,
        query: str = None,
        natural_language_query: str = None,
        count: int = None,
        offset: int = None,
        **kwargs
    ) -> DetailedResponse
query_notices(project_id:, filter: nil, query: nil, natural_language_query: nil, count: nil, offset: nil)
func queryNotices(
    projectID: String,
    filter: String? = nil,
    query: String? = nil,
    naturalLanguageQuery: String? = nil,
    count: Int? = nil,
    offset: Int? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<QueryNoticesResponse>?, WatsonError?) -> Void)
QueryNotices(string projectId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null)
QueryNotices(Callback<QueryNoticesResponse> callback, string projectId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null)

Request

Instantiate the QueryNoticesOptions struct and set the fields to provide parameter values for the QueryNotices method.

Use the QueryNoticesOptions.Builder to create a QueryNoticesOptions object that contains the parameter values for the queryNotices method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000

    Default: 10

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000

WithContext method only

The QueryNotices options.

The queryNotices options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

  • A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

  • A natural language query that returns relevant documents by utilizing training data and natural language understanding.

  • Number of results to return. The maximum for the count and offset values together in any one query is 10000.

  • The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/notices?natural_language_query=error&version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.QueryNotices(
        projectId: "{project_id}",
        query: "{field}:{value}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.QueryNotices(&discoveryv2.QueryNoticesOptions{
        ProjectID: core.StringPtr("{project_id}"),
        Query:     core.StringPtr("{field}:{value}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    QueryNoticesOptions options = new QueryNoticesOptions.Builder()
      .projectId("{project_id}")
      .query("{field}:{value}")
      .build();
    
    QueryNoticesResponse response = discovery.queryNotices(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      query: '{field}:{value}',
    };
    
    discovery.queryNotices(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.query_notices(
      project_id='{project_id}',
      query='{field}:{value}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.query_notices(
      project_id: "{project_id}",
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.queryNotices(projectID: "{project_id}", query: "{field}:{value}") {
      response, error in
      
      guard let notices = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(notices)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    QueryNoticesResponse queryNoticesResponse = null;
    service.QueryNotices(
        callback: (DetailedResponse<QueryNoticesResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "QueryNotices result: {0}", response.Response);
            queryNoticesResponse = response.Result;
        },
        projectId: "{project_id}",
        query: "{field}:{value}"
    );
    
    while (queryNoticesResponse == null)
        yield return null;

Response

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Object containing notice query results.

Status Code

  • Query for notices executed successfully.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

List fields

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

Gets a list of the unique fields (and their types) stored in the the specified collections.

GET /v2/projects/{project_id}/fields
(discovery *DiscoveryV2) ListFields(listFieldsOptions *ListFieldsOptions) (result *ListFieldsResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) ListFieldsWithContext(ctx context.Context, listFieldsOptions *ListFieldsOptions) (result *ListFieldsResponse, response *core.DetailedResponse, err error)
ServiceCall<ListFieldsResponse> listFields(ListFieldsOptions listFieldsOptions)
listFields(params)
list_fields(self,
        project_id: str,
        *,
        collection_ids: List[str] = None,
        **kwargs
    ) -> DetailedResponse
list_fields(project_id:, collection_ids: nil)
func listFields(
    projectID: String,
    collectionIDs: [String]? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ListFieldsResponse>?, WatsonError?) -> Void)
ListFields(string projectId, List<string> collectionIds = null)
ListFields(Callback<ListFieldsResponse> callback, string projectId, List<string> collectionIds = null)

Request

Instantiate the ListFieldsOptions struct and set the fields to provide parameter values for the ListFields method.

Use the ListFieldsOptions.Builder to create a ListFieldsOptions object that contains the parameter values for the listFields method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

WithContext method only

The ListFields options.

The listFields options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/fields?collection_ids={collection_id_1},{collection_id_2}&version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.ListFields(
        projectId: "{project_id}",
        collectionIds: new List<string>() { "{collection_id}" }
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.ListFields(&discoveryv2.ListFieldsOptions{
        ProjectID:     core.StringPtr("{project_id}"),
        CollectionIds: []string{"{collection_id}"},
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    ListFieldsOptions options = new ListFieldsOptions.Builder()
      .projectId("{project_id}")
      .addCollectionIds("{collection_id}")
      .build();
    
    ListFieldsResponse response = discovery.listFields(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      collectionIds: ['{collectionId}'],
    };
    
    discovery.listFields(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.list_fields(
      project_id='{project_id}',
      collection_ids=['{collection_id}']
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.list_fields(
      project_id: "{project_id}",
      collection_ids: ["{collection_id}"]
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.listFields(projectID: "{project_id}") {
      response, error in
    
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(notices)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    ListFieldsResponse listFieldsResponse = null;
    service.ListFields(
        callback: (DetailedResponse<ListFieldsResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "ListFields result: {0}", response.Response);
            listFieldsResponse = response.Result;
        },
        projectId: "{project_id}",
        collectionIds: new List<string>() { "{collection_id}" }
    );
    
    while (listFieldsResponse == null)
        yield return null;

Response

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

The list of fetched fields.

The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

  • Fields which contain nested objects are assigned a type of "nested".

  • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

Status Code

  • The list of fetched fields.

    The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations:

    • Fields which contain nested JSON objects are assigned a type of "nested".

    • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

    • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

  • Bad request.

No Sample Response

This method does not specify any sample responses.

List component settings

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

Returns default configuration settings for components.

GET /v2/projects/{project_id}/component_settings
(discovery *DiscoveryV2) GetComponentSettings(getComponentSettingsOptions *GetComponentSettingsOptions) (result *ComponentSettingsResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetComponentSettingsWithContext(ctx context.Context, getComponentSettingsOptions *GetComponentSettingsOptions) (result *ComponentSettingsResponse, response *core.DetailedResponse, err error)
ServiceCall<ComponentSettingsResponse> getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions)
getComponentSettings(params)
get_component_settings(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
get_component_settings(project_id:)
func getComponentSettings(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ComponentSettingsResponse>?, WatsonError?) -> Void)
GetComponentSettings(string projectId)
GetComponentSettings(Callback<ComponentSettingsResponse> callback, string projectId)

Request

Instantiate the GetComponentSettingsOptions struct and set the fields to provide parameter values for the GetComponentSettings method.

Use the GetComponentSettingsOptions.Builder to create a GetComponentSettingsOptions object that contains the parameter values for the getComponentSettings method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The GetComponentSettings options.

The getComponentSettings options.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/component_settings?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.GetComponentSettings(
        projectId: "{project_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.GetComponentSettings(&discoveryv2.GetComponentSettingsOptions{
        ProjectID: core.StringPtr("{project_id}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    GetComponentSettingsOptions options = new GetComponentSettingsOptions.Builder()
      .projectId("{project_id}")
      .build();
    
    ComponentSettingsResponse response = discovery.getComponentSettings(options).execute().getResult();
    
    System.out.println(response);
  • const fs = require('fs');
    const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
    };
    
    discovery.getComponentSettings(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.get_component_settings(
      project_id='{project_id}'
    ).get_result()
    
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.get_component_settings(
      project_id: "{project_id}"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.getComponentSettings(projectID: "{project_id}") {
      response, error in
      
      guard let settings = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    ComponentSettingsResponse componentSettingsResponse = null;
    service.GetComponentSettings(
        callback: (DetailedResponse<ComponentSettingsResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "GetComponentSettings result: {0}", response.Response);
            componentSettingsResponse = response.Result;
        },
        projectId: "{project_id}"
    );
    
    while (componentSettingsResponse == null)
        yield return null;

Response

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

The default component settings for this project.

Status Code

  • Successful response.

No Sample Response

This method does not specify any sample responses.

Add a document

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the /v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the /v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

  • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

  • The user can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document's media type.

  • The following field names are reserved and will be filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -

  • Fields with empty name values after normalization are filtered out before indexing.

  • Fields containing the following characters after normalization are filtered out before indexing: # and ,

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: Documents can be added with a specific document_id by using the _/v2/projects/{project_id}/collections/{collection_id}/documents method.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

POST /v2/projects/{project_id}/collections/{collection_id}/documents
(discovery *DiscoveryV2) AddDocument(addDocumentOptions *AddDocumentOptions) (result *DocumentAccepted, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) AddDocumentWithContext(ctx context.Context, addDocumentOptions *AddDocumentOptions) (result *DocumentAccepted, response *core.DetailedResponse, err error)
ServiceCall<DocumentAccepted> addDocument(AddDocumentOptions addDocumentOptions)
addDocument(params)
add_document(self,
        project_id: str,
        collection_id: str,
        *,
        file: BinaryIO = None,
        filename: str = None,
        file_content_type: str = None,
        metadata: str = None,
        x_watson_discovery_force: bool = None,
        **kwargs
    ) -> DetailedResponse
add_document(project_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil, x_watson_discovery_force: nil)
func addDocument(
    projectID: String,
    collectionID: String,
    file: Data? = nil,
    filename: String? = nil,
    fileContentType: String? = nil,
    metadata: String? = nil,
    xWatsonDiscoveryForce: Bool? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<DocumentAccepted>?, WatsonError?) -> Void)
AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)
AddDocument(Callback<DocumentAccepted> callback, string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)

Request

Instantiate the AddDocumentOptions struct and set the fields to provide parameter values for the AddDocument method.

Use the AddDocumentOptions.Builder to create a AddDocumentOptions object that contains the parameter values for the addDocument method.

Custom Headers

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Form Parameters

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }

WithContext method only

The AddDocument options.

The addDocument options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

  • curl -X POST -H "Authorization: Bearer {token}" -F "file=@{filename}"  -F metadata="{\"field_name\": \"content\"}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/collections/{collection_id}/documents?version=2019-11-29"

    Download example document sample1.html

  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    
    DetailedResponse<DocumentAccepted> result = null;
    using (FileStream fs = File.OpenRead("path/to/file.pdf"))
    {
        using (MemoryStream ms = new MemoryStream())
        {
            fs.CopyTo(ms);
    
            result = service.AddDocument(
                projectId: "{project_id}",
                collectionId: "{collection_id}",
                file: ms,
                filename: "example-file",
                fileContentType: "application/pdf"
                );
        }
    }
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
      "os"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      file, fileErr := os.Open("path/to/file.pdf")
      if fileErr != nil {
        panic(fileErr)
      }
      defer file.Close()
    
      result, _, responseErr := service.AddDocument(&discoveryv2.AddDocumentOptions{
        ProjectID:       core.StringPtr("{project_id}"),
        CollectionID:    core.StringPtr("{collection_id}"),
        File:            file,
        Filename:        core.StringPtr("example-file"),
        FileContentType: core.StringPtr("application/pdf"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    File examplePdf = new File("path/to/file.pdf");
    
    AddDocumentOptions options = new AddDocumentOptions.Builder()
      .projectId("{project_id}")
      .collectionId("{collection_id}")
      .file(examplePdf)
      .filename("example-file")
      .fileContentType("application/pdf")
      .build();
    
    DocumentAccepted response = discovery.addDocument(options).execute().getResult();
    
    System.out.println(response);
  • const fs = require('fs');
    const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      collectionId: '{collectionId}',
      file: fs.createReadStream('path/to/file.pdf'),
      filename: 'example-file',
      fileContentType: 'application/pdf',
    };
    
    discovery.addDocument(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    import os
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    with open(os.path.join(os.getcwd(), '{path_element}', '{filename}'),'rb') as fileinfo:
      response = discovery.add_document(
        project_id='{project_id}',
        collection_id='{}',
        file=fileinfo,
        filename='example-file',
        fileinfo='application/pdf'
      ).get_result()
      print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    File.open(Dir.getwd + "path/to/file.pdf") do |file_info|
      service_response = discovery.add_document(
        project_id: "{project_id}",
        collection_id: "{collection_id}",
        file: file_info,
        filename: "example-file",
        file_content_type: "application/pdf"
      )
    end
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    let url = Bundle.main.url(forResource: "KennedySpeech", withExtension: "html")
    let testDocument = try! Data(contentsOf: url!)
    
    discovery.addDocument(projectID: "{project_id}", collectionID: "{collection_id}", file: testDocument, filename: "test_file", fileContentType: "application/html") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
      
      documentID = results.documentID
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    DocumentAccepted addDocumentResponse = null;
    using (FileStream fs = File.OpenRead(watsonBeatsJeopardyHtmlFilePath))
    {
        using (MemoryStream ms = new MemoryStream())
        {
            fs.CopyTo(ms);
            service.AddDocument(
                callback: (DetailedResponse<DocumentAccepted> response, IBMError error) =>
                {
                    Log.Debug("DiscoveryServiceV2", "AddDocument result: {0}", response.Response);
                    addDocumentResponse = response.Result;
                    documentId = addDocumentResponse.DocumentId;
                },
                projectId: "{project_id}",
                collectionId: "{collection_id}",
                file: ms,
                fileContentType: "application/pdf",
                filename: "example-file"
            );
    
            while (addDocumentResponse == null)
                yield return null;
        }
    }

Response

Information returned after an uploaded document is accepted.

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Status Code

  • The document has been accepted and will be processed.

  • Bad request if the request is incorrectly formatted. The error message contains details about what caused the request to be rejected.

  • Forbidden. Returned if you attempt to add a document to a collection in a read-only project.

  • Not found. Returned if you attempt to add a document to a project that doesn't exist or if the collection specified isn't part of the specified project..

  • Too large. Returned if you attempt to add a document or document metadata that exceeds the maximum possible.

  • Unsupported. Returned if the media type of the uploaded document is not supported by Discovery..

Example responses
  • {
      "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
      "status": "processing"
    }
  • {
      "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
      "status": "processing"
    }

Update a document

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata.

If the document is uploaded to a collection that has it's data shared with another collection, the X-Watson-Discovery-Force header must be set to true.

Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: If an uploaded document is segmented, all segments will be overwritten, even if the updated version of the document has fewer segments.

POST /v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
(discovery *DiscoveryV2) UpdateDocument(updateDocumentOptions *UpdateDocumentOptions) (result *DocumentAccepted, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) UpdateDocumentWithContext(ctx context.Context, updateDocumentOptions *UpdateDocumentOptions) (result *DocumentAccepted, response *core.DetailedResponse, err error)
ServiceCall<DocumentAccepted> updateDocument(UpdateDocumentOptions updateDocumentOptions)
updateDocument(params)
update_document(self,
        project_id: str,
        collection_id: str,
        document_id: str,
        *,
        file: BinaryIO = None,
        filename: str = None,
        file_content_type: str = None,
        metadata: str = None,
        x_watson_discovery_force: bool = None,
        **kwargs
    ) -> DetailedResponse
update_document(project_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil, x_watson_discovery_force: nil)
func updateDocument(
    projectID: String,
    collectionID: String,
    documentID: String,
    file: Data? = nil,
    filename: String? = nil,
    fileContentType: String? = nil,
    metadata: String? = nil,
    xWatsonDiscoveryForce: Bool? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<DocumentAccepted>?, WatsonError?) -> Void)
UpdateDocument(string projectId, string collectionId, string documentId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)
UpdateDocument(Callback<DocumentAccepted> callback, string projectId, string collectionId, string documentId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)

Request

Instantiate the UpdateDocumentOptions struct and set the fields to provide parameter values for the UpdateDocument method.

Use the UpdateDocumentOptions.Builder to create a UpdateDocumentOptions object that contains the parameter values for the updateDocument method.

Custom Headers

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Form Parameters

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }

WithContext method only

The UpdateDocument options.

The updateDocument options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

  • curl -X POST -H "Authorization: Bearer {token}" -F "file=@{filename}"  -F metadata="{\"field_name\": \"content\"}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}?version=2019-11-29"

    Download example document sample1.html

  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.UpdateDocument(
        projectId: "{project_id}",
        collectionId: "{collection_id}",
        documentId: "{document_id}",
        filename: "updated-file-name"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
      "os"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      file, fileErr := os.Open("path/to/file.pdf")
      if fileErr != nil {
        panic(fileErr)
      }
      defer file.Close()
    
      result, _, responseErr := service.UpdateDocument(&discoveryv2.UpdateDocumentOptions{
        ProjectID:       core.StringPtr("{project_id}"),
        CollectionID:    core.StringPtr("{collection_id}"),
        DocumentID:      core.StringPtr("{document_id}"),
        File:            file,
        Filename:        core.StringPtr("example-file"),
        FileContentType: core.StringPtr("application/pdf"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    UpdateDocumentOptions options = new UpdateDocumentOptions.Builder()
      .projectId("{project_id}")
      .collectionId("{collection_id}")
      .documentId("{document_id}")
      .metadata("{ "metadata": "value" }")
      .build();
    
    DocumentAccepted response = discovery.updateDocument(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      collectionId: '{collectionId}',
      documentId: '{documentId}',
      metadata: '{"metadata": "value"}',
    };
    
    discovery.updateDocument(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    import os
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    with open(os.path.join(os.getcwd(), '{path_element}', '{filename}'),'rb') as fileinfo:
      response = discovery.update_document(
        project_id='{project_id}',
        collection_id='{collection_id}',
        document_id='{document_id}',
        file=fileinfo,
        filename='example-file',
        fileinfo='application/pdf'
      ).get_result()
      print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.update_document(
      project_id: "{project_id}",
      collection_id: "{collection_id}",
      document_id: "{document_id,
      filename: "updated-file-name"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.updateDocument(projectID: "{project_id}", collectionID: "{collection_id}", documentID: "{document_id}", file: testDocument, filename: "updated_file", fileContentType: "text/html") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    DocumentAccepted updateDocumentResponse = null;
    service.UpdateDocument(
        callback: (DetailedResponse<DocumentAccepted> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "UpdateDocument result: {0}", response.Response);
            updateDocumentResponse = response.Result;
        },
        projectId: "{project_id}",
        collectionId: "{collection_id}",
        documentId: "{document_id}",
        filename: "update-file-name"
    );
    
    while (updateDocumentResponse == null)
        yield return null;

Response

Information returned after an uploaded document is accepted.

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Information returned after an uploaded document is accepted.

Example:
View

Status Code

  • The document has been accepted and will be processed.

  • Bad request if the request is incorrectly formatted. The error message contains details about what caused the request to be rejected.

  • Forbidden. Returned if you attempt to add a document to a collection in a read-only project.

  • Not found. Returned if you attempt to add a document to a project that doesn't exist or if the collection specified isn't part of the specified project..

  • Too large. Returned if you attempt to add a document or document metadata that exceeds the maximum possible.

  • Unsupported. Returned if the media type of the uploaded document is not supported by Discovery..

Example responses
  • {
      "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
      "status": "processing"
    }
  • {
      "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
      "status": "processing"
    }

Delete a document

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to 'deleted'.

Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.

Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

DELETE /v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
(discovery *DiscoveryV2) DeleteDocument(deleteDocumentOptions *DeleteDocumentOptions) (result *DeleteDocumentResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteDocumentWithContext(ctx context.Context, deleteDocumentOptions *DeleteDocumentOptions) (result *DeleteDocumentResponse, response *core.DetailedResponse, err error)
ServiceCall<DeleteDocumentResponse> deleteDocument(DeleteDocumentOptions deleteDocumentOptions)
deleteDocument(params)
delete_document(self,
        project_id: str,
        collection_id: str,
        document_id: str,
        *,
        x_watson_discovery_force: bool = None,
        **kwargs
    ) -> DetailedResponse
delete_document(project_id:, collection_id:, document_id:, x_watson_discovery_force: nil)
func deleteDocument(
    projectID: String,
    collectionID: String,
    documentID: String,
    xWatsonDiscoveryForce: Bool? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<DeleteDocumentResponse>?, WatsonError?) -> Void)
DeleteDocument(string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null)
DeleteDocument(Callback<DeleteDocumentResponse> callback, string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null)

Request

Instantiate the DeleteDocumentOptions struct and set the fields to provide parameter values for the DeleteDocument method.

Use the DeleteDocumentOptions.Builder to create a DeleteDocumentOptions object that contains the parameter values for the deleteDocument method.

Custom Headers

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteDocument options.

The deleteDocument options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the document.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    Default: false

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.DeleteDocument(
        projectId: "{project_id}",
        collectionId: "{collection_id}",
        documentId: "{document_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
         panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.DeleteDocument(&discoveryv2.DeleteDocumentOptions{
        ProjectID:    core.StringPtr("{project_id}"),
        CollectionID: core.StringPtr("{collection_id}"),
        DocumentID:   core.StringPtr("{document_id}"),
      })
      if responseErr != nil {
    		panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
    
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    DeleteDocumentOptions options = new DeleteDocumentOptions.Builder()
      .projectId("{project_id}")
      .collectionId("{collection_id}")
      .documentId("{document_id}")
      .build();
    
    DeleteDocumentResponse response = discovery.deleteDocument(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      collectionId: '{collectionId}',
      documentId: '{documentId}',
    };
    
    discovery.deleteDocument(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.delete_document(
      project_id='{project_id}',
      collection_id='{collection_id}',
      document_id='{document_id}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    discovery.delete_document(
      project_id: "{project_id}",
      collection_id: "{collection_id}",
      document_id: "{document_id
    )
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.deleteDocument(projectID: "{project_id}", collectionID: "{collection_id}", documentID: "{document_id}") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    DeleteDocumentResponse deleteDocumentResponse = null;
    service.DeleteDocument(
        callback: (DetailedResponse<DeleteDocumentResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "DeleteDocument result: {0}", response.Response);
            deleteDocumentResponse = response.Result;
        },
        projectId: "{project_id}",
        collectionId: "{collection_id}",
        documentId: "{document_id}",
    );
    
    while (deleteDocumentResponse == null)
        yield return null;

Response

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Information returned when a document is deleted.

Status Code

  • The document was successfully deleted.

  • Forbidden. Returned if you attempt to delete a document in a collection that connects automatically to an external source.

  • Not found. Returned if the project, collection, or document Id specified is incorrect.

No Sample Response

This method does not specify any sample responses.

List training queries

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

List the training queries for the specified project.

GET /v2/projects/{project_id}/training_data/queries
(discovery *DiscoveryV2) ListTrainingQueries(listTrainingQueriesOptions *ListTrainingQueriesOptions) (result *TrainingQuerySet, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) ListTrainingQueriesWithContext(ctx context.Context, listTrainingQueriesOptions *ListTrainingQueriesOptions) (result *TrainingQuerySet, response *core.DetailedResponse, err error)
ServiceCall<TrainingQuerySet> listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions)
listTrainingQueries(params)
list_training_queries(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
list_training_queries(project_id:)
func listTrainingQueries(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<TrainingQuerySet>?, WatsonError?) -> Void)
ListTrainingQueries(string projectId)
ListTrainingQueries(Callback<TrainingQuerySet> callback, string projectId)

Request

Instantiate the ListTrainingQueriesOptions struct and set the fields to provide parameter values for the ListTrainingQueries method.

Use the ListTrainingQueriesOptions.Builder to create a ListTrainingQueriesOptions object that contains the parameter values for the listTrainingQueries method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The ListTrainingQueries options.

The listTrainingQueries options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/training_data/queries?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.ListTrainingQueries(
        projectId: "{project_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.ListTrainingQueries(&discoveryv2.ListTrainingQueriesOptions{
        ProjectID: core.StringPtr("{project_id}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    ListTrainingQueriesOptions options = new ListTrainingQueriesOptions.Builder()
      .projectId("{project_id}")
      .build();
    
    TrainingQuerySet response = discovery.listTrainingQueries(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
    };
    
    discovery.listTrainingQueries(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.list_training_queries(
      project_id='{project_id}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.list_training_queries(
      project_id: "{project_id}",
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.listTrainingQueries(projectID: "{project_id}") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    TrainingQuerySet listTrainingQueriesResponse = null;
    service.ListTrainingQueries(
        callback: (DetailedResponse<TrainingQuerySet> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "ListTrainingQueries result: {0}", response.Response);
            listTrainingQueriesResponse = response.Result;
        },
        projectId: "{project_id}"
    );
    
    while (listTrainingQueriesResponse == null)
        yield return null;

Response

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Object specifying the training queries contained in the identified training set.

Status Code

  • Training data for the specified project found and returned.

  • The specified project does not exist.

No Sample Response

This method does not specify any sample responses.

Delete training queries

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

Removes all training queries for the specified project.

DELETE /v2/projects/{project_id}/training_data/queries
(discovery *DiscoveryV2) DeleteTrainingQueries(deleteTrainingQueriesOptions *DeleteTrainingQueriesOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteTrainingQueriesWithContext(ctx context.Context, deleteTrainingQueriesOptions *DeleteTrainingQueriesOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions)
deleteTrainingQueries(params)
delete_training_queries(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
delete_training_queries(project_id:)
func deleteTrainingQueries(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteTrainingQueries(string projectId)
DeleteTrainingQueries(Callback<object> callback, string projectId)

Request

Instantiate the DeleteTrainingQueriesOptions struct and set the fields to provide parameter values for the DeleteTrainingQueries method.

Use the DeleteTrainingQueriesOptions.Builder to create a DeleteTrainingQueriesOptions object that contains the parameter values for the deleteTrainingQueries method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteTrainingQueries options.

The deleteTrainingQueries options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • curl -X DELETE -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/training_data/queries?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.DeleteTrainingQueries(
        projectId: "{project_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      _, responseErr := service.DeleteTrainingQueries(&discoveryv2.DeleteTrainingQueriesOptions{
        ProjectID: core.StringPtr("{project_id}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
    }
    
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    DeleteTrainingQueriesOptions options = new DeleteTrainingQueriesOptions.Builder()
      .projectId("{project_id}")
      .build();
    
    discovery.deleteTrainingQueries(options).execute();
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
    };
    
    discovery.deleteTrainingQueries(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.delete_training_queries(
      project_id='{project_id}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.delete_training_queries(
      project_id: "{project_id}",
    )
    puts JSON.pretty_generate(service_response.result)
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    var trainingQueryResponse = false;
    service.DeleteTrainingQueries(
        callback: (DetailedResponse<object> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "DeleteTrainingQueries result: {0}", response.Response);
            trainingQueryResponse = true;
        },
        projectId: "{project_id}"
    );
    
    while (trainingQueryResponse == false)
        yield return null;

Response

Response type: object

Response type: object

Status Code

  • All training data for the specified project has been deleted.

  • Invalid headers.

  • Incorrect project specified.

No Sample Response

This method does not specify any sample responses.

Create training query

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

POST /v2/projects/{project_id}/training_data/queries
(discovery *DiscoveryV2) CreateTrainingQuery(createTrainingQueryOptions *CreateTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) CreateTrainingQueryWithContext(ctx context.Context, createTrainingQueryOptions *CreateTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
ServiceCall<TrainingQuery> createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions)
createTrainingQuery(params)
create_training_query(self,
        project_id: str,
        natural_language_query: str,
        examples: List['TrainingExample'],
        *,
        filter: str = None,
        **kwargs
    ) -> DetailedResponse
create_training_query(project_id:, natural_language_query:, examples:, filter: nil)
func createTrainingQuery(
    projectID: String,
    naturalLanguageQuery: String,
    examples: [TrainingExample],
    filter: String? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)
CreateTrainingQuery(string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)
CreateTrainingQuery(Callback<TrainingQuery> callback, string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)

Request

Instantiate the CreateTrainingQueryOptions struct and set the fields to provide parameter values for the CreateTrainingQuery method.

Use the CreateTrainingQueryOptions.Builder to create a CreateTrainingQueryOptions object that contains the parameter values for the createTrainingQuery method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the query to be submitted.

WithContext method only

The CreateTrainingQuery options.

The createTrainingQuery options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

  • curl -X POST -H "Authorization: Bearer {token}" -d "{   \"natural_language_query\": \"why is the sky blue\",   \"filter\": \"text:meteorology\",   \"examples\": [{       \"document_id\": \"54f95ac0-3e4f-4756-bea6-7a67b2713c81\",       \"relevance\": 1,       \"collection_id\": \"800e58e4-198d-45eb-be87-74e1d6df4e96\"   }, {       \"document_id\": \"01bcca32-7300-4c9f-8d32-33ed7ea643da\",       \"relevance\": 5,       \"collection_id\": \"800e58e4-198d-45eb-be87-74e1d6df4e96\"   }] }" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/training_data/queries?version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    TrainingExample trainingExample = new TrainingExample()
    {
        CollectionId = "{collection_id}",
        DocumentId = "{document_id}"
    };
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.CreateTrainingQuery(
        projectId: "{project_id}",
        examples: new List<TrainingExample>() { trainingExample },
        naturalLanguageQuery: "This is an example of a query"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
      "encoding/json"
      "fmt"
      "github.com/IBM/go-sdk-core/core"
      "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.CreateTrainingQuery(&discoveryv2.CreateTrainingQueryOptions{
      ProjectID:            core.StringPtr("{project_id}"),
      NaturalLanguageQuery: core.StringPtr("This is an example of a query"),
      Examples: []discoveryv2.TrainingExample{
        discoveryv2.TrainingExample{
          DocumentID:   core.StringPtr("{document_id}"),
          CollectionID: core.StringPtr("{collection_id}"),
          Relevance:    core.Int64Ptr(1),
          },
        },
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
    
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    TrainingExample trainingExample = new TrainingExample.Builder()
      .collectionId("{collection_id}")
      .documentId("{document_id}")
      .relevance(1L)
      .build();
    
    CreateTrainingQueryOptions options = new CreateTrainingQueryOptions.Builder()
      .projectId("{project_id}")
      .addExamples(trainingExample)
      .naturalLanguageQuery("This is an example of a query")
      .build();
    
    TrainingQuery response = discovery.createTrainingQuery(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      naturalLanguageQuery: 'This is an example of a query',
      examples: [
        {
          collection_id: '{collectionId}',
          document_id: '{documentId}',
        },
      ],
    };
    
    discovery.createTrainingQuery(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_watson.discovery_v2 import TrainingExample
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    training_example = TrainingExample(
      document_id='{document_id}',
      collection_id='{collection_id}',
      relevance=1
    )
    response = discovery.create_training_query(
      project_id='{project_id}',
      natural_language_query='This is an example of a query',
      examples=[training_example]
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.create_training_query(
      project_id: "{project_id}",
      examples: ["{training_example}"],
      natural_language_query: "This is an example of a query"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    let trainingExample = TrainingExample(documentID: "{document_id}", collectionID: "{collection_id}", relevance: 1)
    
    discovery.createTrainingQuery(projectID: "{project_id}", naturalLanguageQuery: "test", filter: nil, examples: [trainingExample]) {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
      
      queryID = results.queryID
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    TrainingExample trainingExample = new TrainingExample()
    {
      CollectionId = "{collection_id}",
      DocumentId = "{document_id}"
    };
    TrainingQuery trainingQueryResponse = null;
    service.CreateTrainingQuery(
        callback: (DetailedResponse<TrainingQuery> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "CreateTrainingQuery result: {0}", response.Response);
            trainingQueryResponse = response.Result;
        },
        projectId: "{project_id}",
        examples: new List<TrainingExample>() { trainingExample },
        naturalLanguageQuery: "This is an example of a query"
    );
    
    while (trainingQueryResponse == null)
        yield return null;

Response

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Status Code

  • The query was successfully added.

  • Invalid headers or request.

  • The specified project does not exist.

No Sample Response

This method does not specify any sample responses.

Get a training data query

Get details for a specific training data query, including the query string and all examples

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

Get details for a specific training data query, including the query string and all examples.

GET /v2/projects/{project_id}/training_data/queries/{query_id}
(discovery *DiscoveryV2) GetTrainingQuery(getTrainingQueryOptions *GetTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetTrainingQueryWithContext(ctx context.Context, getTrainingQueryOptions *GetTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
ServiceCall<TrainingQuery> getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions)
getTrainingQuery(params)
get_training_query(self,
        project_id: str,
        query_id: str,
        **kwargs
    ) -> DetailedResponse
get_training_query(project_id:, query_id:)
func getTrainingQuery(
    projectID: String,
    queryID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)
GetTrainingQuery(string projectId, string queryId)
GetTrainingQuery(Callback<TrainingQuery> callback, string projectId, string queryId)

Request

Instantiate the GetTrainingQueryOptions struct and set the fields to provide parameter values for the GetTrainingQuery method.

Use the GetTrainingQueryOptions.Builder to create a GetTrainingQueryOptions object that contains the parameter values for the getTrainingQuery method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The GetTrainingQuery options.

The getTrainingQuery options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/training_data/queries/{query_id}?&version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var result = service.GetTrainingQuery(
        projectId: "{project_id}",
        queryId: "{query_id}"
        );
    
    Console.WriteLine(result.Response);
  • package main
    
    import (
        "encoding/json"
        "fmt"
        "github.com/IBM/go-sdk-core/core"
        "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.GetTrainingQuery(&discoveryv2.GetTrainingQueryOptions{
        ProjectID: core.StringPtr("{project_id}"),
        QueryID:   core.StringPtr("{query_id}"),
      })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    GetTrainingQueryOptions options = new GetTrainingQueryOptions.Builder()
      .projectId("{project_id}")
      .queryId("{query_id}")
      .build();
    
    TrainingQuery response = discovery.getTrainingQuery(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      queryId: '{queryId}',
    };
    
    discovery.getTrainingQuery(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    response = discovery.get_training_query(
      project_id='{project_id}',
      query_id='{query_id}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = discovery.get_training_query(
      project_id: "{project_id}",
      query_id: "{query_id}"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    discovery.getTrainingQuery(projectID: "{project_id}", queryID: "{query_id}") {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    TrainingExample trainingExample = new TrainingExample()
    {
      CollectionId = "{collection_id}",
      DocumentId = "{document_id}"
    };
    TrainingQuery trainingQueryResponse = null;
    service.GetTrainingQuery(
        callback: (DetailedResponse<TrainingQuery> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "GetTrainingQuery result: {0}", response.Response);
            trainingQueryResponse = response.Result;
        },
        projectId: "{project_id}",
        queryId: "{query_id}"
    );
    
    while (trainingQueryResponse == null)
        yield return null;

Response

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Status Code

  • Details of the specified training query.

  • Query or project not found.

No Sample Response

This method does not specify any sample responses.

Update a training query

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

Updates an existing training query and it's examples.

POST /v2/projects/{project_id}/training_data/queries/{query_id}
(discovery *DiscoveryV2) UpdateTrainingQuery(updateTrainingQueryOptions *UpdateTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) UpdateTrainingQueryWithContext(ctx context.Context, updateTrainingQueryOptions *UpdateTrainingQueryOptions) (result *TrainingQuery, response *core.DetailedResponse, err error)
ServiceCall<TrainingQuery> updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions)
updateTrainingQuery(params)
update_training_query(self,
        project_id: str,
        query_id: str,
        natural_language_query: str,
        examples: List['TrainingExample'],
        *,
        filter: str = None,
        **kwargs
    ) -> DetailedResponse
update_training_query(project_id:, query_id:, natural_language_query:, examples:, filter: nil)
func updateTrainingQuery(
    projectID: String,
    queryID: String,
    naturalLanguageQuery: String,
    examples: [TrainingExample],
    filter: String? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)
UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)
UpdateTrainingQuery(Callback<TrainingQuery> callback, string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)

Request

Instantiate the UpdateTrainingQueryOptions struct and set the fields to provide parameter values for the UpdateTrainingQuery method.

Use the UpdateTrainingQueryOptions.Builder to create a UpdateTrainingQueryOptions object that contains the parameter values for the updateTrainingQuery method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

The body of the example that is to be added to the specified query.

WithContext method only

The UpdateTrainingQuery options.

The updateTrainingQuery options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The natural text query for the training query.

  • Array of training examples.

  • The filter used on the collection before the natural_language_query is applied.

  • curl -X POST -H "Authorization: Bearer {token}" -d "{   \"query_id\": \"3c4fff84-1500-455c-b125-eaa2d319f6d3\",   \"natural_language_query\": \"why is the sky blue\",   \"filter\": \"text:meteorology\",   \"examples\": [{       \"document_id\": \"54f95ac0-3e4f-4756-bea6-7a67b2713c81\",       \"relevance\": 1,       \"collection_id\": \"800e58e4-198d-45eb-be87-74e1d6df4e96\"   }, {       \"document_id\": \"01bcca32-7300-4c9f-8d32-33ed7ea643da\",       \"relevance\": 5,       \"collection_id\": \"800e58e4-198d-45eb-be87-74e1d6df4e96\"   }] }" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/training_data/queries/{query_id}?&version=2019-11-29"
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
        );
    
    DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);
    service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
    
    var newFilter = "field:1";
    TrainingExample newTrainingExample = new TrainingExample()
    {
        CollectionId = "{collection_id}",
        DocumentId = "{document_id}"
    };
    
    var result = service.UpdateTrainingQuery(
        projectId: "{project_id}",
        queryId: "{query_id}",
        naturalLanguageQuery: "This is a new example of a query",
        examples: new List<TrainingExample>() { newTrainingExample },
        filter: newFilter
        );
  • package main
    
    import (
        "encoding/json"
        "fmt"
        "github.com/IBM/go-sdk-core/core"
        "github.com/watson-developer-cloud/go-sdk/discoveryv2"
    )
    
    func main() {
      authenticator := &core.CloudPakForDataAuthenticator{
        URL:                    "https://{cpd_cluster_host}{:port}",
        Username:               "{username}",
        Password:               "{password}",
        DisableSSLVerification: true,
      }
      options := &discoveryv2.DiscoveryV2Options{
        Version:       "2019-11-22",
        Authenticator: authenticator,
      }
      service, serviceErr := discoveryv2.NewDiscoveryV2(options)
      if serviceErr != nil {
        panic(serviceErr)
      }
      service.SetServiceURL("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}")
    
      result, _, responseErr := service.UpdateTrainingQuery(&discoveryv2.UpdateTrainingQueryOptions{
        ProjectID:            core.StringPtr("{project_id}"),
        QueryID:              core.StringPtr("{query_id}"),
        NaturalLanguageQuery: core.StringPtr("This is an example of a query"),
        Examples: []discoveryv2.TrainingExample{
          discoveryv2.TrainingExample{
            DocumentID:   core.StringPtr("{document_id}"),
            CollectionID: core.StringPtr("{collection_id}"),
            Relevance:    core.Int64Ptr(1),
            },
          },
          Filter: core.StringPtr("{field:1}"),
    })
      if responseErr != nil {
        panic(responseErr)
      }
      b, _ := json.MarshalIndent(result, "", "  ")
      fmt.Println(string(b))
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
    Discovery discovery = new Discovery("2019-11-22", authenticator);
    discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
    
    TrainingExample newTrainingExample = new TrainingExample.Builder()
      .collectionId("{collection_id}")
      .documentId("{document_id}")
      .relevance(1L)
      .build();
    String newQuery = "This is a new query!";
    
    UpdateTrainingQueryOptions options = new UpdateTrainingQueryOptions.Builder()
      .projectId("{project_id}")
      .queryId("{query_id}")
      .addExamples(newTrainingExample)
      .naturalLanguageQuery(newQuery)
      .build();
    
    TrainingQuery response = discovery.updateTrainingQuery(options).execute().getResult();
    
    System.out.println(response);
  • const DiscoveryV2 = require('ibm-watson/discovery/v2');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const discovery = new DiscoveryV2({
      authenticator: new CloudPakForDataAuthenticator({
        url: 'https://{cpd_cluster_host}{:port}',
        username: '{username}',
        password: '{password}',
      }),
      version: '2019-11-22',
      serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
    });
    
    const params = {
      projectId: '{projectId}',
      queryId: '{queryId}',
      naturalLanguageQuery: 'This is a new query!',
      examples: [
        {
          document_id: '{documentId}',
          collection_id: '{collectionId}',
          relevance: 1,
        },
      ],
    };
    
    discovery.updateTrainingQuery(params)
      .then(response => {
        console.log(JSON.stringify(response.result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
    
  • import json
    from ibm_watson import DiscoveryV2
    from ibm_watson.discovery_v2 import TrainingExample
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
                                  '{username}',
                                  '{password}',
                                  'https://{cpd_cluster_host}{:port}',
                                   disable_ssl_verification=True)
    discovery = DiscoveryV2(
      version='2019-11-22',
      authenticator=authenticator
    )
    discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
    
    training_example = TrainingExample(
      document_id='{document_id}',
      collection_id='{collection_id}',
      relevance=1
    )
    response = discovery.update_training_query(
      project_id='{project_id}',
      query_id='{query_id}',
      natural_language_query='This is an example of a query',
      examples=[training_example],
      filter='{field:1}'
    ).get_result()
    print(json.dumps(response, indent=2))
    
  • require "json"
    require "ibm_watson/authenticators"
    require "ibm_watson/discovery_v2"
    include IBMWatson
    
    authenticator = Authenticators::CloudPakForDataAuthenticator.new(
      username: "{username}",
      password: "{password}",
      url: "https://{cpd_cluster_host}{:port}"
    )
    
    discovery = DiscoveryV2.new(
      version: "2019-11-22",
      authenticator: authenticator
    )
    discovery.service_url = "https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api"
    
    service_response = service.update_training_query(
      project_id: "{project_id}",
      query_id: "{query_id}"
      examples: ["{training_example}"],
      natural_language_query: "This is an example of a query"
    )
    puts JSON.pretty_generate(service_response.result)
  • let authenticator = WatsonCloudPakForDataAuthenticator(username: username, password: password, url: url)
    
    let discovery = Discovery(version: "2019-11-29", authenticator: authenticator)
    discovery.serviceURL = "{url}"
    
    let trainingExample = TrainingExample(documentID: "{document_id}", collectionID: "{collection_id}", relevance: 1)
    
    discovery.updateTrainingQuery(projectID: "{project_id}", queryID: "{query_id}", naturalLanguageQuery: "This is a new query!", examples: [trainingExample]) {
      response, error in
      
      guard let results = response?.result else {
        print(error?.localizedDescription ?? "unexpected error")
        return
      }
    
      print(results)
    }
  • var authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}",
        username: "{username}",
        password: "{password}"
    );
    
    while (!authenticator.CanAuthenticate())
        yield return null;
    
    var discovery = new DiscoveryService("2019-11-22", authenticator);
    discovery.SetServiceUrl("{url}");
    
    TrainingExample trainingExample = new TrainingExample()
    {
      CollectionId = "{collection_id}",
      DocumentId = "{document_id}"
    };
    TrainingQuery trainingQueryResponse = null;
    service.UpdateTrainingQuery(
        callback: (DetailedResponse<TrainingQuery> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV2", "UpdateTrainingQuery result: {0}", response.Response);
            trainingQueryResponse = response.Result;
            queryId = trainingQueryResponse.QueryId;
        },
        projectId: "{project_id}",
        queryId: "{query_id}",
        examples: new List<TrainingExample>() { trainingExample },
        filter: "field:1",
        naturalLanguageQuery: "This is a new example of a query"
    );
    
    while (trainingQueryResponse == null)
        yield return null;

Response

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Object containing training query details.

Status Code

  • The example was successfully added to the query.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

Delete a training data query

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

Removes details from a training data query, including the query string and all examples.

DELETE /v2/projects/{project_id}/training_data/queries/{query_id}
(discovery *DiscoveryV2) DeleteTrainingQuery(deleteTrainingQueryOptions *DeleteTrainingQueryOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteTrainingQueryWithContext(ctx context.Context, deleteTrainingQueryOptions *DeleteTrainingQueryOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteTrainingQuery(DeleteTrainingQueryOptions deleteTrainingQueryOptions)
deleteTrainingQuery(params)
delete_training_query(self,
        project_id: str,
        query_id: str,
        **kwargs
    ) -> DetailedResponse
delete_training_query(project_id:, query_id:)
func deleteTrainingQuery(
    projectID: String,
    queryID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteTrainingQuery(string projectId, string queryId)
DeleteTrainingQuery(Callback<object> callback, string projectId, string queryId)

Request

Instantiate the DeleteTrainingQueryOptions struct and set the fields to provide parameter values for the DeleteTrainingQuery method.

Use the DeleteTrainingQueryOptions.Builder to create a DeleteTrainingQueryOptions object that contains the parameter values for the deleteTrainingQuery method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteTrainingQuery options.

The deleteTrainingQuery options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the query used for training.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Response type: object

Response type: object

Status Code

  • The query and all example document references were successfully removed from the training set for this collection.

  • Query or project not found.

No Sample Response

This method does not specify any sample responses.

List curations

Lists the currently configured curation queries and the associated curated responses. The curations API methods are beta functionality.

GET /v2/projects/{project_id}/curations

Request

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/curations?version=2019-11-29"

Response

Array of queries with curated responses for the specified project.

Status Code

  • List of curations associated with the specified project.

  • Specified project not found.

No Sample Response

This method does not specify any sample responses.

Create curation

Add a new curated query and specify result documents. The curations API methods are beta functionality.

POST /v2/projects/{project_id}/curations

Request

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Natural language query to curate and array of results to return when the query is specified.

  • curl -X POST -H "Authorization: Bearer {token}" -d "{   \"natural_language_query\": \"Concur\",   \"curated_results\": [{       \"document_id\": \"document_id1234\",       \"collection_id\": \"collection_id1234\"   }] }" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/curations?version=2019-11-29"

Response

Curated query and responses.

Status Code

  • Curation that has been created.

  • Specified natural language query already exists.

  • Specified project, collection, or document not found.

No Sample Response

This method does not specify any sample responses.

Get curation

Gets details about the specified curation. The curations API methods are beta functionality.

GET /v2/projects/{project_id}/curations/{curation_id}

Request

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the curation.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • curl -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/curations/{curation_id}?version=2019-11-29"

Response

Object containing array of curated results.

Status Code

  • Objecting containing an array of curated results for the specified curation id.

  • Specified project or curation ID not found.

No Sample Response

This method does not specify any sample responses.

Delete curation

Deletes the specified curation. The curations API methods are beta functionality.

DELETE /v2/projects/{project_id}/curations/{curation_id}

Request

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the curation.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • curl -X DELETE -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/curations/{curation_id}?version=2019-11-29"

Response

Curation status information.

Status Code

  • Curation has been successfully deleted.

  • Specified project or curation id not found.

No Sample Response

This method does not specify any sample responses.

Update curation results

Update an existing curated results documents for the specified query. The curations API methods are beta functionality.

POST /v2/projects/{project_id}/curations/{curation_id}/curated_results

Request

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the curation.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Result to add to the specified curated query.

  • curl -X POST -H "Authorization: Bearer {token}" -d "{\"document_id\": \"document_id1234\",\"collection_id\": \"collection_id1234\"}" "https://{cpd_cluster_host}:{port}/discovery/{release}/instance/{instance_id}/api/v2/projects/{project_id}/curations/{curation_id}/curated_results?version=2019-11-29"

Response

Result information for a curated query.

Status Code

  • Result has been added to the curation.

  • Specified document ID already exists in this curation.

  • Specified project, collection or document not found.

No Sample Response

This method does not specify any sample responses.

List projects

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

Lists existing projects for this instance.

GET /v2/projects
(discovery *DiscoveryV2) ListProjects(listProjectsOptions *ListProjectsOptions) (result *ListProjectsResponse, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) ListProjectsWithContext(ctx context.Context, listProjectsOptions *ListProjectsOptions) (result *ListProjectsResponse, response *core.DetailedResponse, err error)
ServiceCall<ListProjectsResponse> listProjects(ListProjectsOptions listProjectsOptions)
listProjects(params)
list_projects(self,
        **kwargs
    ) -> DetailedResponse
list_projects
func listProjects(
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ListProjectsResponse>?, WatsonError?) -> Void)
ListProjects()
ListProjects(Callback<ListProjectsResponse> callback)

Request

Instantiate the ListProjectsOptions struct and set the fields to provide parameter values for the ListProjects method.

Use the ListProjectsOptions.Builder to create a ListProjectsOptions object that contains the parameter values for the listProjects method.

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Response

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

A list of projects in this instance.

Status Code

  • Successful response.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

Create a Project

Create a new project for this instance

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

Create a new project for this instance.

POST /v2/projects
(discovery *DiscoveryV2) CreateProject(createProjectOptions *CreateProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) CreateProjectWithContext(ctx context.Context, createProjectOptions *CreateProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
ServiceCall<ProjectDetails> createProject(CreateProjectOptions createProjectOptions)
createProject(params)
create_project(self,
        name: str,
        type: str,
        *,
        default_query_parameters: 'DefaultQueryParams' = None,
        **kwargs
    ) -> DetailedResponse
create_project(name:, type:, default_query_parameters: nil)
func createProject(
    name: String,
    type: String,
    defaultQueryParameters: DefaultQueryParams? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)
CreateProject(string name, string type, DefaultQueryParams defaultQueryParameters = null)
CreateProject(Callback<ProjectDetails> callback, string name, string type, DefaultQueryParams defaultQueryParameters = null)

Request

Instantiate the CreateProjectOptions struct and set the fields to provide parameter values for the CreateProject method.

Use the CreateProjectOptions.Builder to create a CreateProjectOptions object that contains the parameter values for the createProject method.

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the project to be created.

WithContext method only

The CreateProject options.

The createProject options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The human readable name of this project.

  • The project type of this project.

    Allowable values: [document_retrieval,answer_retrieval,content_mining,other]

  • Default query parameters for this project.

Response

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Status Code

  • The project has successfully been created.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

Get project

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

Get details on the specified project.

GET /v2/projects/{project_id}
(discovery *DiscoveryV2) GetProject(getProjectOptions *GetProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetProjectWithContext(ctx context.Context, getProjectOptions *GetProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
ServiceCall<ProjectDetails> getProject(GetProjectOptions getProjectOptions)
getProject(params)
get_project(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
get_project(project_id:)
func getProject(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)
GetProject(string projectId)
GetProject(Callback<ProjectDetails> callback, string projectId)

Request

Instantiate the GetProjectOptions struct and set the fields to provide parameter values for the GetProject method.

Use the GetProjectOptions.Builder to create a GetProjectOptions object that contains the parameter values for the getProject method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The GetProject options.

The getProject options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Status Code

  • Returns information about the specified project if it exists.

  • Project not found.

No Sample Response

This method does not specify any sample responses.

Update a project

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

Update the specified project's name.

POST /v2/projects/{project_id}
(discovery *DiscoveryV2) UpdateProject(updateProjectOptions *UpdateProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) UpdateProjectWithContext(ctx context.Context, updateProjectOptions *UpdateProjectOptions) (result *ProjectDetails, response *core.DetailedResponse, err error)
ServiceCall<ProjectDetails> updateProject(UpdateProjectOptions updateProjectOptions)
updateProject(params)
update_project(self,
        project_id: str,
        *,
        name: str = None,
        **kwargs
    ) -> DetailedResponse
update_project(project_id:, name: nil)
func updateProject(
    projectID: String,
    name: String? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)
UpdateProject(string projectId, string name = null)
UpdateProject(Callback<ProjectDetails> callback, string projectId, string name = null)

Request

Instantiate the UpdateProjectOptions struct and set the fields to provide parameter values for the UpdateProject method.

Use the UpdateProjectOptions.Builder to create a UpdateProjectOptions object that contains the parameter values for the updateProject method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that represents the new name of the project.

WithContext method only

The UpdateProject options.

The updateProject options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The new name to give this project.

Response

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Detailed information about the specified project.

Status Code

  • Returns the updated project information.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

Delete a project

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

DELETE /v2/projects/{project_id}
(discovery *DiscoveryV2) DeleteProject(deleteProjectOptions *DeleteProjectOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteProjectWithContext(ctx context.Context, deleteProjectOptions *DeleteProjectOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions)
deleteProject(params)
delete_project(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
delete_project(project_id:)
func deleteProject(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteProject(string projectId)
DeleteProject(Callback<object> callback, string projectId)

Request

Instantiate the DeleteProjectOptions struct and set the fields to provide parameter values for the DeleteProject method.

Use the DeleteProjectOptions.Builder to create a DeleteProjectOptions object that contains the parameter values for the deleteProject method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteProject options.

The deleteProject options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Response type: object

Response type: object

Status Code

  • The project has been deleted.

  • Bad request.

No Sample Response

This method does not specify any sample responses.

List Enrichments

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

List the enrichments available to this project.

GET /v2/projects/{project_id}/enrichments
(discovery *DiscoveryV2) ListEnrichments(listEnrichmentsOptions *ListEnrichmentsOptions) (result *Enrichments, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) ListEnrichmentsWithContext(ctx context.Context, listEnrichmentsOptions *ListEnrichmentsOptions) (result *Enrichments, response *core.DetailedResponse, err error)
ServiceCall<Enrichments> listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions)
listEnrichments(params)
list_enrichments(self,
        project_id: str,
        **kwargs
    ) -> DetailedResponse
list_enrichments(project_id:)
func listEnrichments(
    projectID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Enrichments>?, WatsonError?) -> Void)
ListEnrichments(string projectId)
ListEnrichments(Callback<Enrichments> callback, string projectId)

Request

Instantiate the ListEnrichmentsOptions struct and set the fields to provide parameter values for the ListEnrichments method.

Use the ListEnrichmentsOptions.Builder to create a ListEnrichmentsOptions object that contains the parameter values for the listEnrichments method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The ListEnrichments options.

The listEnrichments options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

An object containing an array of enrichment definitions.

Status Code

  • Returns an array of available enrichments.

  • Bad request.

  • Project not found

No Sample Response

This method does not specify any sample responses.

Create an enrichment

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

Create an enrichment for use with the specified project/.

POST /v2/projects/{project_id}/enrichments
(discovery *DiscoveryV2) CreateEnrichment(createEnrichmentOptions *CreateEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) CreateEnrichmentWithContext(ctx context.Context, createEnrichmentOptions *CreateEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
ServiceCall<Enrichment> createEnrichment(CreateEnrichmentOptions createEnrichmentOptions)
createEnrichment(params)
create_enrichment(self,
        project_id: str,
        enrichment: 'CreateEnrichment',
        *,
        file: BinaryIO = None,
        **kwargs
    ) -> DetailedResponse
create_enrichment(project_id:, enrichment:, file: nil)
func createEnrichment(
    projectID: String,
    enrichment: CreateEnrichment,
    file: Data? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)
CreateEnrichment(string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file = null)
CreateEnrichment(Callback<Enrichment> callback, string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file = null)

Request

Instantiate the CreateEnrichmentOptions struct and set the fields to provide parameter values for the CreateEnrichment method.

Use the CreateEnrichmentOptions.Builder to create a CreateEnrichmentOptions object that contains the parameter values for the createEnrichment method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Form Parameters

  • Information about a specific enrichment.

  • The enrichment file to upload

WithContext method only

The CreateEnrichment options.

The createEnrichment options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • Information about a specific enrichment.

  • The enrichment file to upload.

Response

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Status Code

  • The enrichment has been successfully created

  • Bad request.

No Sample Response

This method does not specify any sample responses.

Get enrichment

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

Get details about a specific enrichment.

GET /v2/projects/{project_id}/enrichments/{enrichment_id}
(discovery *DiscoveryV2) GetEnrichment(getEnrichmentOptions *GetEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) GetEnrichmentWithContext(ctx context.Context, getEnrichmentOptions *GetEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
ServiceCall<Enrichment> getEnrichment(GetEnrichmentOptions getEnrichmentOptions)
getEnrichment(params)
get_enrichment(self,
        project_id: str,
        enrichment_id: str,
        **kwargs
    ) -> DetailedResponse
get_enrichment(project_id:, enrichment_id:)
func getEnrichment(
    projectID: String,
    enrichmentID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)
GetEnrichment(string projectId, string enrichmentId)
GetEnrichment(Callback<Enrichment> callback, string projectId, string enrichmentId)

Request

Instantiate the GetEnrichmentOptions struct and set the fields to provide parameter values for the GetEnrichment method.

Use the GetEnrichmentOptions.Builder to create a GetEnrichmentOptions object that contains the parameter values for the getEnrichment method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The GetEnrichment options.

The getEnrichment options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Status Code

  • Returns information about the specified enrichment.

  • Enrichment or project not found.

No Sample Response

This method does not specify any sample responses.

Update an enrichment

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

Updates an existing enrichment's name and description.

POST /v2/projects/{project_id}/enrichments/{enrichment_id}
(discovery *DiscoveryV2) UpdateEnrichment(updateEnrichmentOptions *UpdateEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) UpdateEnrichmentWithContext(ctx context.Context, updateEnrichmentOptions *UpdateEnrichmentOptions) (result *Enrichment, response *core.DetailedResponse, err error)
ServiceCall<Enrichment> updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions)
updateEnrichment(params)
update_enrichment(self,
        project_id: str,
        enrichment_id: str,
        name: str,
        *,
        description: str = None,
        **kwargs
    ) -> DetailedResponse
update_enrichment(project_id:, enrichment_id:, name:, description: nil)
func updateEnrichment(
    projectID: String,
    enrichmentID: String,
    name: String,
    description: String? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)
UpdateEnrichment(string projectId, string enrichmentId, string name, string description = null)
UpdateEnrichment(Callback<Enrichment> callback, string projectId, string enrichmentId, string name, string description = null)

Request

Instantiate the UpdateEnrichmentOptions struct and set the fields to provide parameter values for the UpdateEnrichment method.

Use the UpdateEnrichmentOptions.Builder to create a UpdateEnrichmentOptions object that contains the parameter values for the updateEnrichment method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

An object that lists the new name and description for an enrichment.

WithContext method only

The UpdateEnrichment options.

The updateEnrichment options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • A new name for the enrichment.

  • A new description for the enrichment.

Response

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Information about a specific enrichment.

Status Code

  • Returns the updated enrichment details.

  • Bad request.

  • Enrichment or project not found.

No Sample Response

This method does not specify any sample responses.

Delete an enrichment

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

DELETE /v2/projects/{project_id}/enrichments/{enrichment_id}
(discovery *DiscoveryV2) DeleteEnrichment(deleteEnrichmentOptions *DeleteEnrichmentOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteEnrichmentWithContext(ctx context.Context, deleteEnrichmentOptions *DeleteEnrichmentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions)
deleteEnrichment(params)
delete_enrichment(self,
        project_id: str,
        enrichment_id: str,
        **kwargs
    ) -> DetailedResponse
delete_enrichment(project_id:, enrichment_id:)
func deleteEnrichment(
    projectID: String,
    enrichmentID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteEnrichment(string projectId, string enrichmentId)
DeleteEnrichment(Callback<object> callback, string projectId, string enrichmentId)

Request

Instantiate the DeleteEnrichmentOptions struct and set the fields to provide parameter values for the DeleteEnrichment method.

Use the DeleteEnrichmentOptions.Builder to create a DeleteEnrichmentOptions object that contains the parameter values for the deleteEnrichment method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

WithContext method only

The DeleteEnrichment options.

The deleteEnrichment options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the enrichment.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

Response

Response type: object

Response type: object

Status Code

  • The enrichment has been successfully deleted

  • Bad request.

  • Enrichment or project not found.

No Sample Response

This method does not specify any sample responses.

Analyze a Document

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

Process a document using the specified collection's settings and return it for realtime use.

Note: Documents processed using this method are not added to the specified collection.

Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.

POST /v2/projects/{project_id}/collections/{collection_id}/analyze
(discovery *DiscoveryV2) AnalyzeDocument(analyzeDocumentOptions *AnalyzeDocumentOptions) (result *AnalyzedDocument, response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) AnalyzeDocumentWithContext(ctx context.Context, analyzeDocumentOptions *AnalyzeDocumentOptions) (result *AnalyzedDocument, response *core.DetailedResponse, err error)
ServiceCall<AnalyzedDocument> analyzeDocument(AnalyzeDocumentOptions analyzeDocumentOptions)
analyzeDocument(params)
analyze_document(self,
        project_id: str,
        collection_id: str,
        *,
        file: BinaryIO = None,
        filename: str = None,
        file_content_type: str = None,
        metadata: str = None,
        **kwargs
    ) -> DetailedResponse
analyze_document(project_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
func analyzeDocument(
    projectID: String,
    collectionID: String,
    file: Data? = nil,
    filename: String? = nil,
    fileContentType: String? = nil,
    metadata: String? = nil,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<AnalyzedDocument>?, WatsonError?) -> Void)
AnalyzeDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null)
AnalyzeDocument(Callback<AnalyzedDocument> callback, string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null)

Request

Instantiate the AnalyzeDocumentOptions struct and set the fields to provide parameter values for the AnalyzeDocument method.

Use the AnalyzeDocumentOptions.Builder to create a AnalyzeDocumentOptions object that contains the parameter values for the analyzeDocument method.

Path Parameters

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression ^[a-zA-Z0-9_-]*$

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

Form Parameters

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }

WithContext method only

The AnalyzeDocument options.

The analyzeDocument options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The ID of the collection.

    Constraints: 1 ≤ length ≤ 255, Value must match regular expression /^[a-zA-Z0-9_-]*$/

  • The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.

  • The filename for file.

  • The content type of file.

    Allowable values: [application/json,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/html,application/xhtml+xml]

  • The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

    Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

Response

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

An object containing the converted document and any identified enrichments.

Status Code

  • The analyzed document.

  • Bad request.

  • Collection not supported for Analyze.

  • Project or collection not found.

  • Analyze timeout.

  • Document or metadata too large.

  • Unsupported media type.

  • Too many requests, try again later.

No Sample Response

This method does not specify any sample responses.

Delete labeled data

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

Note: This method is only supported on IBM Cloud instances of Discovery.

DELETE /v2/user_data
(discovery *DiscoveryV2) DeleteUserData(deleteUserDataOptions *DeleteUserDataOptions) (response *core.DetailedResponse, err error)
(discovery *DiscoveryV2) DeleteUserDataWithContext(ctx context.Context, deleteUserDataOptions *DeleteUserDataOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions)
deleteUserData(params)
delete_user_data(self,
        customer_id: str,
        **kwargs
    ) -> DetailedResponse
delete_user_data(customer_id:)
func deleteUserData(
    customerID: String,
    headers: [String: String]? = nil,
    completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)
DeleteUserData(string customerId)
DeleteUserData(Callback<object> callback, string customerId)

Request

Instantiate the DeleteUserDataOptions struct and set the fields to provide parameter values for the DeleteUserData method.

Use the DeleteUserDataOptions.Builder to create a DeleteUserDataOptions object that contains the parameter values for the deleteUserData method.

Query Parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

WithContext method only

The DeleteUserData options.

The deleteUserData options.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

parameters

  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-11-22.

  • The customer ID for which all data is to be deleted.

Response

Response type: object

Response type: object

Status Code

  • OK. The delete request was successfully submitted.

  • Bad Request. The request did not pass a customer ID:

    • No customer ID found in the request

No Sample Response

This method does not specify any sample responses.