This guide demonstrates how to use OpenAPI Explorer to manage cloud resources through the Cloud Control API. Using Virtual Private Cloud (VPC) as an example, you will learn to perform the complete lifecycle of operations—create, retrieve, update, list, and delete—on a resource.
Prerequisites
RAM user: For security, we recommend using a Resource Access Management (RAM) user instead of your Alibaba Cloud account. For more information, see Create a RAM user.
Required permissions: Attach the following policies to your RAM user:
The system policy AliyunCloudControlAPIFullAccess to grant access to the Cloud Control API.
A service-specific policy, such as
AliyunVPCFullAccess, for the resources you intend to manage. For more information, see Grant permissions to a RAM user.
Understand API operations
The Cloud Control API uses standardized operations to manage resources. This tutorial covers the following core operations for a VPC, which has the product code VPC and resource type VPC:
CreateResource: Creates a new resource.
GetResource: Retrieves the details of a specific resource.
UpdateResource: Modifies an existing resource.
ListResources: Lists all resources of a specific type in a region.
DeleteResource: Deletes a resource.
Synchronous and asynchronous operations
The Cloud Control API can respond in two ways:
Synchronous (Status 200): The operation is completed immediately, and the response body contains the result.
Asynchronous (Status 202): The operation has been accepted and will run in the background. The response returns a
taskId, which you must use to call theGetTaskoperation to check the final status of the task.
Procedure
Step 1: Create a VPC
Log on to OpenAPI Explorer as your RAM user and navigate to the CreateResource page for VPCs. In the parameters section, specify the
regionIdand define the resource properties in thebody. Then, click Initiate Call.
Review the response in the Response tab.
If the call fails, click Diagnose or use the common error codes to troubleshoot. You can also contact us for support.
A successful call returns a status code of 200 (synchronous operation) or 202 (asynchronous operation). From the response body, copy the
taskIdandresourceIdfor the next steps.
In this example, the status code is 202, which indicates an asynchronous operation. Record the
taskIdand click Query task to navigate to the task query page.
Step 2: Check the creation task status
Navigate to the GetTask page. Paste the
taskIdfrom the previous step into the taskId field and click Initiate Call. Verify that the taskstatusisSucceeded.
You can also verify the creation by navigating to the VPC console.

Step 3: Retrieve VPC details
Navigate to the GetResource page. Enter the resourceId you copied in Step 1 and the correct regionId. Click Initiate Call to retrieve the details of your new VPC.

Step 4: Update the VPC
Navigate to the UpdateResource page. Provide the resourceId and regionId. In the body, specify the properties you want to change (for example, the Description). Click Initiate Call and verify the update in the VPC console.

Step 5: List VPCs
Navigate to the GetResources page. Select a regionId and click Initiate Call. The response will include the VPC you created in the list of resources.

Step 6: Delete the VPC
To clean up the resource, navigate to the DeleteResource page. Enter the
resourceIdandregionIdof the VPC you created, and click Initiate Call.
The successful call returns a status code of 202 and a new
taskId.Use the
GetTaskoperation again to check the status of this deletion task. A status ofSucceededconfirms that the VPC has been deleted.
Sample code
Explore the official code samples on GitHub to learn more about how to use the Cloud Control API programmatically: Cloud Control API Demo Repository.