2 Replies Latest reply on Mar 30, 2020 4:43 AM by Suraj_Chavan

    Unable to fetch vApp Template information from the vApp GET or LIST vCloud Director 9.5 API 30.0v

    Suraj_Chavan Lurker

      Hi,

       

      In the current  GET vApp API there is no information of vAppTemplate (ID/HREF).
      I am creating the vApp using instantiateVAppTemplate, hence I need the vAppTemplate ID to verify.

       

      vApp GET API do not provide any sort of information related to the vApp Template.

      GET API return vApp object which has no info related to vAppTemplate.

       

      I am using following API
      GET- vCloud REST API - GET-VApp
      Admin LIST- /api/query?type=adminVApp&format=records

      Non-Admin LIST- /api/query?type=vApp&format=records

       

       

      Is there any way by which I can find the vAppTemplate ID by which the vApp is created ?

        • 1. Re: Unable to fetch vApp Template information from the vApp GET or LIST vCloud Director 9.5 API 30.0v
          jnivoit Novice
          VMware Employees

          During vAppTemplate instantiation, vCD sets a metadata key/value on the newly-created vApp with key=vapp.origin.id and value=id of template.

          This is not guaranteed to be present (it can be removed by the sysadmin), but when it's present you can get that information in the vapp query:

           

          https://wdc-vcd-sp-static-34-7.eng.vmware.com/api/query?type=adminVApp&format=records&page=1&fields=name,metadata@SYSTEM…

           

          and you'll get something like the following back:

          <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
          <QueryResultRecords  name="adminVApp" page="1" pageSize="25" total="20" href="https://wdc-vcd-sp-static-34-7.eng.vmware.com/api/query?type=adminVApp&amp;page=1&amp;pageSize=25&amp;format=records&amp;fields=name,metadata@SYSTEM:vapp.origin.id" type="application/vnd.vmware.vcloud.query.records+xml">
              <AdminVAppRecord name="vApp-2020-02-28-15-18-25.640" href="https://wdc-vcd-sp-static-34-7.eng.vmware.com/api/vApp/vapp-04c0ff5c-9b59-4383-a939-108833771d37"/>
              <AdminVAppRecord name="vapp-fde9f1fd-4e84-459e-965a-8e1e37459496" href="https://wdc-vcd-sp-static-34-7.eng.vmware.com/api/vApp/vapp-0951f25b-568e-4173-bfe2-4eac91851ebb"/>
              <AdminVAppRecord name="vAppTemplate-2020-02-28-11-35-31.357" href="https://wdc-vcd-sp-static-34-7.eng.vmware.com/api/vApp/vapp-2e230495-9c06-4a06-b544-4239c1f66210">
                  <Metadata>
                      <MetadataEntry>
                          <Domain visibility="READONLY">SYSTEM</Domain>
                          <Key>vapp.origin.id</Key>
                          <TypedValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="MetadataStringValue">
                              <Value>6f84c9b5-9113-4287-ac5a-44c0368bfa20</Value>
                          </TypedValue>
                      </MetadataEntry>
                  </Metadata>
              </AdminVAppRecord>
          </QueryResultRecords>

           

          then you can extract the ID of the vAppTemplate from there...

          • 2. Re: Unable to fetch vApp Template information from the vApp GET or LIST vCloud Director 9.5 API 30.0v
            Suraj_Chavan Lurker

            jnivoit: Thanks It works for both adminVApp as well as non Admin -vApp.