Hello,
I am trying to utilize REST APIs to share vApp with other users in the org. I wanted to know can we update controlAccess for the vApp if we have other user's email or username?
I am trying to use the below endpoint.
https://<cloud-url>/api/vApp/<vapp-id>/action/controlAccess
And I got this payload example from schema.
{
"vCloudExtension": [
{
"required": true
}
],
"isSharedToEveryone": true,
"everyoneAccessLevel": "string",
"accessSettings": {
"vCloudExtension": [
{
"required": true
}
],
"accessSetting": [
{
"vCloudExtension": [
{
"required": true
}
],
"accessLevel": "string"
}
]
}
}
They payload doesn't specify how we can pass the user detail. I am not sure if this is the correct endpoint or do we have another endpoint?
Thanks,
Shukran
Hi Shukran.
You need to use POST /vApp/{id}/action/controlAccess and add ControlAccessParamsType to it.
<AccessSettings>
<AccessSetting>
<Subject href="xs:anyURI" id="xs:string" type="xs:string" name="xs:string"/>
You will need to specify href, id and username.
Hi Shukran.
You need to use POST /vApp/{id}/action/controlAccess and add ControlAccessParamsType to it.
<AccessSettings>
<AccessSetting>
<Subject href="xs:anyURI" id="xs:string" type="xs:string" name="xs:string"/>
You will need to specify href, id and username.
Hi Macleud,
Thanks for your help but when I run it I am getting 415 'Unsupported Media Type' error.
This is the query i have used
curl -L -X POST 'https://<cloud-url>/api/vApp/vapp-01417e65-28bc-4eb4-97fa-f4da9a0158f4/action/controlAccess' -H 'accept: application/*;version=33.0' -H 'Content-Type: application/xml' --data-raw '<?xml version="1.0" encoding="UTF-8"?>
<ControlAccessParams
xmlns="http://www.vmware.com/vcloud/v1.5">
<IsSharedToEveryone>true</IsSharedToEveryone>
<EveryoneAccessLevel>ReadOnly</EveryoneAccessLevel>
</ControlAccessParams>'
This is the response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns9="http://www.vmware.com/vcloud/versions" majorErrorCode="415" message="Unsupported Media Type" minorErrorCode="UNSUPPORTED_MEDIA_TYPE"/>
Not sure if I am doing something wrong. If you have a curl that i could use that would be appreciated.
Shukran
Content-Type for your request should be 'application/vnd.vmware.vcloud.controlAccess+xml'
Thanks it works now