Introduction

The IBM Watson™ Discovery Service 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.

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

Maven

<dependency>
  <groupId>com.ibm.watson.developer_cloud</groupId>
  <artifactId>java-sdk</artifactId>
  <version>6.9.3</version>
</dependency>

Gradle

compile 'com.ibm.watson.developer_cloud:java-sdk:6.9.3'

GitHub

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

Installation

npm install --save watson-developer-cloud

GitHub

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

Installation

pip install --upgrade "watson-developer-cloud>=2.4.4"

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

GitHub

Authentication

IBM Cloud is migrating to token-based Identity and Access Management (IAM) authentication.

  • With some service instances, you authenticate to the API by using 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. Learn more about IAM.

    If you pass in the apikey, the SDK manages the lifecycle of the tokens. If you pass a token, you maintain the token lifecycle. Learn more about IAM authentication with the SDK.

  • In other instances, you authenticate by providing the username and password for the service instance. For more information, see Service credentials for Watson services.

To find out which authentication to use, view the service credentials by clicking the service instance on the Dashboard.

The "username" and "password" in the service credentials are different from your IBM Cloud account IBMid and password.

IAM authentication. Replace {apikey} and {url} with your service credentials.

curl -u "apikey:{apikey}" "{url}/{method}"

Basic authentication. Replace {username}, {password}, and {url} with your service credentials.

curl -u "{username}:{password}" "{url}/{method}"

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

IamOptions options = new IamOptions.Builder()
    .apiKey("{apikey}")
    .build();

Discovery discovery = new Discovery("{version}", options);

discovery.setEndPoint("{url}");

Basic authentication. Replace {username}, {password}, `, and{url}`. Use either of the two constructors.

Discovery discovery = new Discovery(
    "{version}",
    "{username}",
    "{password}");

discovery.setEndPoint("{url}");

or

Discovery discovery = new Discovery("{version}");
discovery.setUsernameAndPassword("{username}","{password}");

discovery.setEndPoint("{url}");

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

var DiscoveryV1 = require('watson-developer-cloud/discovery/v1');

var discovery = new DiscoveryV1({
  version: '{version}',
  iam_apikey: '{apikey}',
  url: '{url}'
});

Basic authentication. Replace {username}, {password}, `, and{url}`.

var  = require('watson-developer-cloud/discovery/v1');

var discovery = new DiscoveryV1({
  version: '{version}',
  username: '{username}',
  password: '{password}',
  url: '{url}'
});

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

from watson_developer_cloud import DiscoveryV1

discovery = DiscoveryV1(
    version='{version}',
    iam_apikey='{apikey}',
    url='{url}'
)

Basic authentication. Replace {username}, {password}, `, and{url}`.

from watson_developer_cloud import DiscoveryV1

discovery = DiscoveryV1(
    version='{version}',
    username='{username}',
    password='{password}',
    url='{url}'
)

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

require "ibm_watson"

discovery = IBMWatson::DiscoveryV1.new(
  version: "{version}",
  iam_apikey: "{apikey}",
  url:"{url}"
)

Basic authentication. Replace {username}, {password}, `, and{url}`.

require "ibm_watson"

discovery = IBMWatson::DiscoveryV1.new(
  version: "{version}",
  username: "{username}",
  password: "{password}",
  url:"{url}"
)

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

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

discovery, discoveryErr := discoveryv1.NewDiscoveryV1(&discoveryv1.DiscoveryV1Options{
  Version: "{version}",
  IAMApiKey: "{apikey}",
  URL: "{url}",
})

Basic authentication. Replace {username}, {password}, `, and{url}`.

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

discovery, discoveryErr := discoveryv1.NewDiscoveryV1(&discoveryv1.DiscoveryV1Options{
  Version: "{version}",
  Username: "{username}",
  Password: "{password}",
  URL: "{url}",
})

Service endpoint

