function casetracker_xmlrpc_new_case in Case Tracker 5
XML-RPC handler; creates a new case based on incoming values.
The XML-RPC client is responsible for passing a $data array that is a valid Drupal $node, with all the relevant keys created (if this is an event case, event keys must exist; if CCK or Flexinode, admin-created keys must exist and have values, etc.). $data is passed directly to node_save() without validation/modification. This DOES force knowledge of the $node structure onto the XML-RPC client, but allows much more flexibility (on the client end, which can decide if an item should be published, promoted, etc., etc., etc.).
@todo We should at least check that the passed node type is one of our valid case tracker node types, and/or check for other case-related values (like status IDs and so forth). Who wants to fund that, HmMMmM?
1 string reference to 'casetracker_xmlrpc_new_case'
- casetracker_xmlrpc_xmlrpc in ./
casetracker_xmlrpc.module - Implementation of hook_xmlrpc().
File
- ./
casetracker_xmlrpc.module, line 48 - Enables Case Tracker cases to be created via XML-RPC.
Code
function casetracker_xmlrpc_new_case($username, $password, $data) {
$user = casetracker_xmlrpc_validate_user($username, $password);
if (!$user->uid) {
return casetracker_xmlrpc_error($user);
}
$data = (object) $data;
node_save($data);
// force to object.
return t('Your data was accepted and submitted as a node.');
}