VMware Cloud Community
cloudyred
Enthusiast
Enthusiast
Jump to solution

Unable to add paging for VCACCAFE propertyClient.getWithVariables methods

Hi,

Think I might have a paging issue now for tenants with more than 20 properties.

Original Code:

var propertyClient = vraHost.createPropertyClient();

var propDefinitions = propertyClient.get("propertydefinitions/");

System.log(propDefinitions);

Result: Pagesize is 20.

  "metadata": {

      "size": 20,

      "totalElements": 0,

      "totalPages": 0,

      "number": 1,

      "offset": 0

   }

New Code I'm trying that I can't get working. Any suggestions?

var propertyClient = vraHost.createPropertyClient();

// Neither of the below are having any effect on paging.

//var propDefinitions = propertyClient.getWithVariables("propertydefinitions/",["page=1","limit=40"]);

var propDefinitions = propertyClient.getWithVariables("propertydefinitions/",["$skip=0","$top=40"]);

System.log(propDefinitions);

Result: Pagesize is 20.

  "metadata": {

      "size": 20,

      "totalElements": 0,

      "totalPages": 0,

      "number": 1,

      "offset": 0

   }

vRA Access Log:

192.168.7.118 [14/Oct/2019:10:16:10 -0400][149 ms] "GET /properties-service/api/propertydefinitions/ HTTP/1.1" 200 5747 [tomcat-http--378]

References:

https://vrafqdn/component-registry/services/docs#!/default/get_api_propertydefinitions

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I don't have a vRA instance at hand to verify it, but I think the second argument of getWithVariables() provides values to replace path variables in the first argument.

So could you try if something like the following works?

var propDefinitions = propertyClient.getWithVariables("propertydefinitions/?page={page}&limit={limit}", ["1","40"]);

So the idea is that "1" will replace "{page}" and "40" will replace "limit", producing a query URL like "propertydefinitions/?page=1&limit=40"

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I don't have a vRA instance at hand to verify it, but I think the second argument of getWithVariables() provides values to replace path variables in the first argument.

So could you try if something like the following works?

var propDefinitions = propertyClient.getWithVariables("propertydefinitions/?page={page}&limit={limit}", ["1","40"]);

So the idea is that "1" will replace "{page}" and "40" will replace "limit", producing a query URL like "propertydefinitions/?page=1&limit=40"

cloudyred
Enthusiast
Enthusiast
Jump to solution

Perfect, thanks for the quick update. That's working great.

Cheers, Red

Reply
0 Kudos