IBM Cloud API Docs

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.

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>11.0.0</version>
</dependency>

Gradle

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

GitHub

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

Installation

npm install ibm-watson@^8.0.0

GitHub

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

Installation

pip install --upgrade "ibm-watson>=7.0.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@v3.0.0

GitHub

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

Cocoapods

pod 'IBMWatsonDiscoveryV2', '~> 5.0.0'

Carthage

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

Swift Package Manager

.package(url: "https://github.com/watson-developer-cloud/swift-sdk", from: "5.0.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 7.0.0

.NET CLI

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

PackageReference

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

GitHub

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

GitHub

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 both the cluster and service instance.

You can find the base URL from the Cloud Pak for Data web client in the details page about the instance. Click the name of the service in your list of instances to see the URL.

Use that URL in your requests to Discovery v2. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the URL by calling the setServiceUrl() method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by specifying the serviceUrl parameter when you create the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

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. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

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. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

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. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by setting the serviceURL property of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by calling the SetEndpoint() method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by setting the Url property of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Endpoint example for Cloud Pak for Data

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

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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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/{deployment_id}/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.

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}" "{url}/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("{url}";

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: '{url}',
  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('{url}')

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 = "{url}"

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("{url}")

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 = "{url}"

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("{url}");

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("{url}");

discovery.DisableSslVerification = true;

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 service instance by clicking the name of the service in your list of instances. 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 /v1/authorize method.

For more information, see the Get authorization token method of the Cloud Pak for Data API reference.

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 /v1/authorize 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.

For more information, see the Get authorization token method of the Cloud Pak for Data API reference.

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 {url}, view the details for the service instance by clicking the name of the service in your list of instances in the Cloud Pak for Data web client.

Cloud Pak for Data. Generating a bearer token.

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 -X POST -H "cache-control: no-cache" -H "Content-Type: application/json" -d "{\"username\":\"{username}\",\"password\":\"{password}\"}" "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize"

The response includes a token property.

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

curl -H "Authorization: Bearer {token}" "{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 {url}, see Endpoint URLs.

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
Discovery discovery = new Discovery("{version}", authenticator);
discovery.setServiceUrl("{url}");

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 {url}, 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}/icp4d-api/v1/authorize',
  }),
  serviceUrl: '{url}',
});

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 {url}, 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}/icp4d-api/v1/authorize'
)

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

discovery.set_service_url('{url}')

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 {url}, 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}/icp4d-api/v1/authorize"
)
discovery = DiscoveryV2.new(
  version: "{version}",
  authenticator: authenticator
)
discovery.service_url = "{url}"

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 {url}, 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}/icp4d-api/v1/authorize",
    Username: "{username}",
    Password: "{password}",
  }

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

  discovery, discoveryErr := discoveryv2.NewDiscoveryV2(options)

  if discoveryErr != nil {
    panic(discoveryErr)
  }

  discovery.SetServiceURL("{url}")
}

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 {url}, see Endpoint URLs.

let authenticator = WatsonCloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize")
let discovery = Discovery(version: "{version}", authenticator: authenticator)
discovery.serviceURL = "{url}"

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}/icp4d-api/v1/authorize",
    username: "{username}",
    password: "{password}"
    );

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

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}/icp4d-api/v1/authorize",
    username: "{username}",
    password: "{password}"
);

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

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

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.

When you give a user ID access to multiple services, 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, the credentials predate service IDs. Add new credentials from the Service credentials page and use those credentials.

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.

Versioning

API requests require a version parameter that takes a date in the format version=YYYY-MM-DD. When the API is updated with any breaking changes, the service introduces a new version date for the API.

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, 2023-03-31. 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, _, 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, _, 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 collect data about API requests and their results. This data is collected only to improve the services for future users. The collected data is not shared or made public. Data is not collected 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 can also disable request logging at the account level. For more information, see Controlling request logging for Watson services.

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 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.

GET /v2/projects
ServiceCall<ListProjectsResponse> listProjects(ListProjectsOptions listProjectsOptions)
listProjects(params)
list_projects(
        self,
        **kwargs,
    ) -> DetailedResponse
ListProjects()

Request

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 2023-03-31.