The service endpoint is based on the location of the service instance. For example, when Discovery is hosted in Frankfurt, the base URL is https://gateway-fra.watsonplatform.net/discovery/api. The URL might also be different when you use IBM Cloud Dedicated.

To find out which URL to use, view the service credentials by clicking the service instance on the Dashboard.

Use that URL in your requests to Discovery.

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

Set the correct service URL by calling the url parameter when you create the service instance.

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

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

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

Service endpoints by location:

  • Dallas: https://gateway.watsonplatform.net/discovery/api
  • Washington DC: https://gateway-wdc.watsonplatform.net/discovery/api
  • Frankfurt: https://gateway-fra.watsonplatform.net/discovery/api
  • Sydney: https://gateway-syd.watsonplatform.net/discovery/api
  • Tokyo: https://gateway-tok.watsonplatform.net/discovery/api
  • London: https://gateway.watsonplatform.net/discovery/api

All locations might not support Discovery. For details, see Service availability.

Dallas API endpoint

https://gateway.watsonplatform.net/discovery/api

Your service instance might not use this URL

Default URL

https://gateway.watsonplatform.net/discovery/api

Example for the Washington DC location

Discovery discovery = new Discovery("{version}");
discovery.setEndPoint("https://gateway-wdc.watsonplatform.net/discovery/api");

Default URL

https://gateway.watsonplatform.net/discovery/api

Example for the Washington DC location

var DiscoveryV1 = require('watson-developer-cloud/discovery/v1');

var discovery = new DiscoveryV1({
  version: '{version}',
  iam_apikey: '{apikey}',
  url: 'https://gateway-wdc.watsonplatform.net/discovery/api'
});

Default URL

https://gateway.watsonplatform.net/discovery/api

Examples for the Washington DC location in the constructor and after instantiation

discovery = DiscoveryV1(
  version='{version}',
  iam_apikey='{apikey}',
  url='https://gateway-wdc.watsonplatform.net/discovery/api'
)

or

discovery.set_url('https://gateway-wdc.watsonplatform.net/discovery/api')

Default URL

https://gateway.watsonplatform.net/discovery/api

Examples for the Washington DC location in the constructor and after instantiation

discovery = IBMWatson::.new(
  version: "{version}",
  api_key: "{apikey}",
  url: "https://gateway-wdc.watsonplatform.net/discovery/api"
)

or

discovery.url = "https://gateway-wdc.watsonplatform.net/discovery/api"

Default URL

https://gateway.watsonplatform.net/discovery/api

Examples for the Washington DC location in the constructor and after instantiation

discovery, discoveryErr := discoveryv1.NewDiscoveryV1(&discoveryv1.DiscoveryV1Options{
  Version: "{version}",
  IAMApiKey: "{apikey}",
  URL: "https://gateway-wdc.watsonplatform.net/discovery/api",
})

or

discovery.SetURL("https://gateway-wdc.watsonplatform.net/discovery/api")

Versioning

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

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

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

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

Error handling

The Discovery service 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 illegal 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 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 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 a WatsonApiException that contains the following fields.

Field Description
code The HTTP response code 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 a WatsonApiException that contains the following fields.

Field Description
code The HTTP response code 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 returned.
message A message that describes the error.

Example error handling

try {

    // Invoke a Discovery 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,
  function (err, response) {
    // The error will be the first argument of the callback
    if (err.code == 404) {

      // Handle Not Found (404) error
    } else if (err.code == 413) {

      // Handle Request Too Large (413) error
    } else {
      console.log('Unexpected error: ', err.code);
      console.log('error:', err);
    }
  });

Example error handling

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

Example error handling

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

Example error handling

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

// Instantiate a service
discovery, discoveryErr := discoveryv1.NewDiscoveryV1(&discoveryv1.DiscoveryV1Options{})

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

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

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

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

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

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.

Example header parameter in a request

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

Example header parameter in a request

discovery.methodName({
  parameters,
  headers: {
    'Custom-Header': '{header_value}'
  }
},
  function (err, response) {
    if (err) {
      console.log('error:', err);
    } else {
      console.log(response);
    }
  }
);

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

