collection.delete

Delete a collection.

Warning! Deleting a collection will delete all texts in that collection including results and relations to groups.

Request Parameters

collection_idint (required)

The collection you want to delete

Response Parameters

successboolean

Returns True if it was a success else it throws an error code.

Code Examples

JSON

//Request
{"id":1, "method":"collection.delete","params":{"collection_id":2}}

//Response
{"id":1,"result":{"success":true}}

Java

// 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 delete
SaploCollection collection = new SaploCollection();
collection.setId(collectionId);

// Delete the collection from the API
collectionMgr.delete(collection);

PHP

$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");
  
$params = array(
    "collection_id" => 2
);
 
try {
    $result = $client->collection->delete($params);
} catch(SaploException $e) {
    echo '(' . $e->getCode() . ') ' . $e->getMessage()";
}
   
var_dump($result);

Python

client = SaploJSONClient("YOUR API KEY", "YOUR SECRET KEY")
 
deleted_text = client.collection.delete(
            collection_id=678
            )
 
print "Successfully deleted collection."

Matlab

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