WHMCS API CreateToDo

February 25, 2020

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.

You can use it as a standard WHMCS API. You may want to use it with internal API function or using CURL. In this case WHMCS documentation is helpful so no more explanations are required.

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

Parameters

ParameterTypeDescriptionRequired
titlestringThe title for your newly created ToDo. Defaults to "ToDo"Optional
descriptionstringThe description of your ToDoRequired
date\Carbon\CarbonThe date that the ToDo should show as created YYYY-mm-ddOptional
adminintThe ID of the admin you want to assign the ToDO toOptional
statusstringThe status of your ToDo, defaults to "In Progress". You have to choose between: New, Pending, In Progress, Postponed, CompletedOptional
duedate\Carbon\CarbonThe due date of the newly created ToDo YYYY-mm-ddOptional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error

Example request (CURL)

Given the recent changes in WHMCS custom API work only with the Local API function.

Example Request (Local API)

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

Example Response

Array (
 [result] => success,
 [message] => ToDo Added Successfully
 )

Error Responses

At the moment the only error response is:

  • The description is undefined.
$19 - Download Now

Got questions or problems? Contact us or comment, we'll be happy to help.

4 comments on “WHMCS API CreateToDo”

Leave a Reply

Your email address will not be published. Required fields are marked *

usersspell-checksmile