VMware Cloud Community
Humphry
Contributor
Contributor

get tasks using Rest API

Hi, I have a problem listing the tasks using the Rest API (http://vmware.github.io/vsphere-automation-sdk-rest/6.7.1/operations/com/vmware/cis/tasks.list-opera...). I want to retrieve the list of tasks for a specific user, so I make the following request:

GET /rest/cis/tasks?filter_spec.users.1=myuser

But I get the following error:

At least one of the parameters 'services' or 'tasks' must not be empty in the filter specification.

But I don't know what value to set in the filter_spec.services.1 parameter. What should I set in the services parameter? Can anyone write an example, please.

Thanks in advance.

Tags (1)
2 Replies
Humphry
Contributor
Contributor

Hi!!! Any ideas?

0 Kudos
mcvetanov
VMware Employee
VMware Employee

A "service" is grouping of operations (usually CRUD, but sometimes custom actions as well) on the same REST resource. It is what would be the interface in the SDK (say Java, C# or Python) which contains the methods corresponding to the API operations on the resource.

The service ID is a fully qualified name of interface from the SDK, but in lower case with underscores separating the words. In the latest versions of the vSphere Automation SDK for Java (or Python) there are constants in the interface which represent the service ID, you can see the value of these constants in the javadoc. The constants are named _VAPI_SERVICE_ID and are located in the xxxTypes base interface.

For example

REST URl pathService IDConstant from Java SDK
/vcenter/vmcom.vmware.vcenter.VM

VM (vSphere Automation SDK for Java 6.9.1)

Constant Field Values (vSphere Automation SDK for Java 6.9.1)

/vcenter/resource-poolcom.vmware.vcenter.resource_pool

ResourcePool (vSphere Automation SDK for Java 6.9.1)
Constant Field Values (vSphere Automation SDK for Java 6.9.1)