Examples of Web Service Requests

This section presents an example for creating requests to the Web service that allows a cloud user to perform actions for an account. This section includes:

Creating an Access Key

Procedure to create an access key.

An access key is created for an account. The registered access key is needed to perform any IAAS action in the account.

To create an access key:

  1. Create a private RSA key stored as a DER file.

    1. Run the following command to create a private RSA key file:

      openssl genrsa -out privatekey.pem 2048

    2. Run the following command to store the private key as DER:

      openssl pcks8 -topk8 -inform PEM -outform DER -in privatekey.pem -nocrypt > privatekey.DER

  2. Create a public RSA key base on the privateRSA key. Run the following command:

    openssl rsa -in privatekey.pem -pubout -out publickey.pem

    The openssl public key generated must be similar to the following:

    -----BEGIN PUBLIC KEY----- 
    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAufVdjdp0MmOLbNypLVMW 
    Xfmhusawid4Wg4n4FZewSmoBEYA8f8wIA0SI87Shi7RtMcWsEoXvNNHA0wcJoA1R 
    jyVLsI3rtrq0c0k7AxQSwb4UK/rSXW1NXxMh/mE7b3gdA6d9VuwIPnZJ5ZFQUZCL 
    yhaAotLCdACrzbgzYXdqt+rstutT1AVkE2UAMcm5O3KnIoObZKb8JtepSt74A9Rg 
    VBkcCBjmKGfLNOL1KlZconkITm85TWKRaGRFuASxdl2ZrD723ZNb66X/a9ebxTMr 
    6vVeskcaZpPlHzvgMOpiyDGwRvxn9yM5WB83zFDGT26Lihn/bKzLJXa+F2YNkLrT 
    JQIDAQAB 
    -----END PUBLIC KEY-----
    
  3. Display the account attributes for a cloud user.

    1. Create and send an AKM request using the DescribeAccountsRequest action. The appropriate hostname, cloud user, timestamp, and expires information must be provided:

      https://<username>:<password>@<EnterpriseControllerHostname>/akm/? Action=DescribeAccounts&Version=1&Timestamp=1330954619299&Expires=1330954919299

    2. Verify the account ID from the result returned from the previous AKM request. In this example, the account ID is ACC-0162da5a-5d25-4096-af59-3dd1de27cfad

      <result xsi:type="DescribeAccountsResult" requestId="803">
      <items>
      <account>ACC-0162da5a-5d25-4096-af59-3dd1de27cfad</account>
      <name>acc1</name>
      </items>
      <forUser><username></forUser>
      </result>
      
  4. Create the access key for a cloud user account.

    1. Register the public key created in step 2 by using the RegisterAccessKey action. Ensure that the data is represented as a single line. The following URL shows the HTTPS request to create an access key. The account used is the one from the DescribeAccount action used in step 3:

      https://<username>:<password>@<EnterpriseControllerHostname>/akm/?Action=RegisterAccessKey&Version=1&Timestamp=1330975344&Expires=1333975344&account=ACC-0162da5a-5d25-4096-af59-3dd1de27cfad&publicKey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAufVdjdp0MmOLbNypLVMWXfmhusawid4Wg4n4FZewSmoBEYA8f8wIA0SI87Shi7RtMcWsEoXvNNHA0wcJoA1RjyVLsI3rtrq0c0k7AxQSwb4UK/rSXW1NXxMh/mE7b3gdA6d9VuwIPnZJ5ZFQUZCLyhaAotLCdACrzbgzYXdqt+rstutT1AVkE2UAMcm5O3KnIoObZKb8JtepSt74A9RgVBkcCBjmKGfLNOL1KlZconkITm85TWKRaGRFuASxdl2ZrD723ZNb66X/a9ebxTMr6vVeskcaZpPlHzvgMOpiyDGwRvxn9yM5WB83zFDGT26Lihn/bKzLJXa+F2YNkLrTJQIDAQAB

    2. Verify the access key ID that was generated. The access key ID is part of the results returned from the RegisterAccessKey action. This access key ID is used for all IAAS requests for the account to authenticate the cloud user to the account. In this examples, the access key ID is AK_1.

      <result xsi:type="RegisterAccessKeyResult" requestId="1013"> 
      <accessKeyId>AK_1</accessKeyId> 
      </result>
      

Executing actions for an account

The following actions are explained in this section:

To execute these actions using the Web service, the access key ID and private key file obtained from the previous step.

Viewing All Available Virtual Networks

Procedure to create a request that displays available virtual network.

