Skip to content

Latest commit

 

History

History
402 lines (292 loc) · 16 KB

RecordsApi.md

File metadata and controls

402 lines (292 loc) · 16 KB

Sajari\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()

batchUpdateRecords($collection_id, $batch_update_records_request): \Sajari\Model\BatchUpdateRecordsResponse

Batch update records

The batch version of the UpdateRecord call.

Example

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection that contains the records to update, e.g. `my-collection`.
$batch_update_records_request = new \Sajari\Model\BatchUpdateRecordsRequest(); // \Sajari\Model\BatchUpdateRecordsRequest

try {
  $result = $apiInstance->batchUpdateRecords(
    $collection_id,
    $batch_update_records_request
  );
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->batchUpdateRecords: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection that contains the records to update, e.g. `my-collection`.
batch_update_records_request \Sajari\Model\BatchUpdateRecordsRequest

Return type

\Sajari\Model\BatchUpdateRecordsResponse

Authorization

BasicAuth

HTTP request headers

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

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

batchUpsertRecords()

batchUpsertRecords($collection_id, $batch_upsert_records_request): \Sajari\Model\BatchUpsertRecordsResponse

Batch upsert records

The batch version of the UpsertRecord call.

Example

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection to upsert the records in, e.g. `my-collection`.
$batch_upsert_records_request = new \Sajari\Model\BatchUpsertRecordsRequest(); // \Sajari\Model\BatchUpsertRecordsRequest

try {
  $result = $apiInstance->batchUpsertRecords(
    $collection_id,
    $batch_upsert_records_request
  );
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->batchUpsertRecords: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection to upsert the records in, e.g. `my-collection`.
batch_upsert_records_request \Sajari\Model\BatchUpsertRecordsRequest

Return type

\Sajari\Model\BatchUpsertRecordsResponse

Authorization

BasicAuth

HTTP request headers

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

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

deleteRecord()

deleteRecord($collection_id, $delete_record_request): mixed

Delete record

Delete a record with the given key.

Example

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection that contains the record to delete, e.g. `my-collection`.
$delete_record_request = new \Sajari\Model\DeleteRecordRequest(); // \Sajari\Model\DeleteRecordRequest

try {
  $result = $apiInstance->deleteRecord($collection_id, $delete_record_request);
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->deleteRecord: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection that contains the record to delete, e.g. `my-collection`.
delete_record_request \Sajari\Model\DeleteRecordRequest

Return type

mixed

Authorization

BasicAuth

HTTP request headers

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

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

getRecord()

getRecord($collection_id, $get_record_request): object

Get record

Retrieve a record with the given key.

Example

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection that contains the record to retrieve, e.g. `my-collection`.
$get_record_request = new \Sajari\Model\GetRecordRequest(); // \Sajari\Model\GetRecordRequest

try {
  $result = $apiInstance->getRecord($collection_id, $get_record_request);
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->getRecord: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection that contains the record to retrieve, e.g. `my-collection`.
get_record_request \Sajari\Model\GetRecordRequest

Return type

object

Authorization

BasicAuth

HTTP request headers

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

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

updateRecord()

updateRecord($collection_id, $update_record_request): object

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

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection that contains the record to update, e.g. `my-collection`.
$update_record_request = new \Sajari\Model\UpdateRecordRequest(); // \Sajari\Model\UpdateRecordRequest

try {
  $result = $apiInstance->updateRecord($collection_id, $update_record_request);
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->updateRecord: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection that contains the record to update, e.g. `my-collection`.
update_record_request \Sajari\Model\UpdateRecordRequest

Return type

object

Authorization

BasicAuth

HTTP request headers

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

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

upsertRecord()

upsertRecord($collection_id, $upsert_record_request): \Sajari\Model\UpsertRecordResponse

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

<?php
require_once __DIR__ . "/vendor/autoload.php";

// Configure HTTP basic authorization: BasicAuth
$config = Sajari\Configuration::getDefaultConfiguration()
  ->setUsername("YOUR_USERNAME")
  ->setPassword("YOUR_PASSWORD");

$apiInstance = new Sajari\Api\RecordsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
);
$collection_id = "collection_id_example"; // string | The collection to upsert the record in, e.g. `my-collection`.
$upsert_record_request = new \Sajari\Model\UpsertRecordRequest(); // \Sajari\Model\UpsertRecordRequest

try {
  $result = $apiInstance->upsertRecord($collection_id, $upsert_record_request);
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling RecordsApi->upsertRecord: ",
    $e->getMessage(),
    PHP_EOL;
}

Parameters

Name Type Description Notes
collection_id string The collection to upsert the record in, e.g. `my-collection`.
upsert_record_request \Sajari\Model\UpsertRecordRequest

Return type

\Sajari\Model\UpsertRecordResponse

Authorization

BasicAuth

HTTP request headers

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

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