This is getting ridiculous. I just can't succeed with any PUT or POST commands using Curl.
Could someone please supply me with a working example, including the complete XML that is used in a PUT or POST. Doesn't matter of what type as long as it works.
I'm seriously beginning to doubt it's even possible.. :/
I'm using an admin account and everything I'm trying to do through the API I can do using the VCD WEB_UI.
Have tested on Ubuntu and MAC and getting the same error. Also tried to convert the XML file with dos2unix.
GET networkConnectionSection:
curl -s -k \ -H "Accept:application/*+xml;version=1.5" \ -H "x-vcloud-authorization: ${VCLOUD_AUTH}" \ -X GET "https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/" \
-o networkConnectionSection.xml
<?xml version="1.0" encoding="UTF-8"?>
<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5"xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"type="application/vnd.vmware.vcloud.networkConnectionSection+xml"href="https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/"ovf:required="false"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsdhttp://www.vmware.com/vcloud/v1.5http://vcloud.test.com/api/v1.5/schema/master.xsd">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="none"needsCustomization="true">
<NetworkConnectionIndex>1</NetworkConnectionIndex>
<IsConnected>false</IsConnected>
<MACAddress>00:50:56:01:01:c5</MACAddress>
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
</NetworkConnection>
<NetworkConnection network="Network01"needsCustomization="true">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>10.1.1.100</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:01:c4</MACAddress>
<IpAddressAllocationMode>MANUAL</IpAddressAllocationMode>
</NetworkConnection>
<NetworkConnection network="none"needsCustomization="true">
<NetworkConnectionIndex>2</NetworkConnectionIndex>
<IsConnected>false</IsConnected>
<MACAddress>00:50:56:01:01:c3</MACAddress>
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit"type="application/vnd.vmware.vcloud.networkConnectionSection+xml"href="https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/"/>
</NetworkConnectionSection>
Modifying networkConnectionSection.xml so that no interfaces are connected:
<?xml version="1.0" encoding="UTF-8"?>
<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5"xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"type="application/vnd.vmware.vcloud.networkConnectionSection+xml"href="https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/"ovf:required="false"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsdhttp://www.vmware.com/vcloud/v1.5http://vcloud.test.com/api/v1.5/schema/master.xsd">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="none"needsCustomization="true">
<NetworkConnectionIndex>1</NetworkConnectionIndex>
<IsConnected>false</IsConnected>
<MACAddress>00:50:56:01:01:c5</MACAddress>
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
</NetworkConnection>
<NetworkConnection network="none"needsCustomization="true">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IsConnected>false</IsConnected>
<MACAddress>00:50:56:01:01:c4</MACAddress>
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
</NetworkConnection>
<NetworkConnection network="none"needsCustomization="true">
<NetworkConnectionIndex>2</NetworkConnectionIndex>
<IsConnected>false</IsConnected>
<MACAddress>00:50:56:01:01:c3</MACAddress>
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit"type="application/vnd.vmware.vcloud.networkConnectionSection+xml"href="https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/"/>
</NetworkConnectionSection>
Trying to update the configuration:
curl -i \ -H "Content-Type: application/vnd.vmware.vcloud.networkConnectionSection+xml" \ -H "Accept:application/*+xml;version=1.5" \ -H "x-vcloud-authorization:${VCLOUD_AUTH}" \ -X PUT "https://vcloud.test.com/api/vApp/vm-3004897c-d721-4e10-9454-b4c2370d3604/networkConnectionSection/" \ -d @networkConnectionSection.xml
HTTP/1.1 400 Bad Request
Date: Sun, 12 May 2013 12:14:54 GMT
Content-Type: application/vnd.vmware.vcloud.error+xml;version=1.5
Date: Sun, 12 May 2013 12:14:54 GMT
Content-Length: 444
<?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="BAD_REQUEST" message="Bad request
- Bad request
- Error on line 1 of document : Premature end of file. Nested exception: Premature end of file." majorErrorCode="400" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5http://vcloud.hosteur.com/api/v1.5/schema/master.xsd"></Error>