All pages
Powered by GitBook
1 of 8

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

4. HI GIO API

Overview

This guide is designed to help developers and technical users integrate and interact with the HI GIO Cloud services through our powerful API.

This manual provides detailed information on authenticating, making API calls, and handling responses effectively. It also covers best practices, code examples, and troubleshooting tips to ensure a smooth integration process.

Please refer to the VM usage guide in the list below.

  • API creates VM from Template

API reconfigures VM's Disk
API reconfigures VM's Networks
API token login
API reconfigures VM's Memory
API reconfigures VM's CPU
API power on/off VM

API creates VM from Template

Overview

  • In this manual, you will find detailed information on how to prepare & create a VM from the template.

  • This API creates a VM with the default name (VM name of template), default network "VM Network," and default compute and storage.

Procedure

1

Step 1: Preparation

Log in to IAM portal -> vCD portal: collect the information

{{vcd_url}}

{{vdc_uuid}}: Login vCD portal -> select VDC-> take a look and note vdc_uuid on the URL

{{network_uuid}}: On the vCD portal -> Networking -> Networks -> New

Select the “VM Network” -> take a look and note the network uuid on the url

{{vappTemplate_uuid}}: On the vCD portal -> Content Hub -> Catalogs ->HIGIO Shared Catalogs

-> vApp Templates -> select the template that you want to create VM -> take a look the vappTemplate_uuid on the url

{{Bearer Token}}: Please follow “” document

2

Step 2: Create VM from template

Postman:

POST https://{{vcd_url}}/api/vdc

/{{vdc_uuid}}/action/instantiateVAppTemplate

Authorization: {{Bearer Token }}

Headers:

- 'Accept: */*;version=37.2

- ‘Content-type’: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml; charset=ISO-8859-1

3

On the vCD -> Data Center -> select your Virtual Data Center ->vApps -> check your vApp and VM.

API power on/off VM

In this manual, you will find detailed information on how to prepare information, get VM status, and change status VM.

1

Step 1: Prepare information

Login IAM portal -> vCD portal: collect the information

  • {{vcd_url}}

Body: {{select raw, copy, paste and edit the code below}}

SEND request.

Note that the network name must be “VM Network”

Step 3: Verify

Api token login
<?xml version="1.0" encoding="UTF-8"?>

<vcloud:InstantiateVAppTemplateParams

    xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"

    deploy="false"

    name="your vapp name"

    powerOn="false">

    <vcloud:Description>VApp Description</vcloud:Description>

    <vcloud:InstantiationParams>

        <vcloud:NetworkConfigSection>

            <ovf:Info>NetInfo</ovf:Info>

            <vcloud:NetworkConfig networkName="VM Network">

                <vcloud:Configuration>

                    <vcloud:ParentNetwork

                        href="https:// {{vcd_url}}/api/network/{{network_uuid}}"

                        name="VM Network"

                        type="application/vnd.vmware.vcloud.network+xml"/>

                    <vcloud:FenceMode>bridged</vcloud:FenceMode>

                </vcloud:Configuration>

            </vcloud:NetworkConfig>

        </vcloud:NetworkConfigSection>

    </vcloud:InstantiationParams>

    <vcloud:Source

        href="https://{{vcd_url}}/api/vAppTemplate/{{vappTemplate_uuid}}"

        name="HIGIO"

        type="application/vnd.vmware.vcloud.vAppTemplate+xml"/>

