VMware Cloud Community
SylvainM2011101
Contributor
Contributor

vRA API REST call get more then 20 items

I can't figure out how to get the API call for entitledCatalogItems to return more then 20 items

(powershell)

$vRAURI = "https://vcac"

$login=""|Select username, password, tenant

$login.username = "login"

$login.password = "passwd"

$login.tenant = "tenant"

# http://pubs.vmware.com/vra-62/index.jsp#com.vmware.vra.programming.doc/GUID-87BD5DAE-53D3-4463-9FBC-...

#auth

if(!$ApiToken) { $ApiToken = Invoke-RestMethod -Method Post -uri "$($vRAURI)/identity/api/tokens" -Body (ConvertTo-Json $login) -ContentType "application/json"}

#List Shared and Private Catalog Items

$entitledCatalogItems = Invoke-RestMethod -Method Get -uri "$($vRAURI)/catalog-service/api/consumer/entitledCatalogItems" -Headers @{"Authorization"="Bearer $($ApiToken.id)"}  -ContentType "application/json"

$entitledCatalogItems.metadata

size          : 20

totalElements : 22

totalPages    : 2

number        : 1

offset        : 0

From the API doc from the URL above, it's not showing any parameters to pass to query the next page

Input

Description

URL

https://$host/catalog-service/api/consumer/catalogItems

$host

Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

Reply
0 Kudos
1 Reply
SylvainM2011101
Contributor
Contributor

nevermind I found my answer in the downloadable zip for the API programming

add ?limit=xxxx to uri

$entitledCatalogItems = Invoke-RestMethod -Method Get -uri "$($vRAURI)/catalog-service/api/consumer/entitledCatalogItems?limit=9999" -Headers @{"Authorization"="Bearer $($ApiToken.id)"}  -ContentType "application/json"

$entitledCatalogItems.content.count

22

Per API doc in zip file

Parameters

namedescriptiontypedefault
pagePage Numberquery1
limitNumber of entries per pagequery20
$orderbyMultiple comma-separated properties sorted in ascending or descending orderquery
$topSets the number of returned entries from the top of the response (total number per page in relation to skip)query
$skipSets how many entries you would like to skipquery
$filterBoolean expression for whether a particular entry should be included in the responsequery
Reply
0 Kudos