WHMCS API CreateToDo

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.

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.

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

4 replies

Trackbacks & Pingbacks

  1. […] hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks […]

  2. […] hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks […]

  3. […] module need the WHMCS API CreateToDo to work […]

  4. […] sure you have the CreateToDo API installed otherwise this hook will not […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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