group.create

Create a new text group.
Returns the created group as json object.

Request Parameters

nameString (required)

The name of the group. Must be unique for your user. Maximum 100 chars.

languageString (required)
The language the group will work on. A group can only contain and relate to texts using the same language. English and Swedish are supported and specified according to ISO 639-1. Swedish = "sv", English = "en".
descriptionString

Provide a description for your new text group. Maximum 250 chars.

Response Parameters

group_idint
Id for created group.
nameString
Name of created group.
descriptionString
Description of created group.
languageString
The language the group works on.
date_createdString

Date when the group was created in ISO 8601 format. (YYYY-MM-DDTHH:mm:ss+00:00)

date_updatedString

Date when the group was last updated (e.g. text added/deleted) in ISO 8601 format. (YYYY-MM-DDTHH:mm:ss+00:00)

Code Examples

JSON

//Request
{
  "method":"group.create", 
  "params":{
    "name":"My Tech Group",
    "language":"en"
  },
  "id":0
 }

//Response
{ 
 "id":0,
 "result":{
    "group_id":13,
    "name":"My Tech Group",
    "language":"en",
    "description":"",
    "date_created":"2011-03-30T10:31:33+00:00",
    "date_updated":"2011-07-15T22:11:06+00:00",
  }
}

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 SaploGroupManager to work with groups
SaploGroupManager groupMgr = new SaploGroupManager(client);

// Create a new SaploGroup object
SaploGroup group = new SaploGroup("MY_GROUP_NAME", Language.en);

// Save the group into the API
groupMgr.create(group);

// Your group has an ID element now
System.out.println("GroupId: " + group.getId());

PHP


$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");
 
$params = array(
    "name" => "Technology",
    "description" => "Grouping texts about technology",
    "language" => "en"
);

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

Python


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

group = client.group.create(
                    name="Group Example",
                    description="Example Description",
                    language="en"
                    )

print "Created new group with Id:", group

Matlab

params.name = 'My personal group';
params.language = 'en';
 
response = saploRequest('group.create', params)

Notes

Was named 'Context' in API v1