API responses does not show error

Hi All,

I am referring to below API document to get responses. In some cases, it does not show any error via API but while checking on dashboard, it does not perform that operation and throws an error.

Example: I was using one.vm.disksnapshotcreate. It does not throws any error while performing this operation via API. When I checked on the dashboard, it was showing an error message in the logs: “Error creating new VM Snapshot: Could not create snapshot”

https://docs.opennebula.io/5.10/integration/system_interfaces/api.html

Thanks!

Hi @Aman,

The behavior you’re seeing is the expected one. Note that some operations (e.g disk snapshot creation) are asynchronous actions. This means that the API will return as soon as the drivers are triggered and it will return successfully as long as the action can be performed. These API calls will fails for example if the action cannot be carried out in some specific VM state.

In order to check that the action have finished successfully you can retrieve the VM information and check that it’s in the expected state or that the new resource (e.g the disk snapshot) is there.