group.deleteText
Delete a text from a group. Returns a true if it was a success else throws an exception.
Request Parameters
| group_id | int (required) |
The group id to which the text will be added. Group and Text must use the same language.
| collection_id | int (required) |
The collection id where the text is stored.
| text_id | int (required) |
Id of text to delete from the group.
| ext_text_id | String |
If you have provided your own ext_text_id when adding texts to a collection this can be used. Though text_id always has priority over ext_text_id.
Response Parameters
| success | boolean |
Indicates whether the request was successful.
Code Examples
JSON
//Request
{
"method":"group.deleteText",
"params":{
"group_id":744,
"collection_id":607,
"text_id":3
},
"id":0
}
//Response
{
"id":0,
"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 SaploGroupManager to work with groups
SaploGroupManager groupMgr = new SaploGroupManager(client);
// Assuming you know the ID of the group you want to add text to
SaploGroup group = new SaploGroup();
group.setId(groupId);
// Assuming you already have a text object saved in the API,
// with id and SaploCollection elements
// Delete the text from the group
boolean isOk = groupMgr.deleteText(group, text);
// Print the result
if(isOk)
System.out.println("Text " + text.getId()
+ " successfully deleted from group " + group.getId());
else
System.out.println("Failure");
PHP
$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");
$params = array(
'group_id' => 21,
'collection_id' => 606,
'text_id' => 11
);
try {
$result = $client->group->delete_text($params);
} catch(SaploException $e) {
echo '(' . $e->getCode() . ') ' . $e->getMessage();
}
var_dump($result);
Python
client = SaploJSONClient("YOUR API KEY", "YOUR SECRET KEY")
removed_text = client.group.delete_text(
group_id=787,
collection_id=678,
text_id=1
)
print "Succesfully deleted text from group."
Matlab
params.group_id = 415;
params.collection_id = 2131;
params.text_id = 2;
response = saploRequest('group.deleteText', params)