parameters

    parameters

      parameters

        • curl {auth} "{url}/v2/projects?version=2023-03-31"

        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.

        Status Code

        • Successful response.

        • Bad request.

        Example responses
        • {
            "projects": [
              {
                "project_id": "fe119406-4111-4cd8-8418-6f0074ee5a12",
                "type": "document_retrieval",
                "name": "Sample Project",
                "collection_count": 1
              },
              {
                "project_id": "b1722e7b-0b42-4fce-a6a4-d7cd8a4895f1",
                "type": "document_retrieval",
                "name": "My search bar",
                "collection_count": 5
              },
              {
                "project_id": "c8a8f4f1-9bcb-4035-85ae-5ec2336f2e62",
                "type": "conversational_search",
                "name": "Tutorial project",
                "collection_count": 1
              }
            ]
          }
        • {
            "projects": [
              {
                "project_id": "fe119406-4111-4cd8-8418-6f0074ee5a12",
                "type": "document_retrieval",
                "name": "Sample Project",
                "collection_count": 1
              },
              {
                "project_id": "b1722e7b-0b42-4fce-a6a4-d7cd8a4895f1",
                "type": "document_retrieval",
                "name": "My search bar",
                "collection_count": 5
              },
              {
                "project_id": "c8a8f4f1-9bcb-4035-85ae-5ec2336f2e62",
                "type": "conversational_search",
                "name": "Tutorial project",
                "collection_count": 1
              }
            ]
          }

        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.

        POST /v2/projects
        ServiceCall<ProjectDetails> createProject(CreateProjectOptions createProjectOptions)
        createProject(params)
        create_project(
                self,
                name: str,
                type: str,
                *,
                default_query_parameters: 'DefaultQueryParams' = None,
                **kwargs,
            ) -> DetailedResponse
        CreateProject(string name, string type, DefaultQueryParams defaultQueryParameters = null)

        Request

        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 2023-03-31.

        An object that represents the project to be created.

        The createProject options.

        parameters

        • The human readable name of this project.

        • The type of project.

          The content_intelligence type is a Document Retrieval for Contracts project and the other type is a Custom project.

          The content_mining and content_intelligence types are available with Premium plan managed deployments and installed deployments only.

          Allowable values: [document_retrieval,conversational_search,content_intelligence,content_mining,other]

        • Default query parameters for this project.

        parameters

        • The human readable name of this project.

        • The type of project.

          The content_intelligence type is a Document Retrieval for Contracts project and the other type is a Custom project.

          The content_mining and content_intelligence types are available with Premium plan managed deployments and installed deployments only.

          Allowable values: [document_retrieval,conversational_search,content_intelligence,content_mining,other]

        • Default query parameters for this project.

        parameters

        • The human readable name of this project.

        • The type of project.

          The content_intelligence type is a Document Retrieval for Contracts project and the other type is a Custom project.

          The content_mining and content_intelligence types are available with Premium plan managed deployments and installed deployments only.

          Allowable values: [document_retrieval,conversational_search,content_intelligence,content_mining,other]

        • Default query parameters for this project.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"My project\",   \"type\": \"document_retrieval\" }" "{url}/v2/projects?version=2023-03-31"

        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.

        Status Code

        • The project has successfully been created.

        • Bad request.

        Example responses
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My project",
            "collection_count": 0,
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My project",
            "collection_count": 0,
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }

        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 /v2/projects/{project_id}
        ServiceCall<ProjectDetails> getProject(GetProjectOptions getProjectOptions)
        getProject(params)
        get_project(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetProject(string projectId)

        Request

        Use the GetProjectOptions.Builder to create a GetProjectOptions object that contains the parameter values for the getProject method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The getProject options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}?version=2023-03-31"

        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.

        Status Code

        • Returns information about the specified project if it exists.

        • Project not found.

        Example responses
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My project",
            "collection_count": 0,
            "relevancy_training_status": {
              "total_examples": 0,
              "sufficient_label_diversity": false,
              "processing": false,
              "minimum_examples_added": false,
              "available": false,
              "notices": 0,
              "minimum_queries_added": false
            },
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My project",
            "collection_count": 0,
            "relevancy_training_status": {
              "total_examples": 0,
              "sufficient_label_diversity": false,
              "processing": false,
              "minimum_examples_added": false,
              "available": false,
              "notices": 0,
              "minimum_queries_added": false
            },
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }

        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.

        POST /v2/projects/{project_id}
        ServiceCall<ProjectDetails> updateProject(UpdateProjectOptions updateProjectOptions)
        updateProject(params)
        update_project(
                self,
                project_id: str,
                *,
                name: str = None,
                **kwargs,
            ) -> DetailedResponse
        UpdateProject(string projectId, string name = null)

        Request

        Use the UpdateProjectOptions.Builder to create a UpdateProjectOptions object that contains the parameter values for the updateProject method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        An object that represents the new name of the project.

        The updateProject options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The new name to give this project.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The new name to give this project.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The new name to give this project.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"My updated project\" }" "{url}/v2/projects/{project_id}?version=2023-03-31"

        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.

        Status Code

        • Returns the updated project information.

        • Bad request.

        • Project not found

        Example responses
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My updated project",
            "collection_count": 0,
            "relevancy_training_status": {
              "total_examples": 0,
              "sufficient_label_diversity": false,
              "processing": false,
              "minimum_examples_added": false,
              "available": false,
              "notices": 0,
              "minimum_queries_added": false
            },
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }
        • {
            "project_id": "6b18887d-d68e-434d-99f1-20925c7654e0",
            "type": "document_retrieval",
            "name": "My updated project",
            "collection_count": 0,
            "relevancy_training_status": {
              "total_examples": 0,
              "sufficient_label_diversity": false,
              "processing": false,
              "minimum_examples_added": false,
              "available": false,
              "notices": 0,
              "minimum_queries_added": false
            },
            "default_query_parameters": {
              "aggregation": "[term(enriched_text.entities.text,name:entities)]",
              "count": 10,
              "sort": "",
              "return": [],
              "passages": {
                "enabled": true,
                "count": 10,
                "fields": [
                  "text",
                  "title"
                ],
                "characters": 200,
                "per_document": true,
                "max_per_document": 1,
                "find_answers": false,
                "max_answers_per_passage": 1
              },
              "highlight": false,
              "spelling_suggestions": false,
              "table_results": {
                "enabled": false,
                "count": 10,
                "per_document": 0
              }
            }
          }

        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.

        DELETE /v2/projects/{project_id}
        ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions)
        deleteProject(params)
        delete_project(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteProject(string projectId)

        Request

        Use the DeleteProjectOptions.Builder to create a DeleteProjectOptions object that contains the parameter values for the deleteProject method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The deleteProject options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}?version=2023-03-31"

        Response

        Response type: object

        Status Code

        • The project has been deleted.

        • Bad request.

        • Project not found

        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 specified collections.

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

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

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

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

        GET /v2/projects/{project_id}/fields
        ServiceCall<ListFieldsResponse> listFields(ListFieldsOptions listFieldsOptions)
        listFields(params)
        list_fields(
                self,
                project_id: str,
                *,
                collection_ids: List[str] = None,
                **kwargs,
            ) -> DetailedResponse
        ListFields(string projectId, List<string> collectionIds = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

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

        The listFields options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

          Possible values: 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 {auth} "{url}/v2/projects/{project_id}/fields?collection_ids={collection_id_1},{collection_id_2}&version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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_1}","{collection_id_2}" }
              );
          
          Console.WriteLine(result.Response);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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_1}")
            .addCollectionIds("{collection_id_2}")
            .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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
          });
          
          const params = {
            projectId: '{projectId}',
            collectionIds: ['{collection_id_1}','{collection_id_2}'],
          };
          
          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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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_1}','{collection_id_2}']
          ).get_result()
          print(json.dumps(response, indent=2))
          

        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).

        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).

        • Bad request.

        Example responses
        • {
            "fields": [
              {
                "field": "enriched_text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities.mentions",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities.mentions.location.begin",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "double"
              },
              {
                "field": "enriched_text.entities.mentions.location.end",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "double"
              },
              {
                "field": "enriched_text.entities.mentions.text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.model_name",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.type",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.file_type",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.filename",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.numPages",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.publicationdate",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "date"
              },
              {
                "field": "extracted_metadata.sha1",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "metadata",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "metadata.customer_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "metadata.parent_document_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "document_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              }
            ]
          }
        • {
            "fields": [
              {
                "field": "enriched_text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities.mentions",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "enriched_text.entities.mentions.location.begin",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "double"
              },
              {
                "field": "enriched_text.entities.mentions.location.end",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "double"
              },
              {
                "field": "enriched_text.entities.mentions.text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.model_name",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "enriched_text.entities.type",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.file_type",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.filename",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.numPages",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "extracted_metadata.publicationdate",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "date"
              },
              {
                "field": "extracted_metadata.sha1",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "metadata",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "nested"
              },
              {
                "field": "metadata.customer_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "metadata.parent_document_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "text",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              },
              {
                "field": "document_id",
                "collection_id": "a3a41b30-8336-dc17-0000-017b75119cfe",
                "type": "string"
              }
            ]
          }

        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.

        GET /v2/projects/{project_id}/collections
        ServiceCall<ListCollectionsResponse> listCollections(ListCollectionsOptions listCollectionsOptions)
        listCollections(params)
        list_collections(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListCollections(string projectId)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The listCollections options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}/collections?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Response object that contains an array of collection details.

        Response object that contains an array of collection details.

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

        Response object that contains an array of collection details.

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

        Response object that contains an array of collection details.

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

        Response object that contains an array of collection details.

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

        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.

        POST /v2/projects/{project_id}/collections
        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,
                conversions: 'Conversions' = None,
                normalizations: List['NormalizationOperation'] = None,
                **kwargs,
            ) -> DetailedResponse
        CreateCollection(string projectId, string name, string description = null, string language = null, List<CollectionEnrichment> enrichments = null, Conversions conversions = null, List<NormalizationOperation> normalizations = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        An object that represents the collection to be created.

        The createCollection options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • A description of the collection.

        • The language of the collection. For a list of supported languages, see the product documentation.

          Default: en

        • An array of enrichments that are applied to this collection. To get a list of enrichments that are available for a project, use the List enrichments method.

          If no enrichments are specified when the collection is created, the default enrichments for the project type are applied. For more information about project default settings, see the product documentation.

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • A description of the collection.

        • The language of the collection. For a list of supported languages, see the product documentation.

          Default: en

        • An array of enrichments that are applied to this collection. To get a list of enrichments that are available for a project, use the List enrichments method.

          If no enrichments are specified when the collection is created, the default enrichments for the project type are applied. For more information about project default settings, see the product documentation.

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • A description of the collection.

        • The language of the collection. For a list of supported languages, see the product documentation.

          Default: en

        • An array of enrichments that are applied to this collection. To get a list of enrichments that are available for a project, use the List enrichments method.

          If no enrichments are specified when the collection is created, the default enrichments for the project type are applied. For more information about project default settings, see the product documentation.

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{ \"name\": \"Tutorials\",   \"description\": \"Instructional PDFs\" }" "{url}/v2/projects/{project_id}/collections?version=2023-03-31"

        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.

        Status Code

        • The collection has been successfully created

        • Bad request.

          • No request body.

          • Missing rquired request parameter or its value.

          • Missing project.

          • Too many collections in project.

          • Too many total collections.

          • Unsupported language is requested.

          • Invalid normalization operation is requested.

          • Missing normalization source.

          • Missing normalization destination.

          • Invalid normalization destination.

        • Project not found.

        Example responses
        • {
            "name": "Tutorials",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": false
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 0,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 0,
              "failed": 0
            }
          }
        • {
            "name": "Tutorials",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": false
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 0,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 0,
              "failed": 0
            }
          }

        Get collection details

        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}
        ServiceCall<CollectionDetails> getCollection(GetCollectionOptions getCollectionOptions)
        getCollection(params)
        get_collection(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetCollection(string projectId, string collectionId)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The getCollection options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}?version=2023-03-31"

        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.

        Status Code

        • Returns the specified collection details.

        • Collection or project not found.

        Example responses
        • {
            "name": "Tutorials",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": true,
              "model": "text_extraction"
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 10,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 10,
              "failed": 0
            }
          }
        • {
            "name": "Tutorials",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": true,
              "model": "text_extraction"
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 10,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 10,
              "failed": 0
            }
          }

        Update a collection

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

        If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the collection. To do so, from the Manage fields page in the product user interface, temporarily change the data type of a field to enable the reprocess button. Change the data type of the field back to its original value, and then click Apply changes and reprocess.

        To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion, specify an empty json_normalizations object ([]) in the request.

        To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an empty normalizations object ([]) in the request.

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

        If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the collection. To do so, from the Manage fields page in the product user interface, temporarily change the data type of a field to enable the reprocess button. Change the data type of the field back to its original value, and then click Apply changes and reprocess.

        To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion, specify an empty json_normalizations object ([]) in the request.

        To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an empty normalizations object ([]) in the request.

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

        If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the collection. To do so, from the Manage fields page in the product user interface, temporarily change the data type of a field to enable the reprocess button. Change the data type of the field back to its original value, and then click Apply changes and reprocess.

        To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion, specify an empty json_normalizations object ([]) in the request.

        To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an empty normalizations object ([]) in the request.

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

        If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the collection. To do so, from the Manage fields page in the product user interface, temporarily change the data type of a field to enable the reprocess button. Change the data type of the field back to its original value, and then click Apply changes and reprocess.

        To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion, specify an empty json_normalizations object ([]) in the request.

        To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an empty normalizations object ([]) in the request.

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

        If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the collection. To do so, from the Manage fields page in the product user interface, temporarily change the data type of a field to enable the reprocess button. Change the data type of the field back to its original value, and then click Apply changes and reprocess.

        To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion, specify an empty json_normalizations object ([]) in the request.

        To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an empty normalizations object ([]) in the request.

        POST /v2/projects/{project_id}/collections/{collection_id}
        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,
                conversions: 'Conversions' = None,
                normalizations: List['NormalizationOperation'] = None,
                **kwargs,
            ) -> DetailedResponse
        UpdateCollection(string projectId, string collectionId, string name = null, string description = null, List<CollectionEnrichment> enrichments = null, Conversions conversions = null, List<NormalizationOperation> normalizations = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        An object that represents the collection to be updated.

        The updateCollection options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The new name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • The new description of the collection.

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

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The new name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • The new description of the collection.

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

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The new name of the collection.

          Possible values: 0 ≤ length ≤ 255

        • The new description of the collection.

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

        • Document processing operations that occur during the document conversion phase of ingestion.

          Note: Available only from service instances that are managed by IBM Cloud.

        • Defines operations that normalize the JSON representation of data after enrichments are applied. Operations run in the order that is specified in this array.

          New fields that are added with a post-enrichment normalization are displayed in the JSON representation of query results, but are not available from product user interface pages, such as Manage fields.

          Note: Available only from service instances that are managed by IBM Cloud.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"Tutorials for developers\" }" "{url}/v2/projects/{project_id}/collections/{collection_id}?version=2023-03-31"

        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.

        Status Code

        • Returns the updated collection details.

        • Bad request.

          • No request body.

          • Missing project or collection.

          • Invalid normalization operation is requested.

          • Missing normalization source.

          • Missing normalization destination.

          • Invalid normalization destination.

        • Collection or project not found.

        Example responses
        • {
            "name": "Tutorials for developers",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": true,
              "model": "text_extraction"
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 0,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 0,
              "failed": 0
            }
          }
        • {
            "name": "Tutorials for developers",
            "collection_id": "eb0215ed-6ec2-132a-0000-017b740f39c1",
            "description": "Instructional PDFs",
            "created": "2021-08-23T17:29:21.104Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "fields": [
                  "text"
                ]
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text"
                ]
              }
            ],
            "smart_document_understanding": {
              "enabled": true,
              "model": "text_extraction"
            },
            "source_document_counts": {
              "pending": 0,
              "processing": 0,
              "available": 0,
              "failed": 0
            },
            "document_counts": {
              "processing": 0,
              "available": 0,
              "failed": 0
            }
          }

        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.

        DELETE /v2/projects/{project_id}/collections/{collection_id}
        ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollectionOptions)
        deleteCollection(params)
        delete_collection(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteCollection(string projectId, string collectionId)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The deleteCollection options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}?version=2023-03-31"

        Response

        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.

        List documents

        Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and from IBM Cloud-managed instances.

        Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        GET /v2/projects/{project_id}/collections/{collection_id}/documents
        ServiceCall<ListDocumentsResponse> listDocuments(ListDocumentsOptions listDocumentsOptions)
        listDocuments(params)
        list_documents(
                self,
                project_id: str,
                collection_id: str,
                *,
                count: int = None,
                status: str = None,
                has_notices: bool = None,
                is_parent: bool = None,
                parent_document_id: str = None,
                sha256: str = None,
                **kwargs,
            ) -> DetailedResponse
        ListDocuments(string projectId, string collectionId, long? count = null, string status = null, bool? hasNotices = null, bool? isParent = null, string parentDocumentId = null, string sha256 = null)

        Request

        Use the ListDocumentsOptions.Builder to create a ListDocumentsOptions object that contains the parameter values for the listDocuments method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        • The maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000.

          Default: 1000

        • Filters the documents to include only documents with the specified ingestion status. The options include:

          • available: Ingestion is finished and the document is indexed.

          • failed: Ingestion is finished, but the document is not indexed because of an error.

          • pending: The document is uploaded, but the ingestion process is not started.

          • processing: Ingestion is in progress.

          You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed.

        • If set to true, only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false, only documents that don't have notices are returned. If unspecified, no filter based on notices is applied.

          Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}.

        • If set to true, only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false, only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.

          CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object.

        • Filters the documents to include only child documents that were generated when the specified parent document was processed.

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

        • Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string.

        The listDocuments options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000.

          Default: 1000

        • Filters the documents to include only documents with the specified ingestion status. The options include:

          • available: Ingestion is finished and the document is indexed.

          • failed: Ingestion is finished, but the document is not indexed because of an error.

          • pending: The document is uploaded, but the ingestion process is not started.

          • processing: Ingestion is in progress.

          You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed.

        • If set to true, only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false, only documents that don't have notices are returned. If unspecified, no filter based on notices is applied.

          Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}.

        • If set to true, only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false, only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.

          CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object.

        • Filters the documents to include only child documents that were generated when the specified parent document was processed.

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

        • Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000.

          Default: 1000

        • Filters the documents to include only documents with the specified ingestion status. The options include:

          • available: Ingestion is finished and the document is indexed.

          • failed: Ingestion is finished, but the document is not indexed because of an error.

          • pending: The document is uploaded, but the ingestion process is not started.

          • processing: Ingestion is in progress.

          You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed.

        • If set to true, only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false, only documents that don't have notices are returned. If unspecified, no filter based on notices is applied.

          Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}.

        • If set to true, only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false, only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.

          CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object.

        • Filters the documents to include only child documents that were generated when the specified parent document was processed.

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

        • Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000.

          Default: 1000

        • Filters the documents to include only documents with the specified ingestion status. The options include:

          • available: Ingestion is finished and the document is indexed.

          • failed: Ingestion is finished, but the document is not indexed because of an error.

          • pending: The document is uploaded, but the ingestion process is not started.

          • processing: Ingestion is in progress.

          You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed.

        • If set to true, only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false, only documents that don't have notices are returned. If unspecified, no filter based on notices is applied.

          Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}.

        • If set to true, only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false, only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.

          CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object.

        • Filters the documents to include only child documents that were generated when the specified parent document was processed.

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

        • Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string.

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/documents?status=available&version=2023-03-31"

        Response

        Response object that contains an array of documents.

        Response object that contains an array of documents.

        Examples:
        {
          "matching_results": 2,
          "documents": [
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_0"
            },
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_1"
            }
          ]
        }

        Response object that contains an array of documents.

        Examples:
        {
          "matching_results": 2,
          "documents": [
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_0"
            },
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_1"
            }
          ]
        }

        Response object that contains an array of documents.

        Examples:
        {
          "matching_results": 2,
          "documents": [
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_0"
            },
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_1"
            }
          ]
        }

        Response object that contains an array of documents.

        Examples:
        {
          "matching_results": 2,
          "documents": [
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_0"
            },
            {
              "document_id": "4ffcfd8052005b99469e632506763bac_1"
            }
          ]
        }

        Status Code

        • Successful response.

        • Missing project or collection.

        Example responses
        • {
            "matching_results": 2,
            "documents": [
              {
                "document_id": "4ffcfd8052005b99469e632506763bac_0"
              },
              {
                "document_id": "4ffcfd8052005b99469e632506763bac_1"
              }
            ]
          }
        • {
            "matching_results": 2,
            "documents": [
              {
                "document_id": "4ffcfd8052005b99469e632506763bac_0"
              },
              {
                "document_id": "4ffcfd8052005b99469e632506763bac_1"
              }
            ]
          }

        Add a document

        Add a document to a collection with optional metadata.

        Returns immediately after the system has accepted the document for processing.

        Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

        • For a list of supported file types, see the product documentation.

        • You must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

        • You 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.

        • If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        • In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced.

        For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

        Add a document to a collection with optional metadata.

        Returns immediately after the system has accepted the document for processing.

        Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

        • For a list of supported file types, see the product documentation.

        • You must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

        • You 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.

        • If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        • In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced.

        For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

        Add a document to a collection with optional metadata.

        Returns immediately after the system has accepted the document for processing.

        Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

        • For a list of supported file types, see the product documentation.

        • You must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

        • You 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.

        • If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        • In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced.

        For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

        Add a document to a collection with optional metadata.

        Returns immediately after the system has accepted the document for processing.

        Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

        • For a list of supported file types, see the product documentation.

        • You must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

        • You 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.

        • If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        • In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced.

        For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

        Add a document to a collection with optional metadata.

        Returns immediately after the system has accepted the document for processing.

        Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

        • For a list of supported file types, see the product documentation.

        • You must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.

        • You 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.

        • If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        • In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced.

        For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

        POST /v2/projects/{project_id}/collections/{collection_id}/documents
        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
        AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)

        Request

        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 Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        Form Parameters

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }

        The addDocument options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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 {auth} --form "file=@{filename}"  --form metadata="{\"field_name\": \"content\"}" "{url}/v2/projects/{project_id}/collections/{collection_id}/documents?version=2023-03-31"

          Download example document sample1.html

        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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',
              file_content_type='application/pdf'
            ).get_result()
            print(json.dumps(response, indent=2))
          

        Response

        Information returned after an uploaded document is accepted.

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        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"
          }

        Get document details

        Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and from IBM Cloud-managed instances.

        Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

        Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

        GET /v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
        ServiceCall<DocumentDetails> getDocument(GetDocumentOptions getDocumentOptions)
        getDocument(params)
        get_document(
                self,
                project_id: str,
                collection_id: str,
                document_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetDocument(string projectId, string collectionId, string documentId)

        Request

        Use the GetDocumentOptions.Builder to create a GetDocumentOptions object that contains the parameter values for the getDocument method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        • The ID of the document.

          Possible values: 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 2023-03-31.

        The getDocument options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}?version=2023-03-31"

        Response

        Information about a document.

        Information about a document.

        Information about a document.

        Information about a document.

        Information about a document.

        Status Code

        • Returns the specified document details.

        • Missing project, collection, or document.

        Example responses
        • {
            "document_id": "4ffcfd8052005b99469e632506763bac_0",
            "created": "2022-04-05T07:01:55.863Z",
            "updated": "2022-04-21T06:27:26.509Z",
            "status": "available",
            "notices": [],
            "children": {
              "count": 0,
              "have_notices": false
            },
            "filename": "Proposal.docx",
            "file_type": "word"
          }
        • {
            "document_id": "4ffcfd8052005b99469e632506763bac_0",
            "created": "2022-04-05T07:01:55.863Z",
            "updated": "2022-04-21T06:27:26.509Z",
            "status": "available",
            "notices": [],
            "children": {
              "count": 0,
              "have_notices": false
            },
            "filename": "Proposal.docx",
            "file_type": "word"
          }

        Update a document

        Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

        Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

        If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        Notes:

        • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.

        • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.

        Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

        Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

        If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        Notes:

        • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.

        • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.

        Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

        Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

        If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        Notes:

        • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.

        • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.

        Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

        Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

        If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        Notes:

        • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.

        • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.

        Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

        Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

        If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true.

        Notes:

        • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.

        • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.

        POST /v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
        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
        UpdateDocument(string projectId, string collectionId, string documentId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null)

        Request

        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 Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        • The ID of the document.

          Possible values: 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 2023-03-31.

        Form Parameters

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }

        The updateDocument options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • 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 {auth} --form "file=@{filename}"  --form metadata="{\"field_name\": \"content\"}" "{url}/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}?version=2023-03-31"

          Download example document sample1.html

        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Information returned after an uploaded document is accepted.

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        Information returned after an uploaded document is accepted.

        Examples:
        {
          "document_id": "f1360220-ea2d-4271-9d62-89a910b13c37",
          "status": "processing"
        }

        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 the project, collection, or document ID is missing or incorrect.

        • 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

        Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

        Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

        Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

        Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

        Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

        Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

        Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

        Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

        Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

        Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

        DELETE /v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}
        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
        DeleteDocument(string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null)

        Request

        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 Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        • The ID of the document.

          Possible values: 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 2023-03-31.

        The deleteDocument options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • The ID of the document.

          Possible values: 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 -X DELETE {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        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.

        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 is missing or incorrect.

        No Sample Response

        This method does not specify any sample responses.

        Query a project

        Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

        The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

        Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

        The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

        Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

        The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

        Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

        The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

        Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

        The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

        POST /v2/projects/{project_id}/query
        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,
                similar: 'QueryLargeSimilar' = None,
                **kwargs,
            ) -> DetailedResponse
        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, QueryLargeSimilar similar = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        An object that represents the query to be submitted.

        The query options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using training data and natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

        • 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 more information about the supported types of aggregations, see the Discovery documentation.

        • Number of results to return.

        • A list of the fields in the document hierarchy to return. You can specify both root-level (text) and nested (extracted_metadata.filename) fields. If this parameter is an empty list, then all 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.

        • When true, a highlight field is returned for each result that contains fields that match the query. The matching query terms are emphasized with surrounding <em></em> tags. This parameter is ignored if passages.enabled and passages.per_document are true, in which case passages are returned for each document instead of highlights.

        • 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.

          Note: The suggested_refinements parameter that identified dynamic facets from the data is deprecated.

        • Configuration for passage retrieval.

        • Finds results from documents that are similar to documents of interest. Use this parameter to add a More like these function to your search. You can include this parameter with or without a query, filter or natural_language_query parameter.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using training data and natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

        • 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 more information about the supported types of aggregations, see the Discovery documentation.

        • Number of results to return.

        • A list of the fields in the document hierarchy to return. You can specify both root-level (text) and nested (extracted_metadata.filename) fields. If this parameter is an empty list, then all 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.

        • When true, a highlight field is returned for each result that contains fields that match the query. The matching query terms are emphasized with surrounding <em></em> tags. This parameter is ignored if passages.enabled and passages.per_document are true, in which case passages are returned for each document instead of highlights.

        • 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.

          Note: The suggested_refinements parameter that identified dynamic facets from the data is deprecated.

        • Configuration for passage retrieval.

        • Finds results from documents that are similar to documents of interest. Use this parameter to add a More like these function to your search. You can include this parameter with or without a query, filter or natural_language_query parameter.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using training data and natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

        • 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 more information about the supported types of aggregations, see the Discovery documentation.

        • Number of results to return.

        • A list of the fields in the document hierarchy to return. You can specify both root-level (text) and nested (extracted_metadata.filename) fields. If this parameter is an empty list, then all 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.

        • When true, a highlight field is returned for each result that contains fields that match the query. The matching query terms are emphasized with surrounding <em></em> tags. This parameter is ignored if passages.enabled and passages.per_document are true, in which case passages are returned for each document instead of highlights.

        • 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.

          Note: The suggested_refinements parameter that identified dynamic facets from the data is deprecated.

        • Configuration for passage retrieval.

        • Finds results from documents that are similar to documents of interest. Use this parameter to add a More like these function to your search. You can include this parameter with or without a query, filter or natural_language_query parameter.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"collection_ids\": [      \"{collection_id_1}\",     \"{collection_id_2}\"   ],   \"query\": \"text:IBM\" }" "{url}/v2/projects/{project_id}/query?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        A response that contains the documents and aggregations for the query.

        A response that contains the documents and aggregations for the query.

        Examples:
        {
          "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
                }
              ]
            }
          ]
        }

        A response that contains the documents and aggregations for the query.

        Examples:
        {
          "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
                }
              ]
            }
          ]
        }

        A response that contains the documents and aggregations for the query.

        Examples:
        {
          "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
                }
              ]
            }
          ]
        }

        A response that contains the documents and aggregations for the query.

        Examples:
        {
          "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
                }
              ]
            }
          ]
        }

        Status Code

        • Query executed successfully.

        • Bad request.

          • Project has no collections.

          • A list of document ids is required in similar.document_ids when similar.enabled is true.

        • 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.

        Suggested words are based on terms from the project documents. Suggestions are not based on terms from the project's search history, and the project does not learn from previous user choices.

        Returns completion query suggestions for the specified prefix.

        Suggested words are based on terms from the project documents. Suggestions are not based on terms from the project's search history, and the project does not learn from previous user choices.

        Returns completion query suggestions for the specified prefix.

        Suggested words are based on terms from the project documents. Suggestions are not based on terms from the project's search history, and the project does not learn from previous user choices.

        Returns completion query suggestions for the specified prefix.

        Suggested words are based on terms from the project documents. Suggestions are not based on terms from the project's search history, and the project does not learn from previous user choices.

        Returns completion query suggestions for the specified prefix.

        Suggested words are based on terms from the project documents. Suggestions are not based on terms from the project's search history, and the project does not learn from previous user choices.

        GET /v2/projects/{project_id}/autocompletion
        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
        GetAutocompletion(string projectId, string prefix, List<string> collectionIds = null, string field = null, long? count = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot, housing, or how.

        • 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

        The getAutocompletion options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot, housing, or how.

        • 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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot, housing, or how.

        • 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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot, housing, or how.

        • 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

        • curl {auth} "{url}/v2/projects/{project_id}/autocompletion?collection_ids={collection_id_1},{collection_id_2}&prefix=ab&version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        An object that contains an array of autocompletion suggestions.

        An object that contains an array of autocompletion suggestions.

        An object that contains an array of autocompletion suggestions.

        An object that contains an array of autocompletion suggestions.

        An object that contains an array of autocompletion suggestions.

        Status Code

        • Object that contains an array of possible completions.

        • The specified field does not exist.

        Example responses
        • {
            "completions": [
              "absolutely"
            ]
          }
        • {
            "completions": [
              "absolutely"
            ]
          }

        Query collection notices

        Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

        Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

        Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

        Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

        Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

        GET /v2/projects/{project_id}/collections/{collection_id}/notices
        ServiceCall<QueryNoticesResponse> queryCollectionNotices(QueryCollectionNoticesOptions queryCollectionNoticesOptions)
        queryCollectionNotices(params)
        query_collection_notices(
                self,
                project_id: str,
                collection_id: str,
                *,
                filter: str = None,
                query: str = None,
                natural_language_query: str = None,
                count: int = None,
                offset: int = None,
                **kwargs,
            ) -> DetailedResponse
        QueryCollectionNotices(string projectId, string collectionId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null)

        Request

        Use the QueryCollectionNoticesOptions.Builder to create a QueryCollectionNoticesOptions object that contains the parameter values for the queryCollectionNotices method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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

        The queryCollectionNotices options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        • curl {auth} '{url}/v2/projects/{project_id}/collections/{collection_id}/notices?version=2023-03-31&query=notices.step:conversion&count=2'
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", authenticator);
          service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
          
          var result = service.QueryCollectionNotices(
              projectId: "{projectId}",
              collectionId: "{collectionId}",
              query: "notices.step:conversion&count=2"
              );
          
          Console.WriteLine(result.Response);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", authenticator);
          discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
          
          QueryCollectionNoticesOptions queryCollectionNoticesOptions = new QueryCollectionNoticesOptions.Builder()
            .projectId("{project_id}")
            .collectionId("{collection_id}")
            .naturalLanguageQuery("warning")
            .build();
          QueryNoticesResponse response = discovery.queryCollectionNotices(queryCollectionNoticesOptions).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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
          });
          
          const params = {
            projectId: '{projectId}',
            collectionId: '{collectionId}',
            query: 'notices.step:conversion&count=2',
          };
          
          discovery.queryCollectionNotices(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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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}',
            collection_id='{collection_id}',
            query='notices.step:conversion&count=2'
          ).get_result()
          print(json.dumps(response, indent=2))
          

        Response

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Status Code

        • Query for collection notices executed successfully.

        • Bad request.

        Example responses
        • {
            "matching_results": 48,
            "notices": [
              {
                "severity": "warning",
                "created": "2021-09-15T20:11:22Z",
                "description": "We couldn't download the requested content from https://www.cdc.gov/coronavirus/2019-ncov/global-covid-19/essential-health-services.html because the request timed out.",
                "step": "conversion",
                "document_id": "9yJk9qKOQ",
                "notice_id": "failed_crawl"
              },
              {
                "severity": "warning",
                "created": "2021-09-15T20:17:30Z",
                "description": "We couldn't download the requested content from https://www.cdc.gov/coronavirus/2019-ncov/covid-data/covid-19-data-sources.html because the request timed out.",
                "step": "conversion",
                "document_id": "0xSkAIgmj",
                "notice_id": "failed_crawl"
              }
            ]
          }
        • {
            "matching_results": 48,
            "notices": [
              {
                "severity": "warning",
                "created": "2021-09-15T20:11:22Z",
                "description": "We couldn't download the requested content from https://www.cdc.gov/coronavirus/2019-ncov/global-covid-19/essential-health-services.html because the request timed out.",
                "step": "conversion",
                "document_id": "9yJk9qKOQ",
                "notice_id": "failed_crawl"
              },
              {
                "severity": "warning",
                "created": "2021-09-15T20:17:30Z",
                "description": "We couldn't download the requested content from https://www.cdc.gov/coronavirus/2019-ncov/covid-data/covid-19-data-sources.html because the request timed out.",
                "step": "conversion",
                "document_id": "0xSkAIgmj",
                "notice_id": "failed_crawl"
              }
            ]
          }

        Query project notices

        Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

        Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

        Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

        Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

        Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

        GET /v2/projects/{project_id}/notices
        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
        QueryNotices(string projectId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null)

        Request

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

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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

        The queryNotices options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Searches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.

        • A query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. You can use this parameter or the natural_language_query parameter to specify the query input, but not both.

        • A natural language query that returns relevant documents by using natural language understanding. You can use this parameter or the query parameter to specify the query input, but not both. To filter the results based on criteria you specify, include the filter parameter in the request.

          Possible values: 1 ≤ length ≤ 2048

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

          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.

        • curl {auth} "{url}/v2/projects/{project_id}/notices?natural_language_query=error&version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Object that contains notice query results.

        Status Code

        • Query for project notices executed successfully.

        • Bad request.

        No Sample Response

        This method does not specify any sample responses.

        Get a custom stop words list

        Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

        Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

        Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

        Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

        Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

        GET /v2/projects/{project_id}/collections/{collection_id}/stopwords
        ServiceCall<StopWordList> getStopwordList(GetStopwordListOptions getStopwordListOptions)
        getStopwordList(params)
        get_stopword_list(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetStopwordList(string projectId, string collectionId)

        Request

        Use the GetStopwordListOptions.Builder to create a GetStopwordListOptions object that contains the parameter values for the getStopwordList method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The getStopwordList options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/stopwords?version=2023-03-31"

        Response

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        Status Code

        • List of custom stop words or an empty array if no custom stop words list is applied to the collection.

        Example responses
        • {
            "stopwords": []
          }
        • {
            "stopwords": []
          }

        Create a custom stop words list

        Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

        A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

        The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

        Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

        A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

        The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

        Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

        A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

        The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

        Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

        A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

        The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

        Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

        A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

        The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

        POST /v2/projects/{project_id}/collections/{collection_id}/stopwords
        ServiceCall<StopWordList> createStopwordList(CreateStopwordListOptions createStopwordListOptions)
        createStopwordList(params)
        create_stopword_list(
                self,
                project_id: str,
                collection_id: str,
                *,
                stopwords: List[str] = None,
                **kwargs,
            ) -> DetailedResponse
        CreateStopwordList(string projectId, string collectionId, List<string> stopwords = null)

        Request

        Use the CreateStopwordListOptions.Builder to create a CreateStopwordListOptions object that contains the parameter values for the createStopwordList method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        List of words to filter out of text that is submitted in queries.

        The createStopwordList options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • List of stop words.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • List of stop words.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • List of stop words.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"stopwords\": [      \"a\",     \"about\",     \"again\",     \"am\",     \"an\",     \"and\",     \"any\",     \"are\",     \"as\",     \"at\",     \"be\",     \"because\",     \"been\",     \"being\",     \"between\",     \"both\",     \"but\",     \"by\"   ] }" "{url}/v2/projects/{project_id}/collections/{collection_id}/stopwords?version=2023-03-31"

        Response

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        List of words to filter out of text that is submitted in queries.

        Status Code

        • The array of custom stop words that are applied to the collection.

        • Bad request.

          • Unable to create stop words because request body was not valid JSON or was incorrect JSON.

          • Stopword creation request contained no stopwords.

        • Could not find named collection.

        • Input stopwords file is too large. Input must be less than 1000000 characters.

        Example responses
        • {
            "stopwords": [
              "a",
              "about",
              "again",
              "am",
              "an",
              "and",
              "any",
              "are",
              "as",
              "at",
              "be",
              "because",
              "been",
              "being",
              "between",
              "both",
              "but",
              "by"
            ]
          }
        • {
            "stopwords": [
              "a",
              "about",
              "again",
              "am",
              "an",
              "and",
              "any",
              "are",
              "as",
              "at",
              "be",
              "because",
              "been",
              "being",
              "between",
              "both",
              "but",
              "by"
            ]
          }

        Delete a custom stop words list

        Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

        Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

        Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

        Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

        Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

        DELETE /v2/projects/{project_id}/collections/{collection_id}/stopwords
        ServiceCall<Void> deleteStopwordList(DeleteStopwordListOptions deleteStopwordListOptions)
        deleteStopwordList(params)
        delete_stopword_list(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteStopwordList(string projectId, string collectionId)

        Request

        Use the DeleteStopwordListOptions.Builder to create a DeleteStopwordListOptions object that contains the parameter values for the deleteStopwordList method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The deleteStopwordList options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/stopwords?version=2023-03-31"

        Response

        Response type: object

        Status Code

        • The custom stop words list was deleted.

        No Sample Response

        This method does not specify any sample responses.

        Get the expansion list

        Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

        Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

        Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

        Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

        Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

        GET /v2/projects/{project_id}/collections/{collection_id}/expansions
        ServiceCall<Expansions> listExpansions(ListExpansionsOptions listExpansionsOptions)
        listExpansions(params)
        list_expansions(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListExpansions(string projectId, string collectionId)

        Request

        Use the ListExpansionsOptions.Builder to create a ListExpansionsOptions object that contains the parameter values for the listExpansions method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The listExpansions options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/expansions?version=2023-03-31"

        Response

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        Status Code

        • Successfully fetched expansion details.

        • Bad request if the request is incorrectly formatted. The error message contains details about what caused the request to be rejected.

        Example responses
        • {
            "expansions": []
          }
        • {
            "expansions": []
          }

        Create or update an expansion list

        Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

        Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

        Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

        Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

        Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

        POST /v2/projects/{project_id}/collections/{collection_id}/expansions
        ServiceCall<Expansions> createExpansions(CreateExpansionsOptions createExpansionsOptions)
        createExpansions(params)
        create_expansions(
                self,
                project_id: str,
                collection_id: str,
                expansions: List['Expansion'],
                **kwargs,
            ) -> DetailedResponse
        CreateExpansions(string projectId, string collectionId, List<Expansion> expansions)

        Request

        Use the CreateExpansionsOptions.Builder to create a CreateExpansionsOptions object that contains the parameter values for the createExpansions method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        An object that defines the expansion list.

        The createExpansions options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • An array of query expansion definitions.

          Each object in the expansions array represents a term or set of terms that will be expanded into other terms. Each expansion object can be configured as bidirectional or unidirectional.

          • Bidirectional: Each entry in the expanded_terms list expands to include all expanded terms. For example, a query for ibm expands to ibm OR international business machines OR big blue.

          • Unidirectional: The terms in input_terms in the query are replaced by the terms in expanded_terms. For example, a query for the often misused term on premise is converted to on premises OR on-premises and does not contain the original term. If you want an input term to be included in the query, then repeat the input term in the expanded terms list.

          Possible values: 0 ≤ number of items ≤ 5000

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • An array of query expansion definitions.

          Each object in the expansions array represents a term or set of terms that will be expanded into other terms. Each expansion object can be configured as bidirectional or unidirectional.

          • Bidirectional: Each entry in the expanded_terms list expands to include all expanded terms. For example, a query for ibm expands to ibm OR international business machines OR big blue.

          • Unidirectional: The terms in input_terms in the query are replaced by the terms in expanded_terms. For example, a query for the often misused term on premise is converted to on premises OR on-premises and does not contain the original term. If you want an input term to be included in the query, then repeat the input term in the expanded terms list.

          Possible values: 0 ≤ number of items ≤ 5000

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • An array of query expansion definitions.

          Each object in the expansions array represents a term or set of terms that will be expanded into other terms. Each expansion object can be configured as bidirectional or unidirectional.

          • Bidirectional: Each entry in the expanded_terms list expands to include all expanded terms. For example, a query for ibm expands to ibm OR international business machines OR big blue.

          • Unidirectional: The terms in input_terms in the query are replaced by the terms in expanded_terms. For example, a query for the often misused term on premise is converted to on premises OR on-premises and does not contain the original term. If you want an input term to be included in the query, then repeat the input term in the expanded terms list.

          Possible values: 0 ≤ number of items ≤ 5000

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"expansions\": [     {      \"input_terms\": [        \"on premise\"      ],      \"expanded_terms\": [         \"on premises\",        \"on-premises\"      ]    },    {      \"input_terms\": [        \"car\"      ],      \"expanded_terms\": [         \"car\",        \"automobile\",        \"vehicle\"      ]    },    {      \"expanded_terms\": [         \"ibm\",        \"international business machines\",        \"big blue\"      ]    }   ] }" "{url}/v2/projects/{project_id}/collections/{collection_id}/expansions?version=2023-03-31"

        Response

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        The query expansion definitions for the specified collection.

        Status Code

        • The expansion list has been accepted and will be used for all future queries

        • Bad request.

          • Unable to create expansions because request body was not valid JSON or was incorrect JSON.

          • Query expansion creation request contained no expansions.

          • Request exceeded expansion mappings limit.

        • Could not find named collection.

        Example responses
        • {
            "expansions": [
              {
                "input_terms": [
                  "on premise"
                ],
                "expanded_terms": [
                  "on premises",
                  "on-premises"
                ]
              },
              {
                "input_terms": [
                  "car"
                ],
                "expanded_terms": [
                  "car",
                  "automobile",
                  "vehicle"
                ]
              },
              {
                "expanded_terms": [
                  "ibm",
                  "international business machines",
                  "big blue"
                ]
              }
            ]
          }
        • {
            "expansions": [
              {
                "input_terms": [
                  "on premise"
                ],
                "expanded_terms": [
                  "on premises",
                  "on-premises"
                ]
              },
              {
                "input_terms": [
                  "car"
                ],
                "expanded_terms": [
                  "car",
                  "automobile",
                  "vehicle"
                ]
              },
              {
                "expanded_terms": [
                  "ibm",
                  "international business machines",
                  "big blue"
                ]
              }
            ]
          }

        Delete the expansion list

        Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

        Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

        Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

        Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

        Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

        DELETE /v2/projects/{project_id}/collections/{collection_id}/expansions
        ServiceCall<Void> deleteExpansions(DeleteExpansionsOptions deleteExpansionsOptions)
        deleteExpansions(params)
        delete_expansions(
                self,
                project_id: str,
                collection_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteExpansions(string projectId, string collectionId)

        Request

        Use the DeleteExpansionsOptions.Builder to create a DeleteExpansionsOptions object that contains the parameter values for the deleteExpansions method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        The deleteExpansions options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/expansions?version=2023-03-31"

        Response

        Response type: object

        Status Code

        • The expansion list was successfully deleted.

        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.

        GET /v2/projects/{project_id}/component_settings
        ServiceCall<ComponentSettingsResponse> getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions)
        getComponentSettings(params)
        get_component_settings(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetComponentSettings(string projectId)

        Request

        Use the GetComponentSettingsOptions.Builder to create a GetComponentSettingsOptions object that contains the parameter values for the getComponentSettings method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The getComponentSettings options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}/component_settings?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        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.

        Status Code

        • Successful response.

        Example responses
        • {
            "results_per_page": 5,
            "structured_search": false,
            "fields_shown": {
              "body": {
                "use_passage": true,
                "field": ""
              },
              "title": {
                "field": "title"
              }
            },
            "aggregations": [
              {
                "name": "entities",
                "label": "Top Entities",
                "multiple_selections_allowed": true
              },
              {
                "name": "_system_collections",
                "label": "Collections",
                "multiple_selections_allowed": true
              }
            ],
            "autocomplete": true
          }
        • {
            "results_per_page": 5,
            "structured_search": false,
            "fields_shown": {
              "body": {
                "use_passage": true,
                "field": ""
              },
              "title": {
                "field": "title"
              }
            },
            "aggregations": [
              {
                "name": "entities",
                "label": "Top Entities",
                "multiple_selections_allowed": true
              },
              {
                "name": "_system_collections",
                "label": "Collections",
                "multiple_selections_allowed": true
              }
            ],
            "autocomplete": true
          }

        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.

        GET /v2/projects/{project_id}/training_data/queries
        ServiceCall<TrainingQuerySet> listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions)
        listTrainingQueries(params)
        list_training_queries(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListTrainingQueries(string projectId)

        Request

        Use the ListTrainingQueriesOptions.Builder to create a ListTrainingQueriesOptions object that contains the parameter values for the listTrainingQueries method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The listTrainingQueries options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}/training_data/queries?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        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.

        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.

        DELETE /v2/projects/{project_id}/training_data/queries
        ServiceCall<Void> deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions)
        deleteTrainingQueries(params)
        delete_training_queries(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteTrainingQueries(string projectId)

        Request

        Use the DeleteTrainingQueriesOptions.Builder to create a DeleteTrainingQueriesOptions object that contains the parameter values for the deleteTrainingQueries method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The deleteTrainingQueries options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/training_data/queries?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        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 a training query

        Add a query to the training data for this project. The query can contain a filter and natural language query.

        Note: You cannot apply relevancy training to a content_mining project type.

        Add a query to the training data for this project. The query can contain a filter and natural language query.

        Note: You cannot apply relevancy training to a content_mining project type.

        Add a query to the training data for this project. The query can contain a filter and natural language query.

        Note: You cannot apply relevancy training to a content_mining project type.

        Add a query to the training data for this project. The query can contain a filter and natural language query.

        Note: You cannot apply relevancy training to a content_mining project type.

        Add a query to the training data for this project. The query can contain a filter and natural language query.

        Note: You cannot apply relevancy training to a content_mining project type.

        POST /v2/projects/{project_id}/training_data/queries
        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
        CreateTrainingQuery(string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)

        Request

        Use the CreateTrainingQueryOptions.Builder to create a CreateTrainingQueryOptions object that contains the parameter values for the createTrainingQuery method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        An object that represents the query to be submitted. At least 50 queries are required for training to begin. A maximum of 10,000 queries are allowed.

        The createTrainingQuery options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        • curl -X POST {auth} --data "{   \"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\"   }] }" "{url}/v2/projects/{project_id}/training_data/queries?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          TrainingExample trainingExample = new TrainingExample()
          {
              CollectionId = "{collection_id}",
              DocumentId = "{document_id}"
          };
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains 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 /v2/projects/{project_id}/training_data/queries/{query_id}
        ServiceCall<TrainingQuery> getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions)
        getTrainingQuery(params)
        get_training_query(
                self,
                project_id: str,
                query_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetTrainingQuery(string projectId, string queryId)

        Request

        Use the GetTrainingQueryOptions.Builder to create a GetTrainingQueryOptions object that contains the parameter values for the getTrainingQuery method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the query used for training.

          Possible values: 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 2023-03-31.

        The getTrainingQuery options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        • curl {auth} "{url}/v2/projects/{project_id}/training_data/queries/{query_id}?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains 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 its examples. You must resubmit all of the examples with the update request.

        Updates an existing training query and its examples. You must resubmit all of the examples with the update request.

        Updates an existing training query and its examples. You must resubmit all of the examples with the update request.

        Updates an existing training query and its examples. You must resubmit all of the examples with the update request.

        Updates an existing training query and its examples. You must resubmit all of the examples with the update request.

        POST /v2/projects/{project_id}/training_data/queries/{query_id}
        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
        UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)

        Request

        Use the UpdateTrainingQueryOptions.Builder to create a UpdateTrainingQueryOptions object that contains the parameter values for the updateTrainingQuery method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the query used for training.

          Possible values: 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 2023-03-31.

        The body of the example that is to be added to the specified query.

        The updateTrainingQuery options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        • The natural text query that is used as the training query.

        • Array of training examples.

        • The filter used on the collection before the natural_language_query is applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries that are submitted at runtime for optimal ranking results.

        • curl -X POST {auth} --data "{   \"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\"   }] }" "{url}/v2/projects/{project_id}/training_data/queries/{query_id}?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", 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
              );
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            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))
          

        Response

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains training query details.

        Object that contains 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.

        To delete an example, use the Update a training query method and omit the example that you want to delete from the example set.

        Removes details from a training data query, including the query string and all examples.

        To delete an example, use the Update a training query method and omit the example that you want to delete from the example set.

        Removes details from a training data query, including the query string and all examples.

        To delete an example, use the Update a training query method and omit the example that you want to delete from the example set.

        Removes details from a training data query, including the query string and all examples.

        To delete an example, use the Update a training query method and omit the example that you want to delete from the example set.

        Removes details from a training data query, including the query string and all examples.

        To delete an example, use the Update a training query method and omit the example that you want to delete from the example set.

        DELETE /v2/projects/{project_id}/training_data/queries/{query_id}
        ServiceCall<Void> deleteTrainingQuery(DeleteTrainingQueryOptions deleteTrainingQueryOptions)
        deleteTrainingQuery(params)
        delete_training_query(
                self,
                project_id: str,
                query_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteTrainingQuery(string projectId, string queryId)

        Request

        Use the DeleteTrainingQueryOptions.Builder to create a DeleteTrainingQueryOptions object that contains the parameter values for the deleteTrainingQuery method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the query used for training.

          Possible values: 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 2023-03-31.

        The deleteTrainingQuery options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the query used for training.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/training_data/queries/{query_id}?version=2023-03-31"
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
              url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
              username: "{username}",
              password: "{password}"
              );
          
          DiscoveryService service = new DiscoveryService("2020-08-30", authenticator);
          service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");
          
          var result = service.DeleteTrainingQuery(
              projectId: "{project_id}",
              queryId: "{query_id}"
              );
          
          Console.WriteLine(result.Response);
        • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
          Discovery discovery = new Discovery("2020-08-30", authenticator);
          discovery.setServiceUrl("https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api");
          
          DeleteTrainingQueryOptions deleteTrainingQueryOptions = new DeleteTrainingQueryOptions.Builder()
            .projectId("{project_id}")
            .queryId("{query_id}")
            .build();
          
          discovery.deleteTrainingQuery(deleteTrainingQueryOptions).execute().getResult();
        • 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}/icp4d-api/v1/authorize',
              username: '{username}',
              password: '{password}',
            }),
            version: '2020-08-30',
            serviceUrl: 'https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api',
          });
          
          const params = {
            projectId: '{projectId}',
            queryId: '{queryId}',
          };
          
          discovery.deleteTrainingQuery(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}/icp4d-api/v1/authorize',
                                         disable_ssl_verification=True)
          discovery = DiscoveryV2(
            version='2020-08-30',
            authenticator=authenticator
          )
          discovery.set_service_url('{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}')
          
          response = discovery.delete_training_query(
            project_id='{project_id}',
            query_id='{query_id}'
          ).get_result()
          print(json.dumps(response, indent=2))
          

        Response

        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 enrichments

        Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

        Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

        Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

        Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

        Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

        GET /v2/projects/{project_id}/enrichments
        ServiceCall<Enrichments> listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions)
        listEnrichments(params)
        list_enrichments(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListEnrichments(string projectId)

        Request

        Use the ListEnrichmentsOptions.Builder to create a ListEnrichmentsOptions object that contains the parameter values for the listEnrichments method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The listEnrichments options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}/enrichments?version=2023-03-31"

        Response

        An object that contains an array of enrichment definitions.

        An object that contains an array of enrichment definitions.

        An object that contains an array of enrichment definitions.

        An object that contains an array of enrichment definitions.

        An object that contains an array of enrichment definitions.

        Status Code

        • Returns an array of available enrichments.

        • Bad request.

        • Project not found

        Example responses
        • {
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000016",
                "name": "Sentiment of Document",
                "type": "natural_language_understanding",
                "description": "Predict document-level sentiment"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000018",
                "name": "Keywords",
                "type": "natural_language_understanding",
                "description": "Extract keywords from each document"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000012",
                "name": "Table Understanding",
                "type": "rule_based",
                "description": "Understand tabular data in HTML via understanding of each table's column headers, row headers, body cells, as well as relevant context and title"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "name": "Entities v2",
                "type": "natural_language_understanding",
                "description": "Extract named entities from each document with v2 type system"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000004",
                "name": "Sentiment of Phrases",
                "type": "sentiment",
                "description": "Extract phrases and expressions which convey sentiment."
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000017",
                "name": "Entities v1 legacy",
                "type": "natural_language_understanding",
                "description": "Extract named entities from each document with v1 type system"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "name": "Part of Speech",
                "type": "part_of_speech",
                "description": "Extract words and phrases from unstructured content and mark these extractions as annotations."
              },
              {
                "enrichment_id": "314567a0-2bf7-11ee-be56-0242ac120002",
                "name": "Sentence Classification",
                "type": "sentence_classifier",
                "description": "Classify sentences from each document"
              }
            ]
          }
        • {
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000016",
                "name": "Sentiment of Document",
                "type": "natural_language_understanding",
                "description": "Predict document-level sentiment"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000018",
                "name": "Keywords",
                "type": "natural_language_understanding",
                "description": "Extract keywords from each document"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000012",
                "name": "Table Understanding",
                "type": "rule_based",
                "description": "Understand tabular data in HTML via understanding of each table's column headers, row headers, body cells, as well as relevant context and title"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "name": "Entities v2",
                "type": "natural_language_understanding",
                "description": "Extract named entities from each document with v2 type system"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000004",
                "name": "Sentiment of Phrases",
                "type": "sentiment",
                "description": "Extract phrases and expressions which convey sentiment."
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000017",
                "name": "Entities v1 legacy",
                "type": "natural_language_understanding",
                "description": "Extract named entities from each document with v1 type system"
              },
              {
                "enrichment_id": "701db916-fc83-57ab-0000-000000000002",
                "name": "Part of Speech",
                "type": "part_of_speech",
                "description": "Extract words and phrases from unstructured content and mark these extractions as annotations."
              },
              {
                "enrichment_id": "314567a0-2bf7-11ee-be56-0242ac120002",
                "name": "Sentence Classification",
                "type": "sentence_classifier",
                "description": "Classify sentences from each document"
              }
            ]
          }

        Create an enrichment

        Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

        Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

        Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

        Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

        Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

        POST /v2/projects/{project_id}/enrichments
        ServiceCall<Enrichment> createEnrichment(CreateEnrichmentOptions createEnrichmentOptions)
        createEnrichment(params)
        create_enrichment(
                self,
                project_id: str,
                enrichment: 'CreateEnrichment',
                *,
                file: BinaryIO = None,
                **kwargs,
            ) -> DetailedResponse
        CreateEnrichment(string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file = null)

        Request

        Use the CreateEnrichmentOptions.Builder to create a CreateEnrichmentOptions object that contains the parameter values for the createEnrichment method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        Form Parameters

        • Information about a specific enrichment.

        • The enrichment file to upload. Expected file types per enrichment are as follows:

          • CSV for dictionary and sentence_classifier (the training data CSV file to upload).

          • PEAR for uima_annotator and rule_based (Explorer)

          • ZIP for watson_knowledge_studio_model and rule_based (Studio Advanced Rule Editor)

        The createEnrichment options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Information about a specific enrichment.

        • The enrichment file to upload. Expected file types per enrichment are as follows:

          • CSV for dictionary

          • PEAR for uima_annotator and rule_based (Explorer)

          • ZIP for watson_knowledge_studio_model and rule_based (Studio Advanced Rule Editor).

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Information about a specific enrichment.

        • The enrichment file to upload. Expected file types per enrichment are as follows:

          • CSV for dictionary

          • PEAR for uima_annotator and rule_based (Explorer)

          • ZIP for watson_knowledge_studio_model and rule_based (Studio Advanced Rule Editor).

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • Information about a specific enrichment.

        • The enrichment file to upload. Expected file types per enrichment are as follows:

          • CSV for dictionary

          • PEAR for uima_annotator and rule_based (Explorer)

          • ZIP for watson_knowledge_studio_model and rule_based (Studio Advanced Rule Editor).

        • curl -X POST {auth} --header "Content-Type: multipart/form-data" --form enrichment="{\"name\": \"Products\",   \"type\": \"dictionary\",   \"description\": \"Products dictionary\",   \"options\": {\"languages\": [\"en\"], \"entity_type\": \"products\"}}" --form file=@product_list.csv "{url}/v2/projects/{project_id}/enrichments?version=2023-03-31"

        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.

        Status Code

        • The enrichment has been successfully created

        • Bad request.

        Example responses
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }

        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 /v2/projects/{project_id}/enrichments/{enrichment_id}
        ServiceCall<Enrichment> getEnrichment(GetEnrichmentOptions getEnrichmentOptions)
        getEnrichment(params)
        get_enrichment(
                self,
                project_id: str,
                enrichment_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetEnrichment(string projectId, string enrichmentId)

        Request

        Use the GetEnrichmentOptions.Builder to create a GetEnrichmentOptions object that contains the parameter values for the getEnrichment method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the enrichment.

        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 2023-03-31.

        The getEnrichment options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        • curl {auth} "{url}/v2/projects/{project_id}/enrichments/{enrichment_id}?version=2023-03-31"

        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.

        Status Code

        • Returns information about the specified enrichment.

        • Enrichment or project not found.

        Example responses
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }

        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.

        POST /v2/projects/{project_id}/enrichments/{enrichment_id}
        ServiceCall<Enrichment> updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions)
        updateEnrichment(params)
        update_enrichment(
                self,
                project_id: str,
                enrichment_id: str,
                name: str,
                *,
                description: str = None,
                **kwargs,
            ) -> DetailedResponse
        UpdateEnrichment(string projectId, string enrichmentId, string name, string description = null)

        Request

        Use the UpdateEnrichmentOptions.Builder to create a UpdateEnrichmentOptions object that contains the parameter values for the updateEnrichment method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the enrichment.

        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 2023-03-31.

        An object that lists the new name and description for an enrichment.

        The updateEnrichment options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

          Possible values: 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

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        • A new name for the enrichment.

        • A new description for the enrichment.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"Products and Services\" }" "{url}/v2/projects/{project_id}/enrichments/{enrichment_id}?version=2023-03-31"

        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.

        Status Code

        • Returns the updated enrichment details.

        • Bad request.

        • Enrichment or project not found.

        Example responses
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products and Services",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }
        • {
            "enrichment_id": "5b36383b-fa57-0bfe-0000-017b77fba220",
            "name": "Products and Services",
            "type": "dictionary",
            "description": "Products dictionary",
            "options": {
              "languages": [
                "en"
              ],
              "entity_type": "products"
            }
          }

        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.

        DELETE /v2/projects/{project_id}/enrichments/{enrichment_id}
        ServiceCall<Void> deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions)
        deleteEnrichment(params)
        delete_enrichment(
                self,
                project_id: str,
                enrichment_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteEnrichment(string projectId, string enrichmentId)

        Request

        Use the DeleteEnrichmentOptions.Builder to create a DeleteEnrichmentOptions object that contains the parameter values for the deleteEnrichment method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the enrichment.

        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 2023-03-31.

        The deleteEnrichment options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the enrichment.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/enrichments/{enrichment_id}?version=2023-03-31"

        Response

        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.

        List batches

        A batch is a set of documents that are ready for enrichment by an external application. After you apply a webhook enrichment to a collection, and then process or upload documents to the collection, Discovery creates a batch with a unique batch_id.

        To start, you must register your external application as a webhook type by using the Create enrichment API method.

        Use the List batches API to get the following:

        • Notified batches that are not yet pulled by the external enrichment application.

        • Batches that are pulled, but not yet pushed to Discovery by the external enrichment application.

        GET /v2/projects/{project_id}/collections/{collection_id}/batches

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        • curl {auth} "{url}/v2/projects/{project_id}/collections/{collection_id}/batches?version=2023-03-31"

        Response

        An object that contains a list of batches that are ready for enrichment by the external application.

        Status Code

        • Returns an array of available batches that are ready to be pulled by the external enrichment application.

          The batches timeout automatically after around 72 hours from the time they were created.

        • Missing project or collection, or bad request.

        Example responses
        • {
            "batches": [
              {
                "batch_id": "e9e1316b-a8b7-48d6-b538-e608af616a12",
                "enrichment_id": "fd290d8b-53e2-dba1-0000-018a8d150b85",
                "created": "2023-09-21T06:38:21.260Z"
              },
              {
                "batch_id": "aaab573d-e48c-3445-7b9d-5f3f9a9970215",
                "enrichment_id": "fd290d8b-53e2-dba1-0000-018a8d150b85",
                "created": "2023-09-21T05:38:21.260Z"
              }
            ]
          }

        Pull batches

        Pull a batch of documents from Discovery for enrichment by an external application. Ensure to include the Accept-Encoding: gzip header in this method to get the file. You can also implement retry logic when calling this method to avoid any network errors.

        GET /v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        • The Universally Unique Identifier (UUID) of the document batch that is being requested from Discovery.

        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 2023-03-31.

        • curl {auth} --header "Accept-Encoding: gzip" "{url}/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}?version=2023-03-31"

        Response

        A compressed newline delimited JSON (NDJSON) file containing the document. The NDJSON format is used to describe structured data. The file name format is {batch_id}.ndjson.gz. For more information, see Binary attachment from the pull batches method.

        Status Code

        • Returns a compressed NDJSON file.

        • Not found. Returned when the project, collection, or batch is missing.

        Example responses
        • {
            "document_id": "3fb9f330-bd94-41a8-ac75-f732af13b5ac_1",
            "location_encoding": "utf-32",
            "language": "en",
            "artifact": "2016/1/2{\"parent_document_id\":\"3fb9f330-bd94-41a8-ac75-f732af13b5ac\"}1vanilla ice creamFemalecontamination_tamperingI got some ice cream for my children, but there was something like a piece of thread inside the cup.20QueensSilver Card MemberIce cream",
            "features": [
              {
                "type": "field",
                "location": {
                  "begin": 0,
                  "end": 8
                },
                "properties": {
                  "field_name": "date",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 8,
                  "end": 69
                },
                "properties": {
                  "field_name": "metadata",
                  "field_index": 0,
                  "field_type": "json"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 69,
                  "end": 70
                },
                "properties": {
                  "field_name": "claim_id",
                  "field_index": 0,
                  "field_type": "long"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 70,
                  "end": 87
                },
                "properties": {
                  "field_name": "claim_product",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 87,
                  "end": 93
                },
                "properties": {
                  "field_name": "client_sex",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 93,
                  "end": 116
                },
                "properties": {
                  "field_name": "label",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 116,
                  "end": 216
                },
                "properties": {
                  "field_name": "body",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 216,
                  "end": 218
                },
                "properties": {
                  "field_name": "client_age",
                  "field_index": 0,
                  "field_type": "long"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 218,
                  "end": 224
                },
                "properties": {
                  "field_name": "client_location",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 224,
                  "end": 242
                },
                "properties": {
                  "field_name": "client_segment",
                  "field_index": 0,
                  "field_type": "string"
                }
              },
              {
                "type": "field",
                "location": {
                  "begin": 242,
                  "end": 251
                },
                "properties": {
                  "field_name": "claim_product_line",
                  "field_index": 0,
                  "field_type": "string"
                }
              }
            ]
          }

        Push batches

        Push a batch of documents to Discovery after annotation by an external application. You can implement retry logic when calling this method to avoid any network errors.

        POST /v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        • The Universally Unique Identifier (UUID) of the document batch that is being requested from Discovery.

        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 2023-03-31.

        Form Parameters

        • A compressed newline-delimited JSON (NDJSON), which is a JSON file with one row of data per line. For example, {batch_id}.ndjson.gz. For more information, see Binary attachment in the push batches method.

          There is no limitation on the name of the file because Discovery does not use the name for processing. The list of features in the document is specified in the features object.

        • curl -X POST {auth} --form "file=@{filename}"  "{url}/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}?version=2023-03-31"

        Response

        Whether or not a batch push of documents is successful. Discovery does not check what is included in the .gz file, and returns a response as soon as it temporarily stores a .gz file.

        Documents included in a pushed .gz file are processed and annotations from the external enrichment are added to corresponding fields in the indexed documents of the collection.

        Any additional documents in the .gz file that were not in the batch (with the same batch_id) pulled from Discovery using the Pull batches method are ignored.

        Status Code

        • The batch has been accepted and is being processed.

        • Not found. Returned when the project, collection, or batch is missing. It is also returned when the batch is already processed or when a batch gets timed out.

        • The batch is already pushed and accepted. Returned between the time the batch is submitted and the time when Discovery is processing the submitted documents.

        Example responses
        • {
            "accepted": true
          }

        List document classifiers

        Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

        Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

        Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

        Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

        Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

        GET /v2/projects/{project_id}/document_classifiers
        ServiceCall<DocumentClassifiers> listDocumentClassifiers(ListDocumentClassifiersOptions listDocumentClassifiersOptions)
        listDocumentClassifiers(params)
        list_document_classifiers(
                self,
                project_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListDocumentClassifiers(string projectId)

        Request

        Use the ListDocumentClassifiersOptions.Builder to create a ListDocumentClassifiersOptions object that contains the parameter values for the listDocumentClassifiers method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        The listDocumentClassifiers options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • curl {auth} "{url}/v2/projects/{project_id}/document_classifiers?version=2023-03-31"

        Response

        An object that contains a list of document classifier definitions.

        An object that contains a list of document classifier definitions.

        An object that contains a list of document classifier definitions.

        An object that contains a list of document classifier definitions.

        An object that contains a list of document classifier definitions.

        Status Code

        • Returns a list of document classifiers.

        • Document project is not found.

        Example responses
        • {
            "classifiers": [
              {
                "name": "Customer comments classifier",
                "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587"
              },
              {
                "name": "Product feedback classification",
                "classifier_id": "357f301e-e918-0b73-0000-017e8983070c"
              }
            ]
          }
        • {
            "classifiers": [
              {
                "name": "Customer comments classifier",
                "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587"
              },
              {
                "name": "Product feedback classification",
                "classifier_id": "357f301e-e918-0b73-0000-017e8983070c"
              }
            ]
          }

        Create a document classifier

        Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

        Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

        Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

        Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

        Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

        Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        POST /v2/projects/{project_id}/document_classifiers
        ServiceCall<DocumentClassifier> createDocumentClassifier(CreateDocumentClassifierOptions createDocumentClassifierOptions)
        createDocumentClassifier(params)
        create_document_classifier(
                self,
                project_id: str,
                training_data: BinaryIO,
                classifier: 'CreateDocumentClassifier',
                *,
                test_data: BinaryIO = None,
                **kwargs,
            ) -> DetailedResponse
        CreateDocumentClassifier(string projectId, System.IO.MemoryStream trainingData, CreateDocumentClassifier classifier, System.IO.MemoryStream testData = null)

        Request

        Use the CreateDocumentClassifierOptions.Builder to create a CreateDocumentClassifierOptions object that contains the parameter values for the createDocumentClassifier method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        Form Parameters

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation.

        • An object that manages the settings and data that is required to train a document classification model.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        The createDocumentClassifier options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation.

        • An object that manages the settings and data that is required to train a document classification model.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation.

        • An object that manages the settings and data that is required to train a document classification model.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation.

        • An object that manages the settings and data that is required to train a document classification model.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        • curl -X POST {auth} --header "Content-Type: multipart/form-data" --form classifier="{\"name\": \"Customer comments classifier\",   \"description\": \"User reviews\",   \"language\": \"en\",   \"answer_field\": \"label\",   \"enrichments\": [     {\"enrichment_id\":\"701db916-fc83-57ab-0000-00000000001e\",     \"fields\": [       \"text\", \"body\"]     }   ],   \"federated_classification\": {     \"field\": \"claim_product_line\"   } }" --form "training_data=@training.csv;type=text/csv" --form "test_data=@test.csv;type=text/csv" "{url}/v2/projects/{project_id}/document_classifiers?version=2023-03-31"

        Response

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Status Code

        • Returns the document classifier details.

        • Bad request. A required parameter is null or invalid. Specific failure messages include:

          • No request body (missing classifier configuration).
          • Missing required request parameter or its value.
          • Unsupported language is requested.
          • Provided training_data or test_data does not have field requested in answer_field.
          • Requested enrichment does not exist.
          • Provided training_data or test_data does not have the fields requested in enrichments.fields.
          • Provided training_data or test_data does not have the field requested in federated_classification.field.
        • Missing project.

        Example responses
        • {
            "name": "Customer comments classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }
        • {
            "name": "Customer comments classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }

        Get a document classifier

        Get details about a specific document classifier.

        Get details about a specific document classifier.

        Get details about a specific document classifier.

        Get details about a specific document classifier.

        Get details about a specific document classifier.

        GET /v2/projects/{project_id}/document_classifiers/{classifier_id}
        ServiceCall<DocumentClassifier> getDocumentClassifier(GetDocumentClassifierOptions getDocumentClassifierOptions)
        getDocumentClassifier(params)
        get_document_classifier(
                self,
                project_id: str,
                classifier_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetDocumentClassifier(string projectId, string classifierId)

        Request

        Use the GetDocumentClassifierOptions.Builder to create a GetDocumentClassifierOptions object that contains the parameter values for the getDocumentClassifier method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        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 2023-03-31.

        The getDocumentClassifier options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • curl {auth} "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}?version=2023-03-31"

        Response

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Status Code

        • Returns details about a specific document classifier.

        • Document classifier or project not found.

        Example responses
        • {
            "name": "Customer comments classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }
        • {
            "name": "Customer comments classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }

        Update a document classifier

        Update the document classifier name or description, update the training data, or add or update the test data.

        Update the document classifier name or description, update the training data, or add or update the test data.

        Update the document classifier name or description, update the training data, or add or update the test data.

        Update the document classifier name or description, update the training data, or add or update the test data.

        Update the document classifier name or description, update the training data, or add or update the test data.

        POST /v2/projects/{project_id}/document_classifiers/{classifier_id}
        ServiceCall<DocumentClassifier> updateDocumentClassifier(UpdateDocumentClassifierOptions updateDocumentClassifierOptions)
        updateDocumentClassifier(params)
        update_document_classifier(
                self,
                project_id: str,
                classifier_id: str,
                classifier: 'UpdateDocumentClassifier',
                *,
                training_data: BinaryIO = None,
                test_data: BinaryIO = None,
                **kwargs,
            ) -> DetailedResponse
        UpdateDocumentClassifier(string projectId, string classifierId, UpdateDocumentClassifier classifier, System.IO.MemoryStream trainingData = null, System.IO.MemoryStream testData = null)

        Request

        Use the UpdateDocumentClassifierOptions.Builder to create a UpdateDocumentClassifierOptions object that contains the parameter values for the updateDocumentClassifier method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        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 2023-03-31.

        Form Parameters

        • An object that contains a new name or description for a document classifier, updated training data, or new or updated test data.

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        The updateDocumentClassifier options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • An object that contains a new name or description for a document classifier, updated training data, or new or updated test data.

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • An object that contains a new name or description for a document classifier, updated training data, or new or updated test data.

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • An object that contains a new name or description for a document classifier, updated training data, or new or updated test data.

        • The training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation.

        • The CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data.

        • curl -X POST {auth} --header "Content-Type: multipart/form-data" --form classifier="{   \"name\": \"Customer feedback classifier\",   \"description\": \"User reviews and feedback\"   }" --form "training_data=@training.csv;type=text/csv" --form "test_data=@test.csv;type=text/csv" "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}?version=2023-03-31"

        Response

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Information about a document classifier.

        Status Code

        • Returns the updated document classifier details.

        • Bad request. A required parameter is null or invalid. Specific failure messages include:

          • No request body (missing classifier configuration).
          • Provided training_data or test_data does not have field requested in answer_field.
          • Provided training_data or test_data does not have the fields requested in enrichments.fields.
          • Provided training_data or test_data does not have the field requested in federated_classification.field.
        • Missing project or classifier.

        Example responses
        • {
            "name": "Customer feedback classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews and feedback",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }
        • {
            "name": "Customer feedback classifier",
            "classifier_id": "0e36fdd2-7fb0-812b-0000-017ed29d6587",
            "description": "User reviews and feedback",
            "created": "2022-03-09T17:51:51.592Z",
            "language": "en",
            "enrichments": [
              {
                "enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
                "fields": [
                  "text",
                  "body"
                ]
              }
            ],
            "answer_field": "label",
            "recognized_fields": [
              "text",
              "body",
              "date",
              "client_age",
              "client_location",
              "label",
              "type_column",
              "client_segment",
              "claim_id",
              "claim_product",
              "claim_product_line"
            ],
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "federated_classification": {
              "field": "claim_product_line"
            }
          }

        Delete a document classifier

        Deletes an existing document classifier from the specified project.

        Deletes an existing document classifier from the specified project.

        Deletes an existing document classifier from the specified project.

        Deletes an existing document classifier from the specified project.

        Deletes an existing document classifier from the specified project.

        DELETE /v2/projects/{project_id}/document_classifiers/{classifier_id}
        ServiceCall<Void> deleteDocumentClassifier(DeleteDocumentClassifierOptions deleteDocumentClassifierOptions)
        deleteDocumentClassifier(params)
        delete_document_classifier(
                self,
                project_id: str,
                classifier_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteDocumentClassifier(string projectId, string classifierId)

        Request

        Use the DeleteDocumentClassifierOptions.Builder to create a DeleteDocumentClassifierOptions object that contains the parameter values for the deleteDocumentClassifier method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        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 2023-03-31.

        The deleteDocumentClassifier options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}?version=2023-03-31"

        Response

        Response type: object

        Status Code

        • The document classifier was deleted successfully.

        • The document classifier cannot be deleted because the resulting classifier enrichment is applied to a collection. You must remove the enrichment from any collections that are using it before you attempt to delete the document classifier.

        • Missing project or classifier.

        No Sample Response

        This method does not specify any sample responses.

        List document classifier models

        Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

        Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

        Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

        Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

        Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

        GET /v2/projects/{project_id}/document_classifiers/{classifier_id}/models
        ServiceCall<DocumentClassifierModels> listDocumentClassifierModels(ListDocumentClassifierModelsOptions listDocumentClassifierModelsOptions)
        listDocumentClassifierModels(params)
        list_document_classifier_models(
                self,
                project_id: str,
                classifier_id: str,
                **kwargs,
            ) -> DetailedResponse
        ListDocumentClassifierModels(string projectId, string classifierId)

        Request

        Use the ListDocumentClassifierModelsOptions.Builder to create a ListDocumentClassifierModelsOptions object that contains the parameter values for the listDocumentClassifierModels method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        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 2023-03-31.

        The listDocumentClassifierModels options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • curl {auth} "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}/models?version=2023-03-31"

        Response

        An object that contains a list of document classifier model definitions.

        An object that contains a list of document classifier model definitions.

        An object that contains a list of document classifier model definitions.

        An object that contains a list of document classifier model definitions.

        An object that contains a list of document classifier model definitions.

        Status Code

        • Returns a list of document classifier models.

        • Document classifier or project not found.

        Example responses
        • {
            "models": [
              {
                "name": "Model 1.0",
                "model_id": "031f168e-0716-f6fe-0000-017f84d080e1"
              }
            ]
          }
        • {
            "models": [
              {
                "name": "Model 1.0",
                "model_id": "031f168e-0716-f6fe-0000-017f84d080e1"
              }
            ]
          }

        Create a document classifier model

        Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

        Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

        Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

        Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

        Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

        Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

        POST /v2/projects/{project_id}/document_classifiers/{classifier_id}/models
        ServiceCall<DocumentClassifierModel> createDocumentClassifierModel(CreateDocumentClassifierModelOptions createDocumentClassifierModelOptions)
        createDocumentClassifierModel(params)
        create_document_classifier_model(
                self,
                project_id: str,
                classifier_id: str,
                name: str,
                *,
                description: str = None,
                learning_rate: float = None,
                l1_regularization_strengths: List[float] = None,
                l2_regularization_strengths: List[float] = None,
                training_max_steps: int = None,
                improvement_ratio: float = None,
                **kwargs,
            ) -> DetailedResponse
        CreateDocumentClassifierModel(string projectId, string classifierId, string name, string description = null, double? learningRate = null, List<double?> l1RegularizationStrengths = null, List<double?> l2RegularizationStrengths = null, long? trainingMaxSteps = null, double? improvementRatio = null)

        Request

        Use the CreateDocumentClassifierModelOptions.Builder to create a CreateDocumentClassifierModelOptions object that contains the parameter values for the createDocumentClassifierModel method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        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 2023-03-31.

        An object that contains the training configuration information for the document classifier to be trained.

        The createDocumentClassifierModel options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The name of the document classifier model.

          Possible values: 0 ≤ length ≤ 255

        • A description of the document classifier model.

        • A tuning parameter in an optimization algorithm that determines the step size at each iteration of the training process. It influences how much of any newly acquired information overrides the existing information, and therefore is said to represent the speed at which a machine learning model learns. The default value is 0.1.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.1

        • Avoids overfitting by shrinking the coefficient of less important features to zero, which removes some features altogether. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • A method you can apply to avoid overfitting your model on the training data. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • Maximum number of training steps to complete. This setting is useful if you need the training process to finish in a specific time frame to fit into an automated process. The default value is ten million.

          Possible values: value ≥ 0

          Default: 10000000

        • Stops the training run early if the improvement ratio is not met by the time the process reaches a certain point. The default value is 0.00001.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.000010

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The name of the document classifier model.

          Possible values: 0 ≤ length ≤ 255

        • A description of the document classifier model.

        • A tuning parameter in an optimization algorithm that determines the step size at each iteration of the training process. It influences how much of any newly acquired information overrides the existing information, and therefore is said to represent the speed at which a machine learning model learns. The default value is 0.1.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.1

        • Avoids overfitting by shrinking the coefficient of less important features to zero, which removes some features altogether. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • A method you can apply to avoid overfitting your model on the training data. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • Maximum number of training steps to complete. This setting is useful if you need the training process to finish in a specific time frame to fit into an automated process. The default value is ten million.

          Possible values: value ≥ 0

          Default: 10000000

        • Stops the training run early if the improvement ratio is not met by the time the process reaches a certain point. The default value is 0.00001.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.000010

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The name of the document classifier model.

          Possible values: 0 ≤ length ≤ 255

        • A description of the document classifier model.

        • A tuning parameter in an optimization algorithm that determines the step size at each iteration of the training process. It influences how much of any newly acquired information overrides the existing information, and therefore is said to represent the speed at which a machine learning model learns. The default value is 0.1.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.1

        • Avoids overfitting by shrinking the coefficient of less important features to zero, which removes some features altogether. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • A method you can apply to avoid overfitting your model on the training data. You can specify many values for hyper-parameter optimization. The default value is [0.000001].

          Possible values: value ≥ 0

          Default: [1.0E-6]

        • Maximum number of training steps to complete. This setting is useful if you need the training process to finish in a specific time frame to fit into an automated process. The default value is ten million.

          Possible values: value ≥ 0

          Default: 10000000

        • Stops the training run early if the improvement ratio is not met by the time the process reaches a certain point. The default value is 0.00001.

          Possible values: 0 ≤ value ≤ 1

          Default: 0.000010

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"Model 1.0\",    \"description\": \"First model\",   \"learning_rate\": 0.1,   \"l1_regularization_strengths\": [   0.000001   ],   \"l2_regularization_strengths\": [   0.000001   ],   \"training_max_steps\": 10000000,   \"improvement_ratio\": 0.00001 }" "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}/models?version=2023-03-31"

        Response

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Status Code

        • Returns the document classifier details.

        • Bad request. A required parameter is null or invalid. Specific failure messages include:

          • No request body (discovery_missing_model_config).
          • Missing required request parameter or its value (classifier_missing_field_name).
        • Missing project or classifier.

        Example responses
        • {
            "name": "Model 1.0",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "First model",
            "created": "2022-01-27T20:01:25.952Z",
            "updated": "2022-01-27T20:01:26.094Z",
            "status": "training"
          }
        • {
            "name": "Model 1.0",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "First model",
            "created": "2022-01-27T20:01:25.952Z",
            "updated": "2022-01-27T20:01:26.094Z",
            "status": "training"
          }

        Get a document classifier model

        Get details about a specific document classifier model.

        Get details about a specific document classifier model.

        Get details about a specific document classifier model.

        Get details about a specific document classifier model.

        Get details about a specific document classifier model.

        GET /v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}
        ServiceCall<DocumentClassifierModel> getDocumentClassifierModel(GetDocumentClassifierModelOptions getDocumentClassifierModelOptions)
        getDocumentClassifierModel(params)
        get_document_classifier_model(
                self,
                project_id: str,
                classifier_id: str,
                model_id: str,
                **kwargs,
            ) -> DetailedResponse
        GetDocumentClassifierModel(string projectId, string classifierId, string modelId)

        Request

        Use the GetDocumentClassifierModelOptions.Builder to create a GetDocumentClassifierModelOptions object that contains the parameter values for the getDocumentClassifierModel method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        • The Universally Unique Identifier (UUID) of the classifier model.

        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 2023-03-31.

        The getDocumentClassifierModel options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        • curl {auth} "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}?version=2023-03-31"

        Response

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Status Code

        • Returns details about a specific document classifier model.

        • Project or document classifier or document classifier model not found.

        Example responses
        • {
            "name": "Model 1.0",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "First model",
            "created": "2022-03-14T14:37:33.553Z",
            "updated": "2022-03-14T14:40:41.634Z",
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "status": "available",
            "evaluation": {
              "micro_average": {
                "precision": 0.3484848439693451,
                "recall": 0.7666666507720947,
                "f1": 0.4791666567325592
              },
              "macro_average": {
                "precision": 0.3279411792755127,
                "recall": 0.5714285969734192,
                "f1": 0.3811137080192566
              },
              "per_class": [
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "expiration_date"
                },
                {
                  "precision": 0.25,
                  "recall": 0.5,
                  "f1": 0.3333333432674408,
                  "name": "ingredient.allergy"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "amount.shortage"
                },
                {
                  "precision": 0.3529411852359772,
                  "recall": 1,
                  "f1": 0.52173912525177,
                  "name": "package_container"
                },
                {
                  "precision": 1,
                  "recall": 0.5,
                  "f1": 0.6666666865348816,
                  "name": "prank"
                },
                {
                  "precision": 0.4000000059604645,
                  "recall": 1,
                  "f1": 0.5714285969734192,
                  "name": "package_container.leak"
                },
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "change_of_properties"
                },
                {
                  "precision": 0,
                  "recall": 0,
                  "f1": 0,
                  "name": "contamination_tampering"
                },
                {
                  "precision": 1,
                  "recall": 1,
                  "f1": 1,
                  "name": "package_container.dirt"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "other"
                }
              ]
            },
            "enrichment_id": "b9a35e7b-5073-1d0b-0000-017f89122c9d",
            "deployed_at": "2022-03-14T14:40:40.572Z"
          }
        • {
            "name": "Model 1.0",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "First model",
            "created": "2022-03-14T14:37:33.553Z",
            "updated": "2022-03-14T14:40:41.634Z",
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "status": "available",
            "evaluation": {
              "micro_average": {
                "precision": 0.3484848439693451,
                "recall": 0.7666666507720947,
                "f1": 0.4791666567325592
              },
              "macro_average": {
                "precision": 0.3279411792755127,
                "recall": 0.5714285969734192,
                "f1": 0.3811137080192566
              },
              "per_class": [
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "expiration_date"
                },
                {
                  "precision": 0.25,
                  "recall": 0.5,
                  "f1": 0.3333333432674408,
                  "name": "ingredient.allergy"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "amount.shortage"
                },
                {
                  "precision": 0.3529411852359772,
                  "recall": 1,
                  "f1": 0.52173912525177,
                  "name": "package_container"
                },
                {
                  "precision": 1,
                  "recall": 0.5,
                  "f1": 0.6666666865348816,
                  "name": "prank"
                },
                {
                  "precision": 0.4000000059604645,
                  "recall": 1,
                  "f1": 0.5714285969734192,
                  "name": "package_container.leak"
                },
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "change_of_properties"
                },
                {
                  "precision": 0,
                  "recall": 0,
                  "f1": 0,
                  "name": "contamination_tampering"
                },
                {
                  "precision": 1,
                  "recall": 1,
                  "f1": 1,
                  "name": "package_container.dirt"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "other"
                }
              ]
            },
            "enrichment_id": "b9a35e7b-5073-1d0b-0000-017f89122c9d",
            "deployed_at": "2022-03-14T14:40:40.572Z"
          }

        Update a document classifier model

        Update the document classifier model name or description.

        Update the document classifier model name or description.

        Update the document classifier model name or description.

        Update the document classifier model name or description.

        Update the document classifier model name or description.

        POST /v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}
        ServiceCall<DocumentClassifierModel> updateDocumentClassifierModel(UpdateDocumentClassifierModelOptions updateDocumentClassifierModelOptions)
        updateDocumentClassifierModel(params)
        update_document_classifier_model(
                self,
                project_id: str,
                classifier_id: str,
                model_id: str,
                *,
                name: str = None,
                description: str = None,
                **kwargs,
            ) -> DetailedResponse
        UpdateDocumentClassifierModel(string projectId, string classifierId, string modelId, string name = null, string description = null)

        Request

        Use the UpdateDocumentClassifierModelOptions.Builder to create a UpdateDocumentClassifierModelOptions object that contains the parameter values for the updateDocumentClassifierModel method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        • The Universally Unique Identifier (UUID) of the classifier model.

        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 2023-03-31.

        An object that lists a new name or description for a document classifier model.

        The updateDocumentClassifierModel options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        • A new name for the enrichment.

          Possible values: length ≤ 255

        • A new description for the enrichment.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        • A new name for the enrichment.

          Possible values: length ≤ 255

        • A new description for the enrichment.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        • A new name for the enrichment.

          Possible values: length ≤ 255

        • A new description for the enrichment.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"name\": \"Renamed model\",    \"description\": \"Updated model\" }" "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}?version=2023-03-31"

        Response

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Information about a document classifier model.

        Status Code

        • Returns the updated document classifier model details.

        • No request body.

        • Project or document classifier or document classifier model not found.

        Example responses
        • {
            "name": "Renamed model",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "Updated model",
            "created": "2022-03-14T14:37:33.553Z",
            "updated": "2022-03-14T20:59:58.685Z",
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "status": "available",
            "evaluation": {
              "micro_average": {
                "precision": 0.3484848439693451,
                "recall": 0.7666666507720947,
                "f1": 0.4791666567325592
              },
              "macro_average": {
                "precision": 0.3279411792755127,
                "recall": 0.5714285969734192,
                "f1": 0.3811137080192566
              },
              "per_class": [
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "expiration_date"
                },
                {
                  "precision": 0.25,
                  "recall": 0.5,
                  "f1": 0.3333333432674408,
                  "name": "ingredient.allergy"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "amount.shortage"
                },
                {
                  "precision": 0.3529411852359772,
                  "recall": 1,
                  "f1": 0.52173912525177,
                  "name": "package_container"
                },
                {
                  "precision": 1,
                  "recall": 0.5,
                  "f1": 0.6666666865348816,
                  "name": "prank"
                },
                {
                  "precision": 0.4000000059604645,
                  "recall": 1,
                  "f1": 0.5714285969734192,
                  "name": "package_container.leak"
                },
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "change_of_properties"
                },
                {
                  "precision": 0,
                  "recall": 0,
                  "f1": 0,
                  "name": "contamination_tampering"
                },
                {
                  "precision": 1,
                  "recall": 1,
                  "f1": 1,
                  "name": "package_container.dirt"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "other"
                }
              ]
            },
            "enrichment_id": "b9a35e7b-5073-1d0b-0000-017f89122c9d",
            "deployed_at": "2022-03-14T14:40:40.572Z"
          }
        • {
            "name": "Renamed model",
            "model_id": "47477591-b520-6039-0000-017e9d20e634",
            "description": "Updated model",
            "created": "2022-03-14T14:37:33.553Z",
            "updated": "2022-03-14T20:59:58.685Z",
            "training_data_file": "training.csv",
            "test_data_file": "test.csv",
            "status": "available",
            "evaluation": {
              "micro_average": {
                "precision": 0.3484848439693451,
                "recall": 0.7666666507720947,
                "f1": 0.4791666567325592
              },
              "macro_average": {
                "precision": 0.3279411792755127,
                "recall": 0.5714285969734192,
                "f1": 0.3811137080192566
              },
              "per_class": [
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "expiration_date"
                },
                {
                  "precision": 0.25,
                  "recall": 0.5,
                  "f1": 0.3333333432674408,
                  "name": "ingredient.allergy"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "amount.shortage"
                },
                {
                  "precision": 0.3529411852359772,
                  "recall": 1,
                  "f1": 0.52173912525177,
                  "name": "package_container"
                },
                {
                  "precision": 1,
                  "recall": 0.5,
                  "f1": 0.6666666865348816,
                  "name": "prank"
                },
                {
                  "precision": 0.4000000059604645,
                  "recall": 1,
                  "f1": 0.5714285969734192,
                  "name": "package_container.leak"
                },
                {
                  "precision": 0.5,
                  "recall": 1,
                  "f1": 0.6666666865348816,
                  "name": "change_of_properties"
                },
                {
                  "precision": 0,
                  "recall": 0,
                  "f1": 0,
                  "name": "contamination_tampering"
                },
                {
                  "precision": 1,
                  "recall": 1,
                  "f1": 1,
                  "name": "package_container.dirt"
                },
                {
                  "precision": 0.29411765933036804,
                  "recall": 1,
                  "f1": 0.4545454680919647,
                  "name": "other"
                }
              ]
            },
            "enrichment_id": "b9a35e7b-5073-1d0b-0000-017f89122c9d",
            "deployed_at": "2022-03-14T14:40:40.572Z"
          }

        Delete a document classifier model

        Deletes an existing document classifier model from the specified project.

        Deletes an existing document classifier model from the specified project.

        Deletes an existing document classifier model from the specified project.

        Deletes an existing document classifier model from the specified project.

        Deletes an existing document classifier model from the specified project.

        DELETE /v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}
        ServiceCall<Void> deleteDocumentClassifierModel(DeleteDocumentClassifierModelOptions deleteDocumentClassifierModelOptions)
        deleteDocumentClassifierModel(params)
        delete_document_classifier_model(
                self,
                project_id: str,
                classifier_id: str,
                model_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteDocumentClassifierModel(string projectId, string classifierId, string modelId)

        Request

        Use the DeleteDocumentClassifierModelOptions.Builder to create a DeleteDocumentClassifierModelOptions object that contains the parameter values for the deleteDocumentClassifierModel method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the classifier.

        • The Universally Unique Identifier (UUID) of the classifier model.

        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 2023-03-31.

        The deleteDocumentClassifierModel options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the classifier.

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

        • The ID of the classifier model.

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

        • curl -X DELETE {auth} "{url}/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}?version=2023-03-31"

        Response

        Response type: object

        Status Code

        • The document classifier model was deleted successfully.

        • The document classifier model cannot be deleted because the resulting classifier enrichment is applied to a collection. You must remove the enrichment from any collections that are using it before you attempt to delete the model.

        • Project or document classifier or document classifier model not found.

        No Sample Response

        This method does not specify any sample responses.

        Analyze a document

        Process a document and return it for realtime use. Supports JSON files only.

        The file is not stored in the collection, but is processed according to the collection's configuration settings. To get results, enrichments must be applied to a field in the collection that also exists in the file that you want to analyze. For example, to analyze text in a Quote field, you must apply enrichments to the Quote field in the collection configuration. Then, when you analyze the file, the text in the Quote field is analyzed and results are written to a field named enriched_Quote.

        Submit a request against only one collection at a time. Remember, the documents in the collection are not significant. It is the enrichments that are defined for the collection that matter. If you submit requests to several collections, then several models are initiated at the same time, which can cause request failures.

        Note: This method is supported with Enterprise plan deployments and installed deployments only.

        Process a document and return it for realtime use. Supports JSON files only.

        The file is not stored in the collection, but is processed according to the collection's configuration settings. To get results, enrichments must be applied to a field in the collection that also exists in the file that you want to analyze. For example, to analyze text in a Quote field, you must apply enrichments to the Quote field in the collection configuration. Then, when you analyze the file, the text in the Quote field is analyzed and results are written to a field named enriched_Quote.

        Submit a request against only one collection at a time. Remember, the documents in the collection are not significant. It is the enrichments that are defined for the collection that matter. If you submit requests to several collections, then several models are initiated at the same time, which can cause request failures.

        Note: This method is supported with Enterprise plan deployments and installed deployments only.

        Process a document and return it for realtime use. Supports JSON files only.

        The file is not stored in the collection, but is processed according to the collection's configuration settings. To get results, enrichments must be applied to a field in the collection that also exists in the file that you want to analyze. For example, to analyze text in a Quote field, you must apply enrichments to the Quote field in the collection configuration. Then, when you analyze the file, the text in the Quote field is analyzed and results are written to a field named enriched_Quote.

        Submit a request against only one collection at a time. Remember, the documents in the collection are not significant. It is the enrichments that are defined for the collection that matter. If you submit requests to several collections, then several models are initiated at the same time, which can cause request failures.

        Note: This method is supported with Enterprise plan deployments and installed deployments only.

        Process a document and return it for realtime use. Supports JSON files only.

        The file is not stored in the collection, but is processed according to the collection's configuration settings. To get results, enrichments must be applied to a field in the collection that also exists in the file that you want to analyze. For example, to analyze text in a Quote field, you must apply enrichments to the Quote field in the collection configuration. Then, when you analyze the file, the text in the Quote field is analyzed and results are written to a field named enriched_Quote.

        Submit a request against only one collection at a time. Remember, the documents in the collection are not significant. It is the enrichments that are defined for the collection that matter. If you submit requests to several collections, then several models are initiated at the same time, which can cause request failures.

        Note: This method is supported with Enterprise plan deployments and installed deployments only.

        Process a document and return it for realtime use. Supports JSON files only.

        The file is not stored in the collection, but is processed according to the collection's configuration settings. To get results, enrichments must be applied to a field in the collection that also exists in the file that you want to analyze. For example, to analyze text in a Quote field, you must apply enrichments to the Quote field in the collection configuration. Then, when you analyze the file, the text in the Quote field is analyzed and results are written to a field named enriched_Quote.

        Submit a request against only one collection at a time. Remember, the documents in the collection are not significant. It is the enrichments that are defined for the collection that matter. If you submit requests to several collections, then several models are initiated at the same time, which can cause request failures.

        Note: This method is supported with Enterprise plan deployments and installed deployments only.

        POST /v2/projects/{project_id}/collections/{collection_id}/analyze
        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
        AnalyzeDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null)

        Request

        Use the AnalyzeDocumentOptions.Builder to create a AnalyzeDocumentOptions object that contains the parameter values for the analyzeDocument method.

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The Universally Unique Identifier (UUID) of the collection.

        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 2023-03-31.

        Form Parameters

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }

        The analyzeDocument options.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.

        parameters

        • The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

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

        • The ID of the collection.

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

        • Add a document: The content of the document to ingest. For the supported file types and maximum supported file size limits when adding a document, see the documentation.

          Analyze a document: The content of the document to analyze but not ingest. Only the application/json content type is supported by the Analyze API. For maximum supported file size limits, see the product documentation.

        • 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]

        • Add information about the file that you want to include in the response.

          The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

          Example:

          { 
           "filename": "favorites2.json",
           "file_type": "json"
          }.
        • curl -X POST {auth} --header "Content-Type: multipart/form-data" --form metadata="{\"filename\": \"favorites2.json\",   \"file_type\": \"json\"}" --form "file=@favorites2.json;type=application/json" "{url}/v2/projects/{project_id}/collections/{collection_id}/analyze?version=2023-03-31"

          Download example document favorites2.json

        Response

        An object that contains the converted document and any identified enrichments. Root-level fields from the original file are returned also.

        An object that contains the converted document and any identified enrichments. Root-level fields from the original file are returned also.

        An object that contains the converted document and any identified enrichments. Root-level fields from the original file are returned also.

        An object that contains the converted document and any identified enrichments. Root-level fields from the original file are returned also.

        An object that contains the converted document and any identified enrichments. Root-level fields from the original file are returned also.

        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.

        Example responses
        • {
            "result": {
              "enriched_Quote": [
                {
                  "keywords": [
                    {
                      "text": "day",
                      "mentions": [
                        {
                          "text": "day",
                          "location": {
                            "begin": 10,
                            "end": 13
                          }
                        }
                      ],
                      "relevance": 0.673739
                    },
                    {
                      "text": "stranger",
                      "mentions": [
                        {
                          "text": "stranger",
                          "location": {
                            "begin": 28,
                            "end": 36
                          }
                        }
                      ],
                      "relevance": 0.596757
                    },
                    {
                      "text": "parents",
                      "mentions": [
                        {
                          "text": "parents",
                          "location": {
                            "begin": 52,
                            "end": 59
                          }
                        }
                      ],
                      "relevance": 0.568336
                    },
                    {
                      "text": "mother",
                      "mentions": [
                        {
                          "text": "mother",
                          "location": {
                            "begin": 66,
                            "end": 72
                          }
                        }
                      ],
                      "relevance": 0.755562
                    },
                    {
                      "text": "Mr. Collins",
                      "mentions": [
                        {
                          "text": "Mr. Collins",
                          "location": {
                            "begin": 118,
                            "end": 129
                          }
                        }
                      ],
                      "relevance": 0.945891
                    }
                  ],
                  "entities": [
                    {
                      "text": "one",
                      "type": "Number",
                      "mentions": [
                        {
                          "text": "one",
                          "confidence": 0.8,
                          "location": {
                            "begin": 40,
                            "end": 43
                          }
                        }
                      ],
                      "model_name": "natural_language_understanding"
                    },
                    {
                      "text": "Mr. Collins",
                      "type": "Person",
                      "mentions": [
                        {
                          "text": "Mr. Collins",
                          "confidence": 0.89255315,
                          "location": {
                            "begin": 118,
                            "end": 129
                          }
                        }
                      ],
                      "model_name": "natural_language_understanding"
                    }
                  ]
                }
              ],
              "url": "https://www.gutenberg.org/files/1342/1342-h/1342-h.htm#link2HCH0020",
              "Subject": "Parental love",
              "Year": "1813/01/01",
              "Book": "Pride and Prejudice",
              "Author": "Jane Austen",
              "Quote": [
                "From this day you must be a stranger to one of your parents. Your mother will never see you again if you do not marry Mr. Collins, and I will never see you again if you do."
              ],
              "metadata": {
                "filename": "favorites2.json",
                "file_type": "json"
              },
              "Speaker": "Mr. Bennett"
            },
            "notices": []
          }
        • {
            "result": {
              "enriched_Quote": [
                {
                  "keywords": [
                    {
                      "text": "day",
                      "mentions": [
                        {
                          "text": "day",
                          "location": {
                            "begin": 10,
                            "end": 13
                          }
                        }
                      ],
                      "relevance": 0.673739
                    },
                    {
                      "text": "stranger",
                      "mentions": [
                        {
                          "text": "stranger",
                          "location": {
                            "begin": 28,
                            "end": 36
                          }
                        }
                      ],
                      "relevance": 0.596757
                    },
                    {
                      "text": "parents",
                      "mentions": [
                        {
                          "text": "parents",
                          "location": {
                            "begin": 52,
                            "end": 59
                          }
                        }
                      ],
                      "relevance": 0.568336
                    },
                    {
                      "text": "mother",
                      "mentions": [
                        {
                          "text": "mother",
                          "location": {
                            "begin": 66,
                            "end": 72
                          }
                        }
                      ],
                      "relevance": 0.755562
                    },
                    {
                      "text": "Mr. Collins",
                      "mentions": [
                        {
                          "text": "Mr. Collins",
                          "location": {
                            "begin": 118,
                            "end": 129
                          }
                        }
                      ],
                      "relevance": 0.945891
                    }
                  ],
                  "entities": [
                    {
                      "text": "one",
                      "type": "Number",
                      "mentions": [
                        {
                          "text": "one",
                          "confidence": 0.8,
                          "location": {
                            "begin": 40,
                            "end": 43
                          }
                        }
                      ],
                      "model_name": "natural_language_understanding"
                    },
                    {
                      "text": "Mr. Collins",
                      "type": "Person",
                      "mentions": [
                        {
                          "text": "Mr. Collins",
                          "confidence": 0.89255315,
                          "location": {
                            "begin": 118,
                            "end": 129
                          }
                        }
                      ],
                      "model_name": "natural_language_understanding"
                    }
                  ]
                }
              ],
              "url": "https://www.gutenberg.org/files/1342/1342-h/1342-h.htm#link2HCH0020",
              "Subject": "Parental love",
              "Year": "1813/01/01",
              "Book": "Pride and Prejudice",
              "Author": "Jane Austen",
              "Quote": [
                "From this day you must be a stranger to one of your parents. Your mother will never see you again if you do not marry Mr. Collins, and I will never see you again if you do."
              ],
              "metadata": {
                "filename": "favorites2.json",
                "file_type": "json"
              },
              "Speaker": "Mr. Bennett"
            },
            "notices": []
          }

        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.

        DELETE /v2/user_data
        ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions)
        deleteUserData(params)
        delete_user_data(
                self,
                customer_id: str,
                **kwargs,
            ) -> DetailedResponse
        DeleteUserData(string customerId)

        Request

        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 2023-03-31.

        • The customer ID for which all data is to be deleted.

        The deleteUserData options.

        parameters

        • The customer ID for which all data is to be deleted.

        parameters

        • The customer ID for which all data is to be deleted.

        parameters

        • The customer ID for which all data is to be deleted.

        • curl -X DELETE {auth} "{url}/v2/user_data?customer_id={id}&version=2023-03-31"

        Response

        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.

        List curations

        Beta

        Lists the currently configured curation queries and the associated curated responses. The curations API methods are beta functionality. Beta features are not supported by the SDKs.

        GET /v2/projects/{project_id}/curations

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        • curl {auth} "{url}/v2/projects/{project_id}/curations?version=2023-03-31"

        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.

        Example responses
        • {
            "curations": [
              {
                "curation_id": "a3dd3f517283be53c7a05013213450d960635334",
                "natural_language_query": "What types of data sources are supported",
                "curated_results": [
                  {
                    "collection_id": "47477591-b520-6039-0000-017ea213e837",
                    "document_id": "web_crawl_b43bc2d2-9445-51b1-ab1d-57459c7446ce"
                  }
                ]
              },
              {
                "curation_id": "c1175536f509405bc68a9f76235fa7bbb6f9af2f",
                "natural_language_query": "What is a project",
                "curated_results": [
                  {
                    "collection_id": "47477591-b520-6039-0000-017ea213e837",
                    "document_id": "web_crawl_123a2a56-8c26-5acb-9544-c4702ac899a4",
                    "snippet": "A project is a convenient way to collect and manage the resources in your application. You can assign a project type and connect your data to the project by creating a collection."
                  }
                ]
              }
            ]
          }

        Create curation

        Beta

        Add a new curated query and specify result documents. Curations with a total of 5,000 queries and 50,000 documents are allowed per project.

        Note: The curations API methods are beta functionality. Beta features are not supported by the SDKs.

        POST /v2/projects/{project_id}/curations

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        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 2023-03-31.

        Natural language query to curate and array of results to return when the query is specified.

        • curl -X POST {auth} --header "Content-Type: application/json" --data "{   \"natural_language_query\": \"What is a project\",   \"curated_results\": [{     \"document_id\": \"web_crawl_123a2a56-8c26-5acb-9544-c4702ac899a4\",     \"collection_id\": \"47477591-b520-6039-0000-017ea213e837\",     \"snippet\": \"A project is a convenient way to collect and manage the resources in your application. You can assign a project type and connect your data to the project by creating a collection.\"   }] }" "{url}/v2/projects/{project_id}/curations?version=2023-03-31"

        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.

        Example responses
        • {
            "curation_id": "c1175536f509405bc68a9f76235fa7bbb6f9af2f",
            "natural_language_query": "What is a project",
            "curated_results": [
              {
                "collection_id": "47477591-b520-6039-0000-017ea213e837",
                "document_id": "web_crawl_123a2a56-8c26-5acb-9544-c4702ac899a4",
                "snippet": "A project is a convenient way to collect and manage the resources in your application. You can assign a project type and connect your data to the project by creating a collection."
              }
            ]
          }

        Get curation

        Beta

        Gets details about the specified curation. The curations API methods are beta functionality. Beta features are not supported by the SDKs.

        GET /v2/projects/{project_id}/curations/{curation_id}

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the curation.

          Possible values: 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 2023-03-31.

        • curl {auth} "{url}/v2/projects/3d8e91bc-a277-41b5-aa1e-c39327bc15bf/curations/a3dd3f517283be53c7a05013213450d960635334?version=2023-03-31"

        Response

        Object that contains an array of curated results.

        Status Code

        • Object that contains an array of curated results for the specified curation id.

        • Specified project or curation ID not found.

        Example responses
        • {
            "curated_results": [
              {
                "collection_id": "47477591-b520-6039-0000-017ea213e837",
                "document_id": "web_crawl_b43bc2d2-9445-51b1-ab1d-57459c7446ce"
              }
            ]
          }

        Delete curation

        Beta

        Deletes the specified curation. The curations API methods are beta functionality. Beta features are not supported by the SDKs.

        DELETE /v2/projects/{project_id}/curations/{curation_id}

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the curation.

          Possible values: 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 2023-03-31.

        • curl -X DELETE {auth} "{url}/v2/projects/3d8e91bc-a277-41b5-aa1e-c39327bc15bf/curations/c1175536f509405bc68a9f76235fa7bbb6f9af2f?version=2023-03-31"

        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

        Beta

        Update an existing curated results documents for the specified query. For example, you can enhance the curated result by adding a text snippet to it. The curations API methods are beta functionality. Beta features are not supported by the SDKs.

        POST /v2/projects/{project_id}/curations/{curation_id}/curated_results

        Request

        Path Parameters

        • The Universally Unique Identifier (UUID) of the project. This information can be found from the Integrate and Deploy page in Discovery.

        • The ID of the curation.

          Possible values: 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 2023-03-31.

        Result to add to the specified curated query.

        • curl -X POST {auth} --data "{   \"document_id\": \"web_crawl_b43bc2d2-9445-51b1-ab1d-57459c7446ce\",    \"collection_id\": \"47477591-b520-6039-0000-017ea213e837\",   \"snippet\": \"Watson Discovery can get data from many popular third-party data repositories. See the \"Supported data sources\" table for more details.\"}" "{url}/v2/projects/3d8e91bc-a277-41b5-aa1e-c39327bc15bf/curations/a3dd3f517283be53c7a05013213450d960635334/curated_results?version=2023-03-31"

        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.

        Example responses
        • {
            "collection_id": "47477591-b520-6039-0000-017ea213e837",
            "document_id": "web_crawl_b43bc2d2-9445-51b1-ab1d-57459c7446ce",
            "snippet": "Watson Discovery can get data from many popular third-party data repositories. See the \"Supported data sources\" table for more details."
          }
        id=javaclassName=tab-item-selected