All URIs are relative to https://api.search.io
Method | HTTP request | Description |
---|---|---|
createCollection | POST /v4/collections | Create collection |
deleteCollection | DELETE /v4/collections/{collection_id} | Delete collection |
experiment | POST /v4/collections/{collection_id}:experiment | Experiment |
getCollection | GET /v4/collections/{collection_id} | Get collection |
listCollections | GET /v4/collections | List collections |
queryCollection | POST /v4/collections/{collection_id}:query | Query collection |
queryCollection2 | POST /v4/collections/{collection_id}:queryCollection | Query collection |
trackEvent | POST /v4/collections/{collection_id}:trackEvent | Track event |
updateCollection | PATCH /v4/collections/{collection_id} | Update collection |
Collection createCollection(collectionId, collection, accountId)
Create collection
Create an empty collection. Before records can be added to a collection, the schema and pipelines for the collection have to be set up. Consider setting up new collections via the Search.io Console, which handles the creation of the schema and pipelines for you.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The ID to use for the collection. This must start with an alphanumeric character followed by one or more alphanumeric or `-` characters. Strictly speaking, it must match the regular expression: `^[A-Za-z][A-Za-z0-9\\-]*$`.
Collection collection = new Collection(); // Collection | Details of the collection to create.
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`.
try {
Collection result = apiInstance.createCollection(collectionId, collection, accountId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#createCollection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The ID to use for the collection. This must start with an alphanumeric character followed by one or more alphanumeric or `-` characters. Strictly speaking, it must match the regular expression: `^[A-Za-z][A-Za-z0-9\-]*$`. | |
collection | Collection | Details of the collection to create. | |
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
400 | Returned when the request contains violations for one or more fields. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
409 | Returned when the collection already exists. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
Object deleteCollection(collectionId, accountId)
Delete collection
Delete a collection and all of its associated data. > Note: This operation cannot be reversed.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to delete, e.g. `my-collection`.
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`.
try {
Object result = apiInstance.deleteCollection(collectionId, accountId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#deleteCollection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to delete, e.g. `my-collection`. | |
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. | [optional] |
Object
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the collection was not found. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
ExperimentResponse experiment(collectionId, experimentRequest)
Experiment
Run a query on a collection with a hypothetical configuration to see what kinds of results it produces. Saved promotions with a start date in the future are enabled during the experiment, unless they are explicitly disabled. The following example demonstrates how to run a simple experiment for a string, against a pipeline and with a proposed promotion: ```json { "pipeline": { "name": "my-pipeline" }, "variables": { "q": "search terms" }, "promotions": [{ "id": "1234", "condition": "q = 'search terms'", "pins": [{ "key": { "field": "id", "value": "54hdc7h2334h" }, "position": 1 }] }] } ```
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to query, e.g. `my-collection`.
ExperimentRequest experimentRequest = new ExperimentRequest(); // ExperimentRequest |
try {
ExperimentResponse result = apiInstance.experiment(collectionId, experimentRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#experiment");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to query, e.g. `my-collection`. | |
experimentRequest | ExperimentRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
Collection getCollection(collectionId, accountId, view)
Get collection
Retrieve the details of a collection.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to retrieve, e.g. `my-collection`.
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`.
String view = "VIEW_UNSPECIFIED"; // String | The amount of information to include in the retrieved pipeline. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage.
try {
Collection result = apiInstance.getCollection(collectionId, accountId, view);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#getCollection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to retrieve, e.g. `my-collection`. | |
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. | [optional] |
view | String | The amount of information to include in the retrieved pipeline. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both ListCollections and GetCollection). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. | [optional] [default to VIEW_UNSPECIFIED] [enum: VIEW_UNSPECIFIED, BASIC, FULL] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
ListCollectionsResponse listCollections(accountId, pageSize, pageToken, view)
List collections
Retrieve a list of collections in an account.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String accountId = "accountId_example"; // String | The account that owns this set of collections, e.g. `1618535966441231024`.
Integer pageSize = 56; // Integer | The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections are returned. The maximum value is 100; values above 100 are coerced to 100.
String pageToken = "pageToken_example"; // String | A page token, received from a previous [ListCollections](/docs/api#operation/ListCollections) call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to [ListCollections](/docs/api#operation/ListCollections) must match the call that provided the page token.
String view = "VIEW_UNSPECIFIED"; // String | The amount of information to include in each retrieved collection. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage.
try {
ListCollectionsResponse result = apiInstance.listCollections(accountId, pageSize, pageToken, view);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#listCollections");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | String | The account that owns this set of collections, e.g. `1618535966441231024`. | [optional] |
pageSize | Integer | The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections are returned. The maximum value is 100; values above 100 are coerced to 100. | [optional] |
pageToken | String | A page token, received from a previous ListCollections call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListCollections must match the call that provided the page token. | [optional] |
view | String | The amount of information to include in each retrieved collection. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both ListCollections and GetCollection). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. | [optional] [default to VIEW_UNSPECIFIED] [enum: VIEW_UNSPECIFIED, BASIC, FULL] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
QueryCollectionResponse queryCollection(collectionId, queryCollectionRequest, accountId)
Query collection
Query the collection to search for records. The following example demonstrates how to run a simple search for a particular string: ```json { "variables": { "q": "search terms" } } ``` For more information: - See filtering content - See tracking in the Go SDK - See tracking in the JS SDK Note: Unlike other API calls, the `QueryCollection` call can be called from a browser. When called from a browser, the `Account-Id` header must be set to your account ID.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to query, e.g. `my-collection`.
QueryCollectionRequest queryCollectionRequest = new QueryCollectionRequest(); // QueryCollectionRequest |
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`. Unlike other API calls, the `QueryCollection` call can be called from a browser. When called from a browser, the `Account-Id` header must be set to your account ID.
try {
QueryCollectionResponse result = apiInstance.queryCollection(collectionId, queryCollectionRequest, accountId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#queryCollection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to query, e.g. `my-collection`. | |
queryCollectionRequest | QueryCollectionRequest | ||
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. Unlike other API calls, the `QueryCollection` call can be called from a browser. When called from a browser, the `Account-Id` header must be set to your account ID. | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
QueryCollectionResponse queryCollection2(collectionId, queryCollectionRequest)
Query collection
Query the collection to search for records. The following example demonstrates how to run a simple search for a particular string: ```json { "variables": { "q": "search terms" } } ``` For more information: - See filtering content - See tracking in the Go SDK - See tracking in the JS SDK Note: Unlike other API calls, the `QueryCollection` call can be called from a browser. When called from a browser, the `Account-Id` header must be set to your account ID.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to query, e.g. `my-collection`.
QueryCollectionRequest queryCollectionRequest = new QueryCollectionRequest(); // QueryCollectionRequest |
try {
QueryCollectionResponse result = apiInstance.queryCollection2(collectionId, queryCollectionRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#queryCollection2");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to query, e.g. `my-collection`. | |
queryCollectionRequest | QueryCollectionRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
Object trackEvent(accountId, collectionId, event)
Track event
Track an analytics event when a user interacts with an object returned by a QueryCollection request. An analytics event can be tracked for the following objects: - Results - Promotion banners - Redirects When tracking redirect events, set `type` to `redirect`. Note: You must pass an `Account-Id` header.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`.
String collectionId = "collectionId_example"; // String | The collection to track the event against, e.g. `my-collection`.
Event event = new Event(); // Event | The details of the event to track.
try {
Object result = apiInstance.trackEvent(accountId, collectionId, event);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#trackEvent");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. | |
collectionId | String | The collection to track the event against, e.g. `my-collection`. | |
event | Event | The details of the event to track. |
Object
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the resource does not exist. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |
Collection updateCollection(collectionId, collection, accountId, updateMask)
Update collection
Update the details of a collection.
// Import classes:
import com.sajari.client.ApiClient;
import com.sajari.client.ApiException;
import com.sajari.client.Configuration;
import com.sajari.client.auth.*;
import com.sajari.client.models.*;
import com.sajari.client.api.CollectionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.search.io");
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
CollectionsApi apiInstance = new CollectionsApi(defaultClient);
String collectionId = "collectionId_example"; // String | The collection to update, e.g. `my-collection`.
Collection collection = new Collection(); // Collection | The details of the collection to update.
String accountId = "accountId_example"; // String | The account that owns the collection, e.g. `1618535966441231024`.
String updateMask = "updateMask_example"; // String | The list of fields to update, separated by a comma, e.g. `authorized_query_domains,display_name`. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the collection object containing the new value.
try {
Collection result = apiInstance.updateCollection(collectionId, collection, accountId, updateMask);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionsApi#updateCollection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | The collection to update, e.g. `my-collection`. | |
collection | Collection | The details of the collection to update. | |
accountId | String | The account that owns the collection, e.g. `1618535966441231024`. | [optional] |
updateMask | String | The list of fields to update, separated by a comma, e.g. `authorized_query_domains,display_name`. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the collection object containing the new value. | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
401 | Returned when the request does not have valid authentication credentials. | - |
403 | Returned when the user does not have permission to access the resource. | - |
404 | Returned when the collection was not found. | - |
500 | Returned when the API encounters an internal error. | - |
0 | An unexpected error response. | - |