Get Tasks

This comand is used to get a list of Tasks from WHMCSPM2

Attributes

taskid - option id of single task to get results of
projectid - optional id of project to get tasks for
limitstart - Optional start at which result (default 0)
limitnum - Optional limit at how many results (default 25)
adminid - Optional search for a particular admin's tasks
status - Optional search for a particular status
priority - Optional search for a particular priority
category - Optional search for a particular category

Example Command

$postfields["action"] = "whmcspm2gettasks";

Returned Variables

action
result - error / success
totalresults
startnumber
numreturned
tasks - array of tasks converted to xml, json or NVP
    - task
        - id
        - name
        - description
        - status
        - category
        - priority
        - readonly
        - private
        - admin_email_ok
        - client_email_ok
        - assigned
        - startdate
        - enddate
        - complete
        - segment
        - project
        - billableitemid
        - billablerate
        - billabledescription
        - calendarid (id of calendar entry)
        - customfields

XML Example:

<whmcsapi>
    <action>whmcspm2gettasks</action>
    <result>success</results>
    <totalresults>2</totalresults>
    <startnumber>0</startnumber>
    <numreturned>2</numreturned>
    <tasks>
        <task>
            <id>33</id>
            <name>Sample API Task</name>
            <description>A Description would go here!</description>
            <status>3</status>
            <category>1</category>
            <priority>12</priority>
            <readonly>1</readonly>
            <private>0</private>
            <admin_email_ok>0</admin_email_ok>
            <client_email_ok>1</client_email_ok>
            <assigned>1</assigned>
            <startdate>2011-09-29</startdate>
            <enddate>2011-11-13</enddate>
            <complete>75</complete>
            <segment>15</segment>
            <project>10</project>
            <billableitemid>75</billableitemid>
            <billablerate></billablerate>
            <billabledescription></billabledescription>
            <calendarid>123</calendarid>
            <customfields>
                <customfield>
                    <id>1</id>
                    <value>Test Field 1</value>
                </customfield>
                <customfield>
                    <id>3</id>
                    <value>Test Field 2</value>
                </customfield>
                <customfield>
                    <id>7</id>
                    <value>Test Field 3</value>
                </customfield>
            </customfields>
        </task>
        <task>
            <id>44</id>
            <name>Sample API Task Too</name>
            <description>A Description would go here!</description>
            <status>4</status>
            <category>3</category>
            <priority>7</priority>
            <readonly>0</readonly>
            <private>1</private>
            <admin_email_ok>1</admin_email_ok>
            <client_email_ok>0</client_email_ok>
            <assigned>3</assigned>
            <startdate>2011-10-29</startdate>
            <enddate>2011-11-22</enddate>
            <complete>55</complete>
            <segment>35</segment>
            <project>12</project>
            <billableitemid></billableitemid>
            <billablerate>25.00</billablerate>
            <billabledescription>Sample Custom Billable Item</billabledescription>
            <calendarid>222</calendarid>
            <customfields></customfields>
        </task>
    </tasks>
</whmcsapi>

JSON Example:

{
	"result":"success",
	"totalresults":2,
	"startnumber":0,
	"numreturned":2,
	"tasks":{
		"task":[
			{
				"id":"33",
				"name":"Sample API Task",
				"description":"A Description would go here!",
				"status":"3",
				"category":"1",
				"priority":"12",
				"readonly":"1",
				"private":"0",
				"admin_email_ok":"0",
				"client_email_ok":"1",
				"assigned":"1",
				"startdate":"2011-09-29",
				"enddate":"2011-11-13",
				"complete":"75",
				"segment":"15",
				"project":"10",
				"billableitemid":"75",
				"billablerate":"",
				"billabledescription":"",
				"calendarid":"123",
				"customfields":{
					"customfield":[
						{
							"id":"1",
							"value":"Test Field 1"
						},
						{
							"id":"3",
							"value":"Test Field 2"
						},
						{
							"id":"7",
							"value":"Test Field 3"
						}
					]
				}
			},
			{
				"id":"44",
				"name":"Sample API Task Too",
				"description":"A Description would go here!",
				"status":"4",
				"category":"3",
				"priority":"7",
				"readonly":"0",
				"private":"1",
				"admin_email_ok":"1",
				"client_email_ok":"0",
				"assigned":"3",
				"startdate":"2011-10-29",
				"enddate":"2011-11-22",
				"complete":"55",
				"segment":"35",
				"project":"12",
				"billableitemid":"",
				"billablerate":"25.00",
				"billabledescription":"Sample Custom Billable Item",
				"calendarid":"222",
				"customfields":""
			}
		]
	}
}

NVP Example:

Array
(
    [result] => success
    [totalresults] => 2
    [startnumber] => 0
    [numreturned] => 2
    [tasks] => Array
        (
            [task] => Array
                (
                    [0] => Array
                        (
                            [id] => 33
                            [name] => Sample API Task
                            [description] => A Description would go here!
                            [status] => 3
                            [category] => 1
                            [priority] => 12
                            [readonly] => 1
                            [private] => 0
                            [admin_email_ok] => 0
                            [client_email_ok] => 1
                            [assigned] => 1
                            [startdate] => 2011-09-29
                            [enddate] => 2011-11-13
                            [complete] => 75
                            [segment] => 15
                            [project] => 10
                            [billableitemid] => 75
                            [billablerate] => 
                            [billabledescription] => 
                            [calendarid] => 123
                            [customfields] => Array
                                (
                                    [customfield] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [id] => 1
                                                    [value] => Test Field 1
                                                )

                                            [1] => Array
                                                (
                                                    [id] => 3
                                                    [value] => Test Field 2
                                                )

                                            [2] => Array
                                                (
                                                    [id] => 7
                                                    [value] => Test Field 3
                                                )

                                        )

                                )

                        )

                    [1] => Array
                        (
                            [id] => 44
                            [name] => Sample API Task Too
                            [description] => A Description would go here!
                            [status] => 4
                            [category] => 3
                            [priority] => 7
                            [readonly] => 0
                            [private] => 1
                            [admin_email_ok] => 1
                            [client_email_ok] => 0
                            [assigned] => 3
                            [startdate] => 2011-10-29
                            [enddate] => 2011-11-22
                            [complete] => 55
                            [segment] => 35
                            [project] => 12
                            [billableitemid] => 
                            [billablerate] => 25.00
                            [billabledescription] => Sample Custom Billable Item
                            [calendarid] => 222
                            [customfields] => 
                        )

                )

        )

)
Was this answer helpful? 0 Users Found This Useful (41 Votes)