This comand is used to get a list of Files from WHMCSPM2
Attributes
reltype - required, project or task relid - taskid or projectid fileid - Optional file id to return one file limitstart - Optional start at which result (default 0) limitnum - Optional limit at how many results (default 25)
Example Command
$postfields["action"] = "whmcspm2getfiles"; $postfields["reltype"] = "project"; $postfields["relid"] = "21";
Returned Variables
action result - error / success totalresults startnumber numreturned files - array of files converted to xml, json or NVP - file - id - name - mime - type - size - description - location - uploaded_name - download_count - clientviewable - created_date - modified_date - customfields
XML Example:
<whmcsapi> <action>whmcspm2getfiles</action> <result>success</results> <totalresults>2</totalresults> <startnumber>0</startnumber> <numreturned>2</numreturned> <files> <file> <id>10</id> <name>Master Agreement</name> <mime>application/pdf</mime> <type>pdf</type> <size>178212</size> <description>Signed Master Agreement</description> <location>cab08dc0880e879bd90a995fbbd22d96.pdf</location> <uploaded_name>master_00123_acmeinc.pdf</uploaded_name> <download_count>3</download_count> <clientviewable>1</clientviewable> <created_date>2011-11-19 16:44:58</created_date> <modified_date>2011-11-19 16:44:58</modified_date> <customfields> <customfield> <id>1</id> <value>Test Field1</value> </customfield> <customfield> <id>3</id> <value>Test Field2</value> </customfield> <customfield> <id>7</id> <value>Test Field3</value> </customfield> </customfields> </file> <file> <id>12</id> <name>Project Change Request</name> <mime>application/pdf</mime> <type>pdf</type> <size>888712</size> <description>Customer change request for project</description> <location>e90cf1fd2b86579f74f4a3ae039207a2.pdf</location> <uploaded_name>changereq_0123_acmeinc.pdf</uploaded_name> <download_count>1</download_count> <clientviewable>1</clientviewable> <created_date>2011-11-19 16:51:54</created_date> <modified_date>2011-11-19 16:51:54</modified_date> <customfields></customfields> </file> </files> </whmcsapi>
JSON Example:
{ "result":"success", "totalresults":2, "startnumber":0, "numreturned":2, "files":{ "file":[ { "id":"10", "name":"Master Agreement", "mime":"application/pdf", "type":"pdf", "size":"178212", "description":"Signed Master Agreement", "location":"cab08dc0880e879bd90a995fbbd22d96.pdf", "uploaded_name":"master_00123_acmeinc.pdf", "download_count":"3", "clientviewable":"1", "created_date":"2011-11-19 16:44:58", "modified_date":"2011-11-19 16:44:58", "customfields":{ "customfield":[ { "id":"1", "value":"Test Field1" }, { "id":"3", "value":"Test Field2" }, { "id":"7", "value":"Test Field3" } ] } }, { "id":"12", "name":"Project Change Request", "mime":"application/pdf", "type":"pdf", "size":"888712", "description":"Customer change request for project", "location":"e90cf1fd2b86579f74f4a3ae039207a2.pdf", "uploaded_name":"changereq_0123_acmeinc.pdf", "download_count":"1", "clientviewable":"1", "created_date":"2011-11-19 16:51:54", "modified_date":"2011-11-19 16:51:54", "customfields":null } ] } }
NVP Example:
Array ( [result] => success [totalresults] => 2 [startnumber] => 0 [numreturned] => 2 [files] => Array ( [file] => Array ( [0] => Array ( [id] => 10 [name] => Master Agreement [mime] => application/pdf [type] => pdf [size] => 178212 [description] => Signed Master Agreement [location] => cab08dc0880e879bd90a995fbbd22d96.pdf [uploaded_name] => master_00123_acmeinc.pdf [download_count] => 3 [clientviewable] => 1 [created_date] => 2011-11-19 16:44:58 [modified_date] => 2011-11-19 16:44:58 [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] => 12 [name] => Project Change Request [mime] => application/pdf [type] => pdf [size] => 888712 [description] => Customer change request for project [location] => e90cf1fd2b86579f74f4a3ae039207a2.pdf [uploaded_name] => changereq_0123_acmeinc.pdf [download_count] => 1 [clientviewable] => 1 [created_date] => 2011-11-19 16:51:54 [modified_date] => 2011-11-19 16:51:54 [customfields] => ) ) ) )