If an error is returned when you call an OpenAPI operation, you can copy the error information to the OpenAPI problem diagnosis page to obtain a solution.
Obtain error information
Call operations on the debugging page of OpenAPI Explorer
Use the CLI to call operations
Use Terraform to call operations
Diagnose API errors
On the OpenAPI problem diagnosis page, a Resource Access Management (RAM) user can query only the requests that are sent by the RAM user and the corresponding error information. An Alibaba Cloud account can query only the requests that are sent by the Alibaba Cloud account and RAM users within the Alibaba Cloud account and the corresponding error information.
After you obtain the error information, you can copy the complete error information in the JSON format or copy only the value of the RequestId, Code, or Message parameter in the error information to the page to obtain a solution.
For example, the following error information is returned when you call the RunInstances operation of Elastic Compute Service (ECS):
{
"RequestId": "6BE56E05-XXXX-XXXX-XXXX-FD90C4FFD581",
"HostId": "ecs.ap-southeast-3.aliyuncs.com",
"Code": "InvalidImageId.NotFound",
"Message": "The specified ImageId does not exist.",
"Recommend": "https://api.alibabacloud.com/troubleshoot?intl_lang=EN_US&q=InvalidImageId.NotFound&product=Ecs&requestId=6BE56E05-XXXX-XXXX-XXXX-FD90C4FFD581"
}
The following list describes the parameters:
RequestId: the request ID. You can copy the request ID to the page to obtain a solution.
HostId: the host ID of the server.
Code: the error code.
Message: the error message. You can use the error message to troubleshoot the request parameters. In this example, the error message indicates that the specified image ID is invalid. In this case, you can specify a valid image ID to resolve the error.
Recommend: the URL of the corresponding error diagnostics. You can directly copy the URL to go to the OpenAPI problem diagnosis page to obtain a solution.
In actual business scenarios, such as when you use SDKs to call operations, you may not be able to directly obtain the complete error information in the JSON format. In this case, you can copy the value of the RequestId, Code, or Message parameter to the page to obtain a solution. To obtain a relatively accurate solution, we recommend that you use the request ID.
The following figure shows how to use the request ID to obtain a solution.
View the diagnostic solution
The OpenAPI problem diagnosis page contains the Diagnostic Solution and Log Information tabs. The Diagnostic Solution tab displays the corresponding solution to an error. In this example, the following solution is provided for the error message The specified ImageId does not exist.
:
The specified image does not exist under this user account. Check whether the image ID is correct.
Check whether the value of the ImageId request parameter is valid based on the solution.
Check request parameters
In actual business scenarios, you may not save the request parameters. In this case, you can obtain the request parameters, response parameters, and other related information on the OpenAPI problem diagnosis page.
For example, you copy the request ID 6BE56E05-XXXX-XXXX-XXXX-FD90C4FFD581 to perform error diagnostics on the OpenAPI problem diagnosis page. Then, click the Log Information tab. The Log Information tab displays the visualized analysis of the API call, complete error information, and request parameters. The information facilitates you to troubleshoot and resolve the error. The following figure shows an example of the Log Information tab.