collection.reset

Reset a collection. If success it returns the collection, if it fails it throws an exception.

Warning! This method will remove all texts in the collection and all existing results. Text id counter in the collection will be reset. This method should NOT be used in a production flow since it is not synchronized between API requests/threads and can therefor cause un-sync between texts and results.

Request Parameters

collection_idint (required)

Collection to reset

Response Parameters

(none)

Code Examples

JSON

//Request
{
  "method":"collection.reset", 
  "params":{
    "collection_id":607
  }, 
  "id":0
}

//Response
{
  "collection_id": 607,
  "description": "Collection for english blog posts",
  "name": "My Text Collection", 
  "language": "en",
  "next_id": 1
}

Java

// NOTE: This method will remove all texts in the collection and all existing results.

// You need to have a ready-to-use client to use the other methods
SaploClient client = new SaploClient("YOUR_API_KEY", "YOUR_SECRET_KEY");

// Create a SaploCollectionManager to work with collections
SaploCollectionManager collectionMgr = new SaploCollectionManager(client);

// Assuming you know the ID of the collection you want to reset
SaploCollection collection = new SaploCollection();
collection.setId(collectionId);

// Reset
collectionMgr.reset(collection);

PHP


$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");

$params = array(
    "collection_id" => 1
);

try {
    $result = $client->collection->reset($params);
} catch(SaploException $e) {
    echo '(' . $e->getCode() . ') ' . $e->getMessage();
}
 
var_dump($result);

Python


client = SaploJSONClient("YOUR API KEY", "YOUR SECRET KEY")

reset_collection = client.collection.reset(
                collection_id=678,
                )

print "Successfully reseted corpus with properties: ", reset_collection

Matlab

params.collection_id = 2131;
 
response = saploRequest('collection.reset', params)