To view attributes of all available virtual networks for an account:

  1. Define the data to be signed by using the DescribeVnets action.

    Action=DescribeVnets&Version=1&AccessKeyId=AK_1

  2. Sign the data by using the WebUtil application.
    java WebUtil signature  privatekey.DER  "POST" "<EnterpriseControllerHostname>"  "Action=DescribeVnets&Version=1&accessKeyId=AK_1" signedData
    
  3. Get the signed data that is stored in the iaasPartRequest and signedData files.

    Content of the iaasPartRequest file: https://<EnterpriseControllerHostname>/iaas/?Action=DescribeVnets&Version=1&AccessKeyId=AK_1&Timestamp=1331058169938&Expires=1331058469938&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=

    Content of the signedData file: bj8GfJCqvPZZPU2JoWAGzZdCF+N767rQejILMQwNdgKLfoGGqAwDPRYMr/ghUoBc6RB3nKYgAyPdmtCfhzRGTqECgUWy0jCrE99+utGeeJ0/XRQ9LxyYeBgzjO3lHP+hFhUo+gUtQaSYPhUHH7eTkxg/CrolMxibglypJM/rIf90yEqSeqhphQt7hWxlT0DNAy6/cZt8isT/Tu8V7ZFjBFkEpLfN97bIOJ2vIIpOeetmftuw4ObtqjbUp6+7dpVkhhCQnX0MAIDj+mjorEOzcwK+F1pYuzES0fjaW0MowG+cA/9gttDjg7r5H29i3qbbjIlvAt6fk1HPpSxQTSTOTg==

  4. Append the signature to get the complete IAAS request, as show in the following example:

    https://<EnterpriseControllerHostname>/iaas/?Action=DescribeVnets&Version=1&AccessKeyId=AK_1&Timestamp=1331058169938&Expires=1331058469938&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=bj8GfJCqvPZZPU2JoWAGzZdCF+N767rQejILMQwNdgKLfoGGqAwDPRYMr/ghUoBc6RB3nKYgAyPdmtCfhzRGTqECgUWy0jCrE99+utGeeJ0/XRQ9LxyYeBgzjO3lHP+hFhUo+gUtQaSYPhUHH7eTkxg/CrolMxibglypJM/rIf90yEqSeqhphQt7hWxlT0DNAy6/cZt8isT/Tu8V7ZFjBFkEpLfN97bIOJ2vIIpOeetmftuw4ObtqjbUp6+7dpVkhhCQnX0MAIDj+mjorEOzcwK+F1pYuzES0fjaW0MowG+cA/9gttDjg7r5H29i3qbbjIlvAt6fk1HPpSxQTSTOTg==

    Note:

    The complete request to the Web service must be created as a single-line request.

  5. Send the complete IAAS request using the browser or the WGET utility. The result returned is similar to the following output:
    <result xsi:type="DescribeVnetsResult" requestId="102">
    <items>
    <id>VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d</id>
    <name>192.0.2.0/24</name>
    <description>OVM Discovered Network</description>
    <status>OK</status>
    <ipAddress>192.0.2.0/24</ipAddress>
    </items>
    </result>
    

Viewing Specific Virtual Networks by Using IDs

Procedure to create a request that displays information about a virtual network.

To use the virtual networks IDs to specify which virtual networks to display for an account:

  1. Define the data to be signed by using the DescribeVnets action.

    Action=DescribeVnets&Version=1&AccessKeyId=AK_1&ids.1=VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d

  2. Sign the data by using the WebUtil application.
    java WebUtil signature  privatekey.DER  "POST" "<EnterpriseControllerHostname>"  "Action=DescribeVnets&Version=1&AccessKeyId=AK_1&ids.1=VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d" signedData
    
  3. Get the signed data that is stored in the iaasPartRequest and signedData files.

    Content of the iaasPartRequest file: https://<EnterpriseControllerHostname>/iaas/?Action=DescribeVnets&Version=1&AccessKeyId=AK_1&ids.1=VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d&Timestamp=1331058449900&Expires=1331058749900&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=

    Content of the signedData file: B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

  4. Append the signature to get the complete IAAS request, as show in the following example:

    https://<EnterpriseControllerHostname>/iaas/?Action=DescribeVnets&Version=1&AccessKeyId=AK_1&ids.1=VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d&Timestamp=1331058449900&Expires=1331058749900&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

    Note:

    The complete request to the Web service must be created as a single-line request.

  5. Send the complete IAAS request using the browser or WGET utility. The result returned is similar to the following output:
    <result xsi:type="DescribeVnetsResult" requestId="107">
    <items>
    <id>VNET-6c774d08-d0a7-493b-9fa1-c93a80702f8d</id>
    <name>192.0.2.0/24</name>
    <description>OVM Discovered Network</description>
    <status>OK</status>
    <ipAddress>192.0.2.0/24</ipAddress>
    </items>
    </result>
    

