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 NowParameter | Type | Description | Required |
---|---|---|---|
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 |
Parameter | Type | Description |
---|---|---|
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.
[…] sure you have the CreateToDo API installed otherwise this hook will not […]
[…] module need the WHMCS API CreateToDo to work […]
[…] hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks […]
[…] hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks […]