This comand is used to get a list of Categories from WHMCSPM2
Attributes
limitstart - Optional start at which result (default 0) limitnum - Optional limit at how many results (default 25) tasks - Optional display only task categories (1 or 0) projects - Optional display only project categories (1 or 0) adminonly - Optional display only admin categories (1 or 0)
Example Command
$postfields["action"] = "whmcspm2getcategories";
Returned Variables
action
result - error / success
totalresults
startnumber
numreturned
categories - array of categories converted to xml, json or NVP
- category
- id
- name
- description
- is_admindefault
- is_clientdefault
- is_task
- is_project
- position - display order
- is_adminonly
- rowbgcolor
- sbtextcolor
- sbbgcolor
XML Example:
<whmcsapi>
<action>whmcspm2getcategories</action>
<result>success</results>
<totalresults>3</totalresults>
<startnumber>0</startnumber>
<numreturned>3</numreturned>
<categories>
<category>
<id>1</id>
<name>Client Submitted</name>
<description>This is used for client submitted projects and tasks</description>
<is_admindefault>0</is_admindefault>
<is_clientdefault>1</is_clientdefault>
<is_task>1</is_task>
<is_project>1</is_project>
<position>1</position>
<is_adminonly>0</is_adminonly>
<rowbgcolor></rowbgcolor>
<sbtextcolor></sbtextcolor>
<sbbgcolor></sbbgcolor>
</category>
<category>
<id>2</id>
<name>General</name>
<description>This is a general category</description>
<is_admindefault>1</is_admindefault>
<is_clientdefault>0</is_clientdefault>
<is_task>1</is_task>
<is_project>1</is_project>
<position>2</position>
<is_adminonly>0</is_adminonly>
<rowbgcolor></rowbgcolor>
<sbtextcolor></sbtextcolor>
<sbbgcolor></sbbgcolor>
</category>
</categories>
</whmcsapi>
JSON Example:
{
"result":"success",
"totalresults":3,
"startnumber":0,
"numreturned":3,
"categories":{
"category":[
{
"id":"1",
"name":"Client Submitted",
"description":"This is used for client submitted projects and tasks",
"is_admindefault":"0",
"is_clientdefault":"1",
"is_task":"1",
"is_project":"1",
"position":"1",
"is_adminonly":"0",
"rowbgcolor":"",
"sbtextcolor":"",
"sbbgcolor":""
},
{
"id":"2",
"name":"General",
"description":"This is a general category",
"is_admindefault":"1",
"is_clientdefault":"0",
"is_task":"1",
"is_project":"1",
"position":"2",
"is_adminonly":"0",
"rowbgcolor":"",
"sbtextcolor":"",
"sbbgcolor":""
}
]
}
}
NVP Example:
Array
(
[result] => success
[totalresults] => 3
[startnumber] => 0
[numreturned] => 3
[categories] => Array
(
[category] => Array
(
[0] => Array
(
[id] => 1
[name] => Client Submitted
[description] => This is used for client submitted projects and tasks
[is_admindefault] => 0
[is_clientdefault] => 1
[is_task] => 1
[is_project] => 1
[position] => 1
[is_adminonly] => 0
[rowbgcolor] =>
[sbtextcolor] =>
[sbbgcolor] =>
)
[1] => Array
(
[id] => 2
[name] => General
[description] => This is a general category
[is_admindefault] => 1
[is_clientdefault] => 0
[is_task] => 1
[is_project] => 1
[position] => 2
[is_adminonly] => 0
[rowbgcolor] =>
[sbtextcolor] =>
[sbbgcolor] =>
)
)
)
)