collection.update

Update an existing collection.

Request Parameters

collection_idint (required)
Id for collection to update.
nameString
New collection name.
descriptionString
New collection description.

Response Parameters

collection_idint
The id for your collection.
nameString
The name of the collection.
descriptionString
Description of the collection.
languageString

The language allowed for texts stored in the collection. Specified according to ISO 639-1

Code Examples

JSON

//Request
{
  "method":"collection.update", 
  "params":{"name":"My Text Collection", "description":"Collection for english blog posts", 
  "collection_id":606}, 
  "id":0
}

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

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 already have the collection you want to update, 
// with a valid collectionId
collection.setName("NEW_NAME");
collection.setDescription("UPDATED_COLLECTION");

// To apply the changes, call the manager's "update" method
collectionMgr.update(collection);

PHP


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

$params = array(
    "collection_id" => 1,
    "name" => "My Updated Collection Name"
);

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

var_dump($result);

Python


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

updated_collection = client.collection.update(
                    collection_id=678,
                    name="New Name",
                    description="New Description"
                    )

print "Updated collection:", updated_collection

Matlab

params.collection_id = 2131;
params.name = 'Updated collection name';

response = saploRequest('collection.update', params)