Unindex a document


DELETE https://bezillion.com/api/v1/unindexfile/id?login=&password=

id is the unique identifier of a file in your index, e.g. 12345678-9abc-def0-1234-56789abcdef0.

loginYour identification code.
passwordYour password.

NOTE: A POST is accepted.

You can test this function in the interface of your personal space.




 1 • 

2022-11-28 02:00 45 en fox.txt

The quick brown fox
jumps over
the lazy dog.

Select files. Click on the trash can to remove them from the index.

The quick brown fox
jumps over
the lazy dog.

Index the file:

$ curl -s --fail --show-error -X POST "https://bezillion.com/api/v1/indexfile?login=abcdef&password=ABCDEF" -F "file=@fox.txt" -o -

Look for the file fox.txt:

$ curl -s --fail --show-error -X GET "https://bezillion.com/api/v1/searchindex?login=abcdef&password=ABCDEF&fq=file:fox.txt"

Note the identifier of the file returned in the field id: 12345678-9abc-def0-1234-56789abcdef0.

Remove the file from your the index:

$ curl -s --fail --show-error -X DELETE "https://bezillion.com/api/v1/unindexfile/12345678-9abc-def0-1234-56789abcdef0?login=abcdef&password=ABCDEF"

If the identifier of the file is invalid, the service returns the error HTTP/1.1 400 Bad Request.

If no file in your index has the specified identifier, the service doesn't return an error.

Download the code of the senddelete function from the iZend library. Copy the file in the space of your application.

NOTE: See the page Call the service API for a description of the senddelete function.

Add the file unindexfile.php with the following content:

  1. require_once 'sendhttp.php';

Loads the code of the senddelete function.

  1. function unindexfile($login, $password, $id) {

Defines the function unindexfile. $login is your identification code. $password is your password. $id is the unique identifier of a file in your index.

  1.     $curl = 'https://bezillion.com/api/v1/unindexfile/' . $id . '?' . 'login=' . urlencode($login) . '&' . 'password=' . urlencode($password);

Sets $curl to the URL of the unindexfile action of the API with the identifier of the file, the identification code and the password of the user's account. $login and $password must be escaped.

  1.     $response=senddelete($curl);

Sends the HTTP request with senddelete. The arguments $id, login and password are already in $curl.

  1.     if (!$response or $response[0] != 200) {
  2.         return false;
  3.     }

If $response is false, the server is unreachable. If $response[0] doesn't contain the HTTP return code 200 Ok, an execution error has occurred. In case of error, unindexfile returns false.

  1.     return true;
  2. }

Returns true if the document has been removed from your index.


Assuming you have saved the files sendhttp.php and unindexfile.php in the current directory, run PHP in interactive mode, load the unindexfile function and call it with as arguments your identification code and password, the id of the file to remove from your index:

$ php -a
php > require_once 'unindexfile.php';
php > $r=unindexfile('abcdef', 'ABCDEF', '12345678-9abc-def0-1234-56789abcdef0');
php > echo $r ? 'Ok' : 'Ko';
php > quit

NOTE: If unindexfile returns false, edit the code to display $response.


Call the service API, Index a document, Search for a document


To add a comment, click here.