General notes
Virtual Automation Management Node (VA MN) 6.x/7.x API ports:
- 4533 - non-SSL XML API service
- 4534 - SSL XML API service
Virtual Automation Agent (VA Agent) 6.x and 7.x API ports (VA Agent is installed directly onto the Virtuozzo Hybrid Server host):
- 4433 - non-SSL XML API service
- 4434 - SSL XML API service
- 4646 - SOAP API service
The VA API service can work in compatibility mode with previous versions, which is why the API version is typically set to 4.0.0. However, this setting can be changed if required.
In order to use a previous version of the VA API, you must follow the corresponding API guide and set the appropriate API protocol version in the XML header. For example:
Ways of sending XML API request
An XML API request can be sent to VA XML API service in several different ways.
1. vzlcon
API requests to a local VA Agent can be sent using the vzlcon tool:
/opt/pva/agent/bin/vzlcon
NOTE: Packets are separated by a ctrl+shift+2 combination:
Example:
~]# /opt/pva/agent/bin/vzlcon <packet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" id="0" priority="0" version="4.5.0"> <origin>vzclient2-4a7e18fd-c53a-a048-af57-06602fbb8317</origin> <target>agent</target> <data> <ok/> <eid>4a7e18fd-c53a-a048-af57-06602fbb8317</eid> </data> </packet> <packet version="4.0.0"><data><system><get_version/></system></data></packet> ^@ <==Here CTRL+SHIFT+2 was pressed <packet xmlns:ns1="http://www.swsoft.com/webservices/vzl/4.0.0/protocol"" xmlns:ns2="http://www.swsoft.com/webservices/vzl/4.0.0/system"" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" priority="0" version="4.0.0"> <ns1:origin>gend</ns1:origin> <ns1:target>vzclient2-4a7e18fd-c53a-a048-af57-06602fbb8317</ns1:target> <ns1:dst> <director>gend</director> </ns1:dst> <ns1:data> <ns2:system> <ns2:version>vzagent-4.6.843</ns2:version> <ns2:pva_version>4.6</ns2:pva_version> <ns2:pva_release>1764</ns2:pva_release> </ns2:system> </ns1:data> </packet> ^C
2. Openssl
Second way is using the openssl tool:
echo -ne '<packet id="1" version="4.0.0"><data><system><login><name>BASE 64 ENCRYPTED USER NAME</name><realm>00000000-0000-0000-0000-000000000000</realm><password>BASE64 ENCRYPTED PASSWORD</password></login></system></data></packet>\0<packet id="2" version="4.0.0">YOUR XML API REQUEST</packet>\0' | openssl s_client -connect HOSTNAME:4434 -cipher ADH-AES256-SHA -quiet
In this example, you need to specify the base64 encrypted login and password to authenticate to the XML API service. This can be done using perl, example of the command and the output:
~# perl -MMIME::Base64 -e "print(encode_base64('YOUR PLAIN TEXT PASSWORD'))"
WU9VUiBQTEFJTiBURVhUIFBBU1NXT1JE
Your XML API request goes in the second packet. You can send several packets in a sequence terminated by '\0' after the authentication packet.