Skip to content
Last updated

GetProjects

Obtain orders matching the passed criteria

Request Parameters

ParameterTypeDescriptionRequired
actionstring"GetProjects"Required
limitstartintThe offset for the returned project data (default: 0).Optional
limitnumintThe number of records to return (default: 25).Optional
useridintA specific client ID to find projects for.Optional
titlestringA specific title to find projects for.Optional
ticketidsstringSpecific ticket IDs to find projects for.Optional
invoiceidsstringSpecific invoice IDs to find projects for.Optional
notesstringSpecific notes to find projects for.Optional
adminidintA specific admin ID to find projects for.Optional
statusstringA specific status to find projects for.Optional
createdstringA specific creation date to find projects for.Optional
duedatestringA specific due date to find projects for.Optional
completedboolWhether to find projects that are or aren't completed.Optional
lastmodifiedstringA specific last modified date to find projects for.Optional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error
totalresultsintThe total number of results available.
startnumberintThe starting number for the returned results.
numreturnedintThe number of results returned.
invoicesarrayAn array of invoices matching the passed criteria.

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'GetProjects',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'GetProjects';
$postData = array(
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "result": "success",
    "totalresults": 1,
    "startnumber": 0,
    "numreturned": 1,
    "projects": [
        {
            "id": 1,
            "userid": 0,
            "title": "First Project",
            "ticketids": "",
            "invoiceids": "",
            "notes": "",
            "adminid": 1,
            "status": "Pending",
            "created": "2020-06-24",
            "duedate": "2020-06-24",
            "completed": 0,
            "lastmodified": "2020-06-24 10:26:23",
            "watchers": ""
        }
    ]
}

Version History

VersionChangelog
1.0Initial Version