List of tags used in API |
---|
Description: It is used for sending XML Request. To apply any configuration this tag is necessary. API Version also needs to be specified for configurations to be applied successfully.
Usage:
Attribute – APIVersion
Attribute Value – Version of API used. For example: “1605.1”
Example:
<Request APIVersion=”1605.1”>
<Login>
<Username>admin</Username>
<Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password>
</Login>
</Request>
Description: It is used for Authentication.
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
Please refer the above example.
Description: Specify the username in this tag.
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
Please refer the above example.
Description: Specify the encrypted password in this tag.
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
Please refer the above example.
Description: It is used to inform that the request is to be served as Add/Update depending on the Attribute value.
Note: If, no “operation” attribute/value is defined in the tag, then Add operation will be performed followed by Update
Usage:
Attribute – operation
Attribute Value – Add/Update
Example:
<Request>
<Login>
<Username>admin</Username>
<Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password>
</Login>
<Set operation="add">
<IPHost>
<Name>CustomIPHostTypeIPV4</Name>
<IPFamily>IPv4</IPFamily>
<HostType>IP</HostType>
<IPAddress>1.1.1.1</IPAddress>
</IPHost>
</Set>
</Request>
Description: It is used to inform that the request needs to be served for retrieving data of the entity specified.
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
<Request>
<Login>
<Username>admin</Username>
<Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password>
</Login>
<Get>
<IPHost></IPHost>
</Get>
</Request>
Description: It is used for retrieving entity data based on the criteria specified in the <Key> tag. It is only applicable for entity ‘Name’
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
<Request>
<Login>
<Username>admin</Username>
<Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password>
</Login>
<Get>
<IPHost>
<Filter>
<key name="Name" criteria="like">CustomIPHostTypeIPV4</key>
</Filter>
</IPHost>
</Get>
</Request>
Description: It is used within the <Filter> tag to specify the filter key and Filter criteria.
Usage:
Attribute – name, criteria
Attribute Value – name = “Name”, criteria = [“=”,”!=”,”like”]
Example:
Please refer the above example.
Description: It is used to delete data.
Usage:
Attribute – N/A
Attribute Value – N/A
Example:
<Request>
<Login>
<Username>admin</Username>
<Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password>
</Login>
<Remove>
<IPHost>
<Name>CustomIPHostTypeIPV4</Name>
</IPHost>
</Remove>
</Request>
Description: Response of any request will be displayed in this tag.
Usage:
Attribute – APIVersion
Attribute Value – Same value as specified in the XML Request or if it is not specified then active firmware API Version will be considered.
Example:
<Response APIVersion="1605.1">
<Login>
<status>Authetication Successful</status>
</Login>
<IPHost transactionid="">
<Status code="502">Message.IPHostRecordExists</Status>
</IPHost>
</Response>
Description: It is a part of the <Response> tag and it indicates the configuration status based on the code.
Usage:
Attribute – code
Attribute Value – code value.
Example:
<Response APIVersion="1605.1">
<Login>
<status>Authetication Successful</status>
</Login>
<IPHost transactionid="">
<Status code="502">Operation failed. Entity having same name already exists</Status>
</IPHost>
</Response>
|
How to use API ? |
---|
Please use the below link to use API:
https://<Sophos IP>:<port>/webconsole/APIController?reqxml=<Add the XML request here>
Note: Port you mention in above URL should be same as the port you have configured as Admin Console HTTPS Port from System > Administration > Settings.
Example:
https://<Sophos IP>:<port>/webconsole/APIController?reqxml=<Request><Login><Username>admin</Username><Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password></Login><Set> <IPHost transactionid=""><Name>ip2</Name><IPFamily>IPv4</IPFamily><HostType>IP</HostType><IPAddress>2.2.2.9</IPAddress></IPHost> </Set></Request>
https://<Sophos IP>:<port>/webconsole/APIController?reqxml=<Request><Login><Username>admin</Username><Password passwordform="encrypt">8b1e6eb1b182b1806390ffefc99753fc</Password></Login><Get> <IPHost></IPHost> </Get></Request>
|
Status Code and Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|