Skip to content

Latest commit

 

History

History
464 lines (364 loc) · 18.1 KB

RecordsApi.md

File metadata and controls

464 lines (364 loc) · 18.1 KB

RecordsApi

All URIs are relative to https://api.search.io

Method HTTP request Description
batchUpdateRecords POST /v4/collections/{collection_id}/records:batchUpdate Batch update records
batchUpsertRecords POST /v4/collections/{collection_id}/records:batchUpsert Batch upsert records
deleteRecord POST /v4/collections/{collection_id}/records:delete Delete record
getRecord POST /v4/collections/{collection_id}/records:get Get record
updateRecord POST /v4/collections/{collection_id}/records:update Update record
upsertRecord POST /v4/collections/{collection_id}/records:upsert Upsert record

batchUpdateRecords

BatchUpdateRecordsResponse batchUpdateRecords(collectionId, batchUpdateRecordsRequest)

Batch update records

The batch version of the UpdateRecord call.

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection that contains the records to update, e.g. `my-collection`.
    BatchUpdateRecordsRequest batchUpdateRecordsRequest = new BatchUpdateRecordsRequest(); // BatchUpdateRecordsRequest | 
    try {
      BatchUpdateRecordsResponse result = apiInstance.batchUpdateRecords(collectionId, batchUpdateRecordsRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#batchUpdateRecords");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection that contains the records to update, e.g. `my-collection`.
batchUpdateRecordsRequest BatchUpdateRecordsRequest

Return type

BatchUpdateRecordsResponse

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

batchUpsertRecords

BatchUpsertRecordsResponse batchUpsertRecords(collectionId, batchUpsertRecordsRequest)

Batch upsert records

The batch version of the UpsertRecord call.

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection to upsert the records in, e.g. `my-collection`.
    BatchUpsertRecordsRequest batchUpsertRecordsRequest = new BatchUpsertRecordsRequest(); // BatchUpsertRecordsRequest | 
    try {
      BatchUpsertRecordsResponse result = apiInstance.batchUpsertRecords(collectionId, batchUpsertRecordsRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#batchUpsertRecords");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection to upsert the records in, e.g. `my-collection`.
batchUpsertRecordsRequest BatchUpsertRecordsRequest

Return type

BatchUpsertRecordsResponse

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

deleteRecord

Object deleteRecord(collectionId, deleteRecordRequest)

Delete record

Delete a record with the given key.

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection that contains the record to delete, e.g. `my-collection`.
    DeleteRecordRequest deleteRecordRequest = new DeleteRecordRequest(); // DeleteRecordRequest | 
    try {
      Object result = apiInstance.deleteRecord(collectionId, deleteRecordRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#deleteRecord");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection that contains the record to delete, e.g. `my-collection`.
deleteRecordRequest DeleteRecordRequest

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

getRecord

Object getRecord(collectionId, getRecordRequest)

Get record

Retrieve a record with the given key.

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection that contains the record to retrieve, e.g. `my-collection`.
    GetRecordRequest getRecordRequest = new GetRecordRequest(); // GetRecordRequest | 
    try {
      Object result = apiInstance.getRecord(collectionId, getRecordRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#getRecord");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection that contains the record to retrieve, e.g. `my-collection`.
getRecordRequest GetRecordRequest

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

updateRecord

Object updateRecord(collectionId, updateRecordRequest)

Update record

Add or update specific fields within a record with the given values. The updated record is returned in the response. To replace all fields in a record, you should use the UpsertRecord call. Note that the update record call cannot be used to add or update indexed or unique fields. For this case use the UpsertRecord call.

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection that contains the record to update, e.g. `my-collection`.
    UpdateRecordRequest updateRecordRequest = new UpdateRecordRequest(); // UpdateRecordRequest | 
    try {
      Object result = apiInstance.updateRecord(collectionId, updateRecordRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#updateRecord");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection that contains the record to update, e.g. `my-collection`.
updateRecordRequest UpdateRecordRequest

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

upsertRecord

UpsertRecordResponse upsertRecord(collectionId, upsertRecordRequest)

Upsert record

If the record does not exist in the collection it is inserted. If it does exist it is updated. If no pipeline is specified, the default record pipeline is used to process the record. If the record is inserted, the response contains the key of the inserted record. You can use this if you need to retrieve or delete the record. If the record is updated, the response does not contain a key. Callers can use this as a signal to determine if the record is inserted/created or updated. For example, to add a single product from your ecommerce store to a collection, use the following call: ```json { "pipeline": { "name": "my-pipeline", "version": "1" }, "record": { "id": "54hdc7h2334h", "name": "Smart TV", "price": 1999, "brand": "Acme", "description": "...", "in_stock": true } } ```

Example

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

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

    RecordsApi apiInstance = new RecordsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | The collection to upsert the record in, e.g. `my-collection`.
    UpsertRecordRequest upsertRecordRequest = new UpsertRecordRequest(); // UpsertRecordRequest | 
    try {
      UpsertRecordResponse result = apiInstance.upsertRecord(collectionId, upsertRecordRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RecordsApi#upsertRecord");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
collectionId String The collection to upsert the record in, e.g. `my-collection`.
upsertRecordRequest UpsertRecordRequest

Return type

UpsertRecordResponse

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