HPE OneView
1748225 Members
4597 Online
108759 Solutions
New Discussion

Re: Interconnects api call only return 10 values even though I specify higher in the count.

 
MarcL1
Occasional Visitor

Interconnects api call only return 10 values even though I specify higher in the count.

/interconnects?start=0&count=50 still only returns ten values.  I have tried changing the X-API-Version to various values.  The same string will work for the enclosures and another api call where all the values are returned beyond the ten limit.  I have also tried -1 as a value.  Is the interconnect call different somehow?  I am going to need all 100+ interconnects in one file, how can I get the call to work?

7 REPLIES 7
ukdc
Advisor

Re: Interconnects api call only return 10 values even though I specify higher in the count.

Try using -1 as the value of "count" (i.e. fetch all items).

Also -- what does the "total" property inside the returned InterconnectCollection contain (this should be the total number available to fetch)?

Good Luck!

Richard.

MarcL1
Occasional Visitor

Re: Interconnects api call only return 10 values even though I specify higher in the count.

Thanks for the reply but I have already tried -1 and that returns even less members (5).  The total value is equal to 132 of which I have also tried to set count equal to but only get 10 members.

ukdc
Advisor

Re: Interconnects api call only return 10 values even though I specify higher in the count.

What happens with a non-zero start value? How about start=50 and count=40 for example (maybe count=10 if the chunk size is baked-in as 10)?

The fact that you have this mechanism working elsewhere but you run into a "hard" limit on this "branch" is very odd.

 

MarcL1
Occasional Visitor

Re: Interconnects api call only return 10 values even though I specify higher in the count.

I agree with the weirdness of this api call.  I have tried different start values and as long as the difference is 10 or greater between the start and count then it will only return 10 members.  Like you alluded it feels like a hard limit but I really hope not; I don't want to run this 14 times and figure out how to join all the calls.

ChrisLynch
HPE Pro

Re: Interconnects api call only return 10 values even though I specify higher in the count.

Unfortunately, this is a hard limit and cannot be overridden.  In order to get the full collection, you can do one of the following:

  1. Use the Python or PowerShell (Get-HPOVInterconnect) libraries, which will handle API pagination for you
  2. handle pagination yourself.

The API supports paginated collections.  Within the collection object, you will see a property called nextPageUri.  You would use this value within a loop to store the contents of the members property.


I am an HPE employee

Accept or Kudo

pshapard
New Member

Re: Interconnects api call only return 10 values even though I specify higher in the count.

Here is the rest api function I created in python 2.7 to overcome the 10 ICM limit. Please note, you will need to create a for loop to get the enclosure names.  Pass the name of each enclosure into this function and you will get all the ICMs in your enclosures.

def GetInterconnectMultiEnc(self,ip,auth,api,name):
    url = "https://%s/rest/interconnects" % ip

    querystring = {"filter":"\"'enclosureName' = %s\"" %name}
    headers = {
    'auth': auth,
    'x-api-version': api,
   }

    response = requests.request("GET", url, headers=headers,params=querystring, verify=False)
    return(json.loads(response.text))

ChrisLynch
HPE Pro

Re: Interconnects api call only return 10 values even though I specify higher in the count.

You don’t need to do that.  When you get the JSON back, it is a member collection object. Look at the nextPageUri to loop through the results to get your Interconnects.  Take a look at the GET /rest/interconnects Response Body section.  It shows you the expected JSON attributes/properties that will be returned, which is part of an InterconnectCollectionV300 object.  Our Python and PowerShell libraries handle this for you, so no need for custom scripts.


I am an HPE employee

Accept or Kudo