Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt

This function combines calls for multiple WHM API 1 functions.

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleJSON API
Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/batch?api.version=1&command=gethostname&command=version&command=editquota%3Fapi.version%3D1%26user%3Dusername%26quota%3D500&command=set_digest_auth%3Fuser%3Dusername%26password%3D12345luggage%26enabledigest%3D1
Expand
titleXML API
Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/batch?api.version=1&command=gethostname&command=version&command=editquota%3Fapi.version%3D1%26user%3Duser%26quota%3D500&command=set_digest_auth%3Fuser%3Dusername%26password%3D12345luggage%26enabledigest%3D1
Expand
titleCommand Line
Code Block
languagebash
whmapi1 batch command=gethostname command=version command=gethostname command=version command=editquota?api.version=1&user=user&quota=500 command=set_digest_auth?user=username&password=12345luggage&enabledigest=1

Include Page
_WHMAPI1CLINote
_WHMAPI1CLINote

Expand
titleOutput (JSON)
Code Block
languagetext
linenumberstrue
{  
   "data":{  
      "result":[  
         {  
            "metadata":{  
               "version":1,
               "reason":"OK",
               "command":"gethostname",
               "result":1
            },
            "data":{  
               "hostname":"example-hosting.com"
            }
         },
         {  
            "metadata":{  
               "version":1,
               "reason":"OK",
               "command":"version",
               "result":1
            },
            "data":{  
               "version":"11.46.0.1"
            }
         }
      ]
   },
   "metadata":{  
      "version":1,
      "reason":"OK",
      "result":1,
      "command":"batch"
   }
}
Expand
titleOutput (XML)
Code Block
languagexml
linenumberstrue
<result>
    <data>
        <result>
            <metadata>
                <version>1</version>
                <reason>OK</reason>
                <command>gethostname</command>
                <result>1</result>
            </metadata>
            <data>
                <hostname>example-hosting.com</hostname>
            </data>
        </result>
        <result>
            <metadata>
                <version>1</version>
                <reason>OK</reason>
                <command>version</command>
                <result>1</result>
            </metadata>
            <data>
                <version>11.46.0.1</version>
            </data>
        </result>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>batch</command>
    </metadata>
</result> 

Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote

   

Parameters

ParameterTypeDescriptionPossible valuesExample
commandstring

Required

A WHM API 1 function to call.

Warning
titleImportant:

Specify a command parameter for each function.

 

 

Any WHM API 1 function.

Include the function's input parameters as a URI-encoded list after the function name.

For example, to call the killdns function with a domain parameter value of example.com, assign the following value to a command parameter:

Code Block
languagetext
killdns%3Fdomain%3Dexample.com
Note
titleNote:

You can call the same function multiple times within a single batch API call.

For example:

Code Block
languagetext
/json-api/batch?api.version=1&command=version&command=version&command=version
version

 

Returns

ReturnTypeDescriptionPossible valuesExample

result

hash

A hash of function output.

Each result hash contains the returns from one of the command parameter's functions.

For information about each function's returns, read the function's documentation.