Api clients / JavaScript / V3 / Methods

Delete Objects | JavaScript API Client V3 (Deprecated)

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

Required API Key: any key with the deleteObject ACL
Method signature
index.deleteObjects(array objectIds, callback)

index.deleteObject(string objectID, callback) // delete a single object

About this method# A

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# A

Delete multiple objects using their objectIDs#

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

Delete a single object#

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

Delete multiple objects and send extra HTTP headers#

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

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

Parameters# A

objectIDs #
type: list
Required

List of objectIDs to delete.

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

A mapping of [`requestOptions`](/doc/api-client/getting-started/request-options/) to send along with the query.

objectID #
type: integer|string
Required

The objectID of the object to delete.

Response# A

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?