For some reasons WHMCS has a UpdateToDoItem to be able to update a todo as well as GetToDoList and GetToDoItemStatuses to manage todo using API, but not a CreateToDo API function.
Because of this reason we just decided to create a custom API to create a ToDo record.
To use it you have to upload the createtodo.php (all lowercase) into the /includes/api whmcs folder and it's done.$19 - Download Now
|title||string||The title for your newly created ToDo. Defaults to "ToDo"||Optional|
|description||string||The description of your ToDo||Required|
|date||\Carbon\Carbon||The date that the ToDo should show as created YYYY-mm-dd||Optional|
|admin||int||The ID of the admin you want to assign the ToDO to||Optional|
|status||string||The status of your ToDo, defaults to "In Progress". You have to choose between: New, Pending, In Progress, Postponed, Completed||Optional|
|duedate||\Carbon\Carbon||The due date of the newly created ToDo YYYY-mm-dd||Optional|
|result||string||The result of the operation: success or error|
Given the recent changes in WHMCS custom API work only with the Local API function.
$command = 'CreateToDo'; $postData = array( 'title' => 'New todo', 'description' => 'Description', 'date' => '2017-01-01', 'admin' => 'ADMIN_ID', 'status' => 'In Progress', 'duedate' => '2017-01-01', ); $adminUsername = 'ADMIN_USERNAME'; $results = localAPI($command, $postData, $adminUsername); print_r($results);
Array ( [result] => success, [message] => ToDo Added Successfully )
At the moment the only error response is:
Got questions or problems? Contact us or comment, we'll be happy to help.