Skip to content

Latest commit

 

History

History
773 lines (607 loc) · 33.9 KB

CollectionsApi.md

File metadata and controls

773 lines (607 loc) · 33.9 KB

Com.Sajari.Sdk.Api.CollectionsApi

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

CreateCollection

Collection CreateCollection (string collectionId, Collection collection, string accountId = null)

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class CreateCollectionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var 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\\-]*$`.
            var collection = new Collection(); // Collection | Details of the collection to create.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Create collection
                Collection result = apiInstance.CreateCollection(collectionId, collection, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.CreateCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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]

Return type

Collection

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteCollection

Object DeleteCollection (string collectionId, string accountId = null)

Delete collection

Delete a collection and all of its associated data. > Note: This operation cannot be reversed.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class DeleteCollectionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to delete, e.g. `my-collection`.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Delete collection
                Object result = apiInstance.DeleteCollection(collectionId, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.DeleteCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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]

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Experiment

ExperimentResponse Experiment (string collectionId, ExperimentRequest 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 }] }] }

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class ExperimentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to query, e.g. `my-collection`.
            var experimentRequest = new ExperimentRequest(); // ExperimentRequest | 

            try
            {
                // Experiment
                ExperimentResponse result = apiInstance.Experiment(collectionId, experimentRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.Experiment: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection to query, e.g. `my-collection`.
experimentRequest ExperimentRequest

Return type

ExperimentResponse

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetCollection

Collection GetCollection (string collectionId, string accountId = null, string view = null)

Get collection

Retrieve the details of a collection.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class GetCollectionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to retrieve, e.g. `my-collection`.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 
            var 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. (optional)  (default to VIEW_UNSPECIFIED)

            try
            {
                // Get collection
                Collection result = apiInstance.GetCollection(collectionId, accountId, view);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.GetCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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]

Return type

Collection

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCollections

ListCollectionsResponse ListCollections (string accountId = null, int? pageSize = null, string pageToken = null, string view = null)

List collections

Retrieve a list of collections in an account.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class ListCollectionsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var accountId = "accountId_example";  // string | The account that owns this set of collections, e.g. `1618535966441231024`. (optional) 
            var pageSize = 56;  // int? | 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) 
            var 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. (optional) 
            var 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. (optional)  (default to VIEW_UNSPECIFIED)

            try
            {
                // List collections
                ListCollectionsResponse result = apiInstance.ListCollections(accountId, pageSize, pageToken, view);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.ListCollections: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
accountId string The account that owns this set of collections, e.g. `1618535966441231024`. [optional]
pageSize int? 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]

Return type

ListCollectionsResponse

Authorization

BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

QueryCollection

QueryCollectionResponse QueryCollection (string collectionId, QueryCollectionRequest queryCollectionRequest, string accountId = null)

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class QueryCollectionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to query, e.g. `my-collection`.
            var queryCollectionRequest = new QueryCollectionRequest(); // QueryCollectionRequest | 
            var 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. (optional) 

            try
            {
                // Query collection
                QueryCollectionResponse result = apiInstance.QueryCollection(collectionId, queryCollectionRequest, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.QueryCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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]

Return type

QueryCollectionResponse

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

QueryCollection2

QueryCollectionResponse QueryCollection2 (string collectionId, QueryCollectionRequest 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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class QueryCollection2Example
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to query, e.g. `my-collection`.
            var queryCollectionRequest = new QueryCollectionRequest(); // QueryCollectionRequest | 

            try
            {
                // Query collection
                QueryCollectionResponse result = apiInstance.QueryCollection2(collectionId, queryCollectionRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.QueryCollection2: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collectionId string The collection to query, e.g. `my-collection`.
queryCollectionRequest QueryCollectionRequest

Return type

QueryCollectionResponse

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TrackEvent

Object TrackEvent (string accountId, string collectionId, Event _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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class TrackEventExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`.
            var collectionId = "collectionId_example";  // string | The collection to track the event against, e.g. `my-collection`.
            var _event = new Event(); // Event | The details of the event to track.

            try
            {
                // Track event
                Object result = apiInstance.TrackEvent(accountId, collectionId, _event);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.TrackEvent: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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.

Return type

Object

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateCollection

Collection UpdateCollection (string collectionId, Collection collection, string accountId = null, string updateMask = null)

Update collection

Update the details of a collection.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class UpdateCollectionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_example";  // string | The collection to update, e.g. `my-collection`.
            var collection = new Collection(); // Collection | The details of the collection to update.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 
            var 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. (optional) 

            try
            {
                // Update collection
                Collection result = apiInstance.UpdateCollection(collectionId, collection, accountId, updateMask);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CollectionsApi.UpdateCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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]

Return type

Collection

Authorization

BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]