</vcloud:InstantiateVAppTemplateParams>
  • {{vm-uuid}}: select VM -> take a look vm uuid on url

  • {{Bearer Token}}: Please follow “API token login” document

  • 2

    Step 2: Get VM status

    • GET https://{{vcd_url}}/api/vApp/{{vm_uuid}}

    • Authorization: {{Bearer Token }}

    • Headers:

    - ‘Accept’: */*;version=37.2

    • SEND request.

    Check the VM status on line 3 of Response Body. If Link rel="power:powerOff", VM is Power ON else VM is Power Off.

    3

    Step 3: Change the status VM

    • POST https://{{vcd_url}}/api/vApp/{{vm_uuid}}/power/action/{{powerOn/powerOff}}

    • Authorization: {{Bearer Token}}

    • Headers:

    - ‘Accept’: */*;version=37.2

    • SEND request.

    4

    Step 4: Verify

    • Get VM’s status information

    GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}

    • Check on vCD portal

    Login IAM -> vCD portal-> select VM

    Overview

    Procedure

    API reconfigures VM's Disk

    Overview

    In this manual, you will find detailed information on how to prepare information, get the VM’s disk information, and reconfigure the VM’s disk.

    Procedure

    1

    Step 1: Prepare Information

    Log in to IAM portal -> vCD portal: collect the information

    {{vcd_url}}

    {{vm-uuid}}: select VM -> take a look vm uuid on url

    {{Bearer Token}}: Please follow the “API token login” documen

    2
    • GET https://{{vcd_url}}APIi/vApp/{{vm-uuid}}/virtualHardwareSection/disks

    • Authorization: {{Bearer Token}}

    • Headers:

    3

    • PUT https//{{vcd_url}}APIi/vApp/{{vm-uuid}}/virtualHardwareSection/disks

    • Authorization: {{Bearer Token }}

    4
    • Get VM’s disk information

    GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/disks

    • Check on vCD portal

    Login IAM -> vCD portal-> select VM-> Hard disk

    API token login

    Overview

    In this manual, you will find detailed information on preparing information, creating a Token on the vCD portal, and creating a Bearer token.

    Procedure

    1

    Step 1: Prepare Information

    * Login IAM portal -> vCD portal: collect the information

    • {{vcd_url}}

    • {{tenant_name}}

    Ex: https://iaas-hcmc02.higiocloud.vn/tenant/”tenant_name”/vdcs/dashboard

    2

    Step 2: Create Token on vCD portal

    • Login IAM portal -> vCD portal -> User preferences

    • API tokens -> New

    3
    • POST https://{{vcd_url}}/oauth/tenant/{{tenant_name}}/token

    • Authorization: No Auth

    • Headers:

    API reconfigures VM's Networks

    In this manual, you will find detailed information on how to prepare information, get VM’s network information, and reconfigure VM’s networks.

    1

    Login IAM portal -> vCD portal: collect the information

    {{vcd_url}}

    {{vm-uuid}}: select VM -> take a look vm uuid on url

    - ‘Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    Headers:

    - 'Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    • Body: {{select raw -> copy and paste response body from Get VM’s disk information }}

    Ex:

    • Find word ns10:capacity and edit the value in ,”, it’s the VM’s disk (MB)

    • SEND request.

    Step 2: Getting VM’s Disk information

    Step 3: Reconfig VM’s disk

    Step 4: Verify

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
    …………………………………………….
    ………………………………………
            <rasd:HostResource xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:storageProfileHref="https://iaas-hcmc02.higiocloud.vn/api/vdcStorageProfile/a7c6c2f7-3c2211e6e7b0" ns10:busType="6" ns10:busSubType="VirtualSCSI" ns10:capacity="15240" ns10:iops="4000" ns10:storageProfileOverrideVmDefault="false"></rasd:HostResource>
            <rasd:InstanceID>2000</rasd:InstanceID>
            <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:Parent>2</rasd:Parent>
        </Item>
    </RasdItemsList>
    
    Copy token ({{api-token-generated}})

    - 'Accept: application/json'

    - 'Content-Type: application/x-www-form-urlencoded'

    • Body:

    raw: 'grant_type=refresh_token&refresh_token={{api-token-generated}}'

    • SEND request.

    Response body: "access_token" (Bearer token)

    Step 3: Creating a Bearer token

    {{network_name}}
    : Select Networking -> Networks -> Copy the Network name

    {{Bearer Token}}: Please follow the “API token login” document

    2

    Step 2: Get VM’s network information

    • GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards

    • Authorization: {{Bearer Token}}

    • Headers:

    - ‘Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    • SEND request.

    Copy Response Body

    3

    Step 3: Reconfig VM’s networks

    • PUT https//{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards

    • Authorization: {{Bearer Token }}

    • Headers:

    - 'Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1

    Body: {{select raw -> copy and paste response body from Get VM’s networks information }}

    Ex:

    =====================================================================

    Find word :

    ns10:ipAddressingMode and edit the value in “ ” (network mode: “DHCP”, “Pool”, “Manual”)

    + DHCP: Please setup DHCP pool on your network -> The P Management

    + Pool: Please setup Static IP pools on yoursetork -> IP Management

    ns10:ipAddress and edit the value in “” (“VM ipv4 address”) – no need if using DHCP or Pool

    ns10:primaryNetworkConnection and edit the value in “” (paste network name {{netwok_name}} )

    • SEND request.

    4

    Step 4: Verify

    • Get VM’s network information.

    GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards

    • Check on the vCD portal

    Login IAM -> vCD portal-> select VM-> NICs

    Overview

    Procedure

    Step 1: Prepare Information

    API reconfigures VM's CPU

    Overview

    In this manual, you will find detailed information on how to prepare information, get the VM’s CPU information, and Reconfigure the VM’s CPU.

    Procedure

    1

    Step 1: Prepare Information

    Login IAM portal -> vCD portal: collect the information

    • {{vcd_url}}

    • {{vm-uuid}}: select VM -> take a look vm uuid on url

    • {{Bearer Token}}: Please follow “Api token login” document

    2
    • GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/cpu

    • Authorization: {{Bearer Token }}

    • Headers:

    3

    Step 3: Reconfigure VM’s CPU

    Postman:

    • PUT https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/cpu

    • Authorization: {{Bearer Token }}

    4
    • Get VM’s CPU information

    GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/cpu

    • Check on vCD portal

    Login IAM -> vCD portal-> select VM-> Compute

    - ‘Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    • SEND request.

    Copy Response Body

    Headers:

    - 'Accept: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    Body: {{select raw -> copy and paste response body from Get VM’s CPU information }}

    Ex:

    ==============================================================================

    Find line “<rasd:VirtualQuantity>8</rasd:VirtualQuantity>” and edit the number, it’s the CPU number.

    • SEND request.

    Step 2: Get VM’s CPU information

    Step 4: Verify

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns4:Item xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns4="http://www.vmware.com/vcloud/v1.5"
        <rasd:Reservation>0</rasd:Reservation>
        <rasd:ResourceSubType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:ResourceType>3</rasd:ResourceType>
    …………………………………………………………………………..
    ………………………………………………………………………….
        <rasd:VirtualQuantity>8</rasd:VirtualQuantity>
        <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:Weight>0</rasd:Weight>
        <vmw:CoresPerSocket ovf:required="false">2</vmw:CoresPerSocket>
    type="application/vnd.vmware.vcloud.rasdItem+json"/>
    </ns4:Item>
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
    …………………………………..
    ………………………………….
        <Link rel="edit" href="https://iaas-hcmc02.higiocloud.vn/api/vApp/vm-6cc0d2ef-6823-421a-bed5-8bb0f92a7bca/virtualHardwareSection/networkCards" type="application/vnd.vmware.vcloud.rasdItemsList+json"/>
        <Item>
            <rasd:Address>00:50:56:02:10:2c</rasd:Address>
            <rasd:AddressOnParent>0</rasd:AddressOnParent>
            <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
            <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:Connection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:ipAddressingMode="Manual" ns10:ipAddress="10.10.11.20" ns10:primaryNetworkConnection="true">10.10.11.0/24</rasd:Connection>
            <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            …………………………………………………………………….
            <rasd:ResourceSubType>VMXNET3</rasd:ResourceSubType>
            <rasd:ResourceType>10</rasd:ResourceType>
            <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        </Item>
    </RasdItemsList>

    API reconfigures VM's Memory

    Overview

    In this manual, you will find detailed information on how to prepare information, get the VM’s memory information, and reconfigure the VM’s memory.

    Procedure

    1

    Step 1: Prepare Information

    * Login IAM portal -> vCD portal: collect the information

    • {{vcd_url}}

    - {{vm-uuid}}: select VM -> take a look vm uuid on url

    -{{Bearer Token}}: Please follow “Api token login” document

    2
    • GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory

    • Authorization: {{Bearer Token}}

    • Headers:

    3

    Step 3: Reconfig VM’s memory

    • PUT https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory

    • Authorization: {{Bearer Token }}

    4
    • Get VM’s memory information

    GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/memory

    • Check on vCD portal

    Login IAM -> vCD portal-> select VM-> Compute

    - ‘Accept’: */*;version=37.2

    - ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    • SEND request.

    Copy Response Body

    Headers:

    -'Accept: /;version=37.2

    -‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

    Body: {{select raw -> copy and paste response body from Get VM’s memory information }}

    Ex:

    ==============================================================================

    Find line “<rasd:VirtualQuantity>2048</rasd:VirtualQuantity>” and edit the value, it’s the VM’s memory (MB).Please note that Value must be a multiple of 4 MB

    • SEND request.

    Step 2: Get VM’s memory information

    Step 4: Verify

    
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns4:Item xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns4="http://www.vmware.com/vcloud/v1.5" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf"
    ………………………………………………………….
    ……………………………………………………………
        <rasd:ResourceType>4</rasd:ResourceType>
        <rasdraidtualQuantity>2048</rasd:VirtualQuantity>
        <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    type="application/vnd.vmware.vcloud.rasdItem+json"/>
    </ns4:Item>