collection.get
Get a Collection.
Request Parameters
| collection_id | int (required) |
Id for the collection you want to get.
Response Parameters
| collection_id | int |
Collection Id
| name | String |
Name of the collection.
| description | String |
| language | String |
The language for which the collection can store texts.
| next_id | int |
The next id a text created in the collection will get.
Code Examples
JSON
//Request
{
"method":"collection.get",
"params":{
"collection_id":"2"
},
"id":0
}
//Response
{
"id":0,
"result":{
"collection_id":2,
"description":"",
"name":"Example Collection",
"next_id":3,
"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 handle all Collection operations
SaploCollectionManager collectionMgr = new SaploCollectionManager(client);
// Assuming you know the collectionId you want to retrieve
SaploCollection collection = new SaploCollection();
collection.setId(id);
collectionMgr.get(collection);
// Your collection object's attributes get populated by the API
System.out.println(collection.getName());
System.out.println(collection.getDescription());
System.out.println(collection.getNextId());
// etc
PHP
$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");
$params = array(
"collection_id" => 2
);
try {
$result = $client->collection->get($params);
} catch(SaploException $e) {
echo '(' . $e->getCode() . ') ' . $e->getMessage();
}
var_dump($result);
Python
client = SaploJSONClient("YOUR API KEY", "YOUR SECRET KEY")
collection = client.collection.get(
collection_id=678
)
print "Retrieved collection:", collection
cURL
curl -d '{"method":"collection.get","params":{"collection_id":"2"}, "id":0}' 'http://api.saplo.com/rpc/json?access_token=AT8334226834920397662'
Matlab
params.collection_id = 2131;
response = saploRequest('collection.get', params)