collection.list

List all collections you have access to.
Returns a JSONArray named "collections" containing collection objects and the permission (read/write).

Request Parameters

(none)

Response Parameters

collection_idint
The id of collection.
nameString
The name of the collection.
languageString

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

descriptionString
Description of the collection.
permissionString
The permission you have to the collection. Values may be "read" or "write".
next_idint

The next id a text created in the collection will get.

Code Examples

JSON

//Request
{
  "method":"collection.list", 
  "params":{}, 
  "id":0
}

//Response
{
  "id":0,
  "result":{
    "collections":[{
        "collection_id":606,
        "name":"My Collection", 
        "description":"English Blog Posts.", 
        "permission":"write",
        "language":"en"
      },
      {
        "collection_id":607,
        "name":"My Swedish Collection", 
        "description":"Swedish Blog Posts.", 
        "permission":"write", 
        "language":"sv"
      }]
  }
}

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);

// Get a list of all your collections in a List
List<SaploCollection> collectionList = collectionMgr.list();

// Print them out
for(SaploCollection col : collectionList)
    System.out.println(col.toString());

PHP


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

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

var_dump($result);

Python


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

collection_list = client.collection.list()

print "Listing all your collections:", collection_list

Matlab

response = saploRequest('collection.list')