Api clients / Ruby / V1 / Methods

Delete Objects | Ruby API Client V1 (Deprecated)

This version of the Ruby API client has been deprecated in favor of the latest version of the Ruby API client.

Required API Key: any key with the deleteObject ACL
Method signature
index.delete_objects(Array objectIds)
index.delete_objects(Array objectIds, request_options=Hash)

# delete a single object
index.delete_object(String objectID)
index.delete_object(String objectID, request_options=Hash)

About this method

Remove objects from an index using their object ids.

This method enables you to remove one or more objects from an index.

There are 2 methods available to delete objects:

  • this one, which uses an objectID to identify objects
  • and delete by, which uses filters to identify objects

Note: This method also has a singular version.

Examples

Delete multiple objects using their objectIDs

1
$index->deleteObjects(["myID1", "myID2"]);

Delete a single object

1
$index->deleteObject('myID');

Delete multiple objects and send extra HTTP headers

1
2
3
4
5
$objectIDs = [/* objectIDs */];

$index->deleteObjects($objectIDs, [
  'X-Forwarded-For' => '94.228.178.246'
]);

Parameters

objectIDs
type: list
Required

List of objectIDs to delete.

requestOptions
type: key/value mapping
default: No request options
Optional

A mapping of request options to send along with the query.

objectID
type: integer|string
Required

The objectID of the object to delete.

Response

In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.

JSON format

1
2
3
4
5
6
7
{
  "objectIDs": [
    "myObjectID1",
    "myObjectID2"
  ],
  "taskID": 678,
}
objectIDs
list

List of the objectIDS of the deleted objects.

taskID
integer

The taskID used with the waitTask method.

Did you find this page helpful?