Viewing Specific Virtual Networks by Using Filters

Procedure to create a request that displays information about a virtual network.

To specify which virtual networks to display by using the name of the virtual network as filter:

  1. Define the data to be signed by using the DescribeVnets action:

    Action=DescribeVnets&Version=1&AccessKeyId=AK_1&filters.1.filterValue=privatevnet1&filters.1.filterName=name

  2. Sign the data by using the WebUtil application.
    java WebUtil signature  privatekey.DER  "POST" "<EnterpriseControllerHostname>"  "Action=DescribeVnets&Version=1&AccessKeyId=AK_1&filters.1.filterValue=privatevnet1&filters.1.filterName=name" signedData
    
  3. Get the signed data that is stored in the iaasPartRequest and signedData files.

    Content of the iaasPartRequest file: https://<EnterpriseControllerHostname>/iaas/?Action=DescribeVnets&Version=1&AccessKeyId=AK_1&filters.1.filterValue=privatevnet1&filters.1.filterName=name&Timestamp=1331058887344&Expires=1331059187344&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=

    Content of the signedData file: B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

  4. Append the signature to get the complete IAAS request, as show in the following example:

    https://<EnterpriseControllerHostname>/iaas/?Action=CreateVnet&Version=1&AccessKeyId=AK_1&name=privatevnetWebApi&Timestamp=1331058639019&Expires=1331058939019&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

    Note:

    The complete request to the Web service must be created as a single-line request.

  5. Send the complete IAAS request using the browser or wget. The result returned is similar to the following output:
    <result xsi:type="DescribeVnetsResult" requestId="111"><items><id>VNET-8028fbfa-9e6f-4494-82c5-b35367340240</id><name>privatevnet1</name><description>privatevnet1</description><status>OK</status><ipAddress>192.0.2.0/24</ipAddress></items></result>
    

Creating a Private Virtual Network

Procedure to create a private virtual network for an account.

To create a private virtual network for an account:

  1. Define the data to be signed by the using DescribeVnets action.

    Action=CreateVnet&Version=1&AccessKeyId=AK_1&name=privatevnetWebApi

  2. Sign the data by using the WebUtil application.
    java WebUtil signature  privatekey.DER  "POST" "<EnterpriseControllerHostname>"  "Action=CreateVnet&Version=1&AccessKeyId=AK_1&name=privatevnetWebApi" signedData
    
  3. Get the signed data that is stored in the iaasPartRequest and signedData files.

    Content of the iaasPartRequest file: https://<EnterpriseControllerHostname>/iaas/?Action=CreateVnet&Version=1&AccessKeyId=AK_1&name=privatevnetWebApi&Timestamp=1331058639019&Expires=1331058939019&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=

    Content of the signedData file: B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

  4. Append the signature to get the complete IAAS request, as show in the following example:

    https://<EnterpriseControllerHostname>/iaas/?Action=CreateVnet&Version=1&AccessKeyId=AK_1&name=privatevnetWebApi&Timestamp=1331058639019&Expires=1331058939019&SignatureMethod=SHA512withRSA&SignatureVersion=1&Signature=B15A5WdQkIwTrlR/NDXbn1RFwWyBFAQFtZTfZ1jH8ftkRgvfwU93nxukpw23sHBdRvhzLuhyW2LWm90EIhZHd3H2x9s8D1wCAUFTsSAZoPuIlW40qn0sf9VTEXOlqwnxfray6eSGCcpHQWXaA+TjpCitzguoPmHa3LjGKECnbNuqJS15L8VuVfE6otaxyTBzmhH7iI7pBC8gcpomnDZhxZkAFaVT0TFf88epbJal5Yl6aTpptjlUNEz6jDhuV2Qaa3bI5OqnJc0PJgCkhuKU7un8us1JVEk/nf/or5RCBMmPGAluuILIfYBEe/euVUy7wQ00eyKPRuplZkORmVbFLg==

    Note:

    The complete request to the Web service must be created as a single-line request.

  5. Send the complete IAAS request using the browser or WGET utility. The result returned is similar to the following output:
    <result xsi:type="CreateVnetResult" requestId="109"><vnetId>VNET-7e33ee2e-d0f9-4b39-b8c9-32b8c8bfed87</vnetId></result>