response, _ := discoveryv1.methodName(
  &methodOptions{
    Headers: map[string]string{
      "Accept": "application/json",
    },
  },
)

Response details

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

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();

To access information in the response headers, specify the headers attribute on the third parameter (response) that is passed to the callback function.

Example request to access response headers

discovery.methodName({
  parameters
},
  function (err, result, response) {
    if (err) {
      console.log('error:', err);
    } else {
      console.log(response.headers);
    }
  }
);

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 result 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/watson-developer-cloud/go-sdk/core"
response, _ := discoveryv1.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 ")

Data labels

You can remove customer data if you associate the customer and the data when you send the information to a service. First you label the data with a customer ID, and then you can delete the data by the ID.

  • Use the X-Watson-Metadata header to associate a customer ID with the data. By adding a customer ID to a request, you indicate that it contains data that belongs to that customer.

    Specify a random or generic string for the customer ID. Do not include personal data, such as an email address. Pass the string customer_id={id} as the argument of the header.

  • Use the Delete labeled data method to remove data that is associated with a customer ID.

Labeling data is used only by methods that accept customer data. For more information about Discovery and labeling data, see Information security.

For more information about how to pass headers, see Additional headers.

Data collection

By default, all Watson services log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public.

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

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

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

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

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

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

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

Example request

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

Example request

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

discovery.setDefaultHeaders(headers);

Example request

var  = require('watson-developer-cloud/');

var discovery = new DiscoveryV1({
  version: '{version}',
  iam_apikey: '{apikey}',
  headers: {
    'X-Watson-Learning-Opt-Out': 'true'
  }
});

Example request

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

Example request

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

Example request

import "net/http"

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

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

Create an environment

Creates a new environment for private data. An environment must be created before collections can be created.

Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

Creates a new environment for private data. An environment must be created before collections can be created.

Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

Creates a new environment for private data. An environment must be created before collections can be created.

Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

Creates a new environment for private data. An environment must be created before collections can be created.

Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

Creates a new environment for private data. An environment must be created before collections can be created.

Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

POST /v1/environments
ServiceCall<Environment> createEnvironment(CreateEnvironmentOptions createEnvironmentOptions)
createEnvironment(params, callback())
create_environment(self, name, description=None, size=None, **kwargs)
create_environment(name:, description: nil, size: nil)
Request

Use the CreateEnvironmentOptions.Builder to create a CreateEnvironmentOptions object that contains the parameter values for the createEnvironment method.

Query Parameters

  • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

    Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

An object that defines an environment name and optional description. The fields in this object are not approved for personal information and cannot be deleted based on customer ID.

Example:

The createEnvironment options.

parameters

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

  • Description of the environment.

    Default:

  • Size of the environment. In the Lite plan the default and only accepted value is LT, in all other plans the default is S.

    Allowable values: [LT,XS,S,MS,M,ML,L,XL,XXL,XXXL]

parameters

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

  • Description of the environment.

    Default:

  • Size of the environment. In the Lite plan the default and only accepted value is LT, in all other plans the default is S.

    Allowable values: [LT,XS,S,MS,M,ML,L,XL,XXL,XXXL]

parameters

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

  • Description of the environment.

    Default:

  • Size of the environment. In the Lite plan the default and only accepted value is LT, in all other plans the default is S.

    Allowable values: [LT,XS,S,MS,M,ML,L,XL,XXL,XXXL]

Example requests
Response

Details about an environment.

Details about an environment.

Example:

Details about an environment.

Example:

Details about an environment.

Example:

Details about an environment.

Example:

Status Code

  • Environment successfully added.

  • Bad request.

Example responses

List environments

List existing environments for the service instance.

List existing environments for the service instance.

List existing environments for the service instance.

List existing environments for the service instance.

List existing environments for the service instance.

GET /v1/environments
ServiceCall<ListEnvironmentsResponse> listEnvironments(ListEnvironmentsOptions listEnvironmentsOptions)
listEnvironments(params, callback())
list_environments(self, name=None, **kwargs)
list_environments(name: nil)
Request

Use the ListEnvironmentsOptions.Builder to create a ListEnvironmentsOptions object that contains the parameter values for the listEnvironments method.

Query Parameters

  • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

    Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

  • Show only the environment with the given name.

The listEnvironments options.

parameters

  • Show only the environment with the given name.

parameters

  • Show only the environment with the given name.

parameters

  • Show only the environment with the given name.

Example requests
Response
Example:
Example:
Example:
Example:

Status Code

  • Successful response.

  • Bad request.

Example responses

Get environment info

GET /v1/environments/{environment_id}
ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironmentOptions)
getEnvironment(params, callback())
get_environment(self, environment_id, **kwargs)
get_environment(environment_id:)
Request

Use the GetEnvironmentOptions.Builder to create a GetEnvironmentOptions object that contains the parameter values for the getEnvironment method.

Path Parameters

  • The ID of the environment.

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

Query Parameters

  • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

    Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

The getEnvironment options.

parameters

  • The ID of the environment.

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

parameters

  • The ID of the environment.

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

parameters

  • The ID of the environment.

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

Example requests
Response

Details about an environment.

Details about an environment.

Example:

Details about an environment.

Example:

Details about an environment.

Example:

Details about an environment.

Example:

Status Code

  • Environment fetched.

  • Bad request.

Example responses

Update an environment

Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

PUT /v1/environments/{environment_id}
ServiceCall<Environment> updateEnvironment(UpdateEnvironmentOptions updateEnvironmentOptions)
updateEnvironment(params, callback())
update_environment(self, environment_id, name=None, description=None, size=None, **kwargs)
update_environment(environment_id:, name: nil, description: nil, size: nil)
Request

Use the UpdateEnvironmentOptions.Builder to create a UpdateEnvironmentOptions object that contains the parameter values for the updateEnvironment method.

Path Parameters

  • The ID of the environment.

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

Query Parameters

  • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

    Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

An object that defines the environment's name and, optionally, description.

The updateEnvironment options.

parameters

  • The ID of the environment.

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

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

    Default:

  • Description of the environment.

    Default:

  • Size that the environment should be increased to. Environment size cannot be modified when using a Lite plan. Environment size can only increased and not decreased.

    Allowable values: [S,MS,M,ML,L,XL,XXL,XXXL]

parameters

  • The ID of the environment.

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

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

    Default:

  • Description of the environment.

    Default:

  • Size that the environment should be increased to. Environment size cannot be modified when using a Lite plan. Environment size can only increased and not decreased.

    Allowable values: [S,MS,M,ML,L,XL,XXL,XXXL]

parameters

  • The ID of the environment.

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

  • Name that identifies the environment.

    Constraints: 0 ≤ length ≤ 255

    Default:

  • Description of the environment.

    Default:

  • Size that the environment should be increased to. Environment size cannot be modified when using a Lite plan. Environment size can only increased and not decreased.

    Allowable values: [S,MS,M,ML,L,XL,XXL,XXXL]

Example requests
    Response

    Details about an environment.

    Details about an environment.

    Example:

    Details about an environment.

    Example:

    Details about an environment.

    Example:

    Details about an environment.

    Example:

    Status Code

    • Environment successfully updated.

    • Bad request.

    • Forbidden. Returned if you attempt to update a read-only environment.

    Example responses

    Delete environment

    DELETE /v1/environments/{environment_id}
    ServiceCall<Void> deleteEnvironment(DeleteEnvironmentOptions deleteEnvironmentOptions)
    deleteEnvironment(params, callback())
    delete_environment(self, environment_id, **kwargs)
    delete_environment(environment_id:)
    Request

    Use the DeleteEnvironmentOptions.Builder to create a DeleteEnvironmentOptions object that contains the parameter values for the deleteEnvironment method.

    Path Parameters

    • The ID of the environment.

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

    Query Parameters

    • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

      Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

    The deleteEnvironment options.

    parameters

    • The ID of the environment.

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

    parameters

    • The ID of the environment.

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

    parameters

    • The ID of the environment.

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

    Example requests
    Response

    Status Code

    • Environment successfully deleted.

    • Bad request. Example error messages:

      • Invalid environment id. Please check if the format is correct.
    • Forbidden. Returned if you attempt to delete a read-only environment.

    • Returned any time the environment is not found (even immediately after the environment was successfully deleted).

      Example error message:

      An environment with ID '2cd8bc72-d737-46e3-b26b-05a585111111' was not found.

    No Sample Response

    This method does not specify any sample responses.

    List fields across collections

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

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

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

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

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

    GET /v1/environments/{environment_id}/fields
    ServiceCall<ListCollectionFieldsResponse> listFields(ListFieldsOptions listFieldsOptions)
    listFields(params, callback())
    list_fields(self, environment_id, collection_ids, **kwargs)
    list_fields(environment_id:, collection_ids:)
    Request

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

    Path Parameters

    • The ID of the environment.

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

    Query Parameters

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

    • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

      Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

    The listFields options.

    parameters

    • The ID of the environment.

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

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

    parameters

    • The ID of the environment.

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

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

    parameters

    • The ID of the environment.

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

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

    Example requests
        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 JSON objects are assigned a type of "nested".

        • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

        • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        The list of fetched fields.

        The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

        • Fields which contain nested JSON objects are assigned a type of "nested".

        • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

        • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        Example:

        The list of fetched fields.

        The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

        • Fields which contain nested JSON objects are assigned a type of "nested".

        • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

        • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        Example:

        The list of fetched fields.

        The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

        • Fields which contain nested JSON objects are assigned a type of "nested".

        • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

        • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        Example:

        The list of fetched fields.

        The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations.

        • Fields which contain nested JSON objects are assigned a type of "nested".

        • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

        • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        Example:

        Status Code

        • The list of fetched fields.

          The fields are returned using a fully qualified name format, however, the format differs slightly from that used by the query operations:

          • Fields which contain nested JSON objects are assigned a type of "nested".

          • Fields which belong to a nested object are prefixed with .properties (for example, warnings.properties.severity means that the warnings object has a property called severity).

          • Fields returned from the News collection are prefixed with v{N}-fullnews-t3-{YEAR}.mappings (for example, v5-fullnews-t3-2016.mappings.text.properties.author).

        • Bad request.

        Example responses

        Add configuration

        Creates a new configuration.

        If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

        The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        Creates a new configuration.

        If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

        The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        Creates a new configuration.

        If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

        The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        Creates a new configuration.

        If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

        The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        Creates a new configuration.

        If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

        The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        POST /v1/environments/{environment_id}/configurations
        ServiceCall<Configuration> createConfiguration(CreateConfigurationOptions createConfigurationOptions)
        createConfiguration(params, callback())
        create_configuration(self, environment_id, name, description=None, conversions=None, enrichments=None, normalizations=None, source=None, **kwargs)
        create_configuration(environment_id:, name:, description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil)
        Request

        Use the CreateConfigurationOptions.Builder to create a CreateConfigurationOptions object that contains the parameter values for the createConfiguration method.

        Path Parameters

        • The ID of the environment.

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

        Query Parameters

        • A date (YYYY-MM-DD) that identifies the specific version of the API to use when processing the request.

          Constraints: matches regular expression ^\d{4}-\d{2}-\d{2}$

        Input an object that enables you to customize how your content is ingested and what enrichments are added to your data.

        name is required and must be unique within the current environment. All other properties are optional.

        If the input configuration contains the configuration_id, created, or updated properties, then they will be ignored and overridden by the system (an error is not returned so that the overridden fields do not need to be removed when copying a configuration).

        The configuration can contain unrecognized JSON fields. Any such fields will be ignored and will not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

        Example:

        The createConfiguration options.