|
Post by tophercantrell on May 26, 2017 18:59:48 GMT
We are just starting to implement the Redfish API. I am new to Redfish and this Forum, so bear with me.
I have 8000 entries in my log. The log collection is defined as an array of objects -- not an array of references. The resulting JSON object is rather large.
I don't see a way to paginate the request, say to ask for items 4000 through 4049.
Surely others have run into large collections here and in other parts of the API. Any recommendations?
|
|
|
Post by mraineri on May 26, 2017 20:15:24 GMT
The LogEntryCollection entity is a type of Resource Collection. Resource Collections are allowed to be broken down into multiple pages; check out the "NextLink property and partial results" section in the Redfish spec. Even though LogEntryCollection expands the LogEntry resources in the response, you're still allowed to use paging.
Essentially, you could break it down so use the "Members@odata.nextLink" property to point the client where to read the next set of items in the collection. For example:
Page 1 (found at /redfish/v1/ExampleEntryCollection)
{ "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", "@odata.id": "/redfish/v1/ExampleEntryCollection", "@odata.type": "#LogEntryCollection.LogEntryCollection", "Name": "Sample Collection", "Members@odata.count": 10, "Members": [ { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing1", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing2", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing3", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing4", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing5", "SensorNumber": 1, <Other properties> } ], "Members@odata.nextLink": "/redfish/v1/ExampleEntryCollection/Page2/$ref" }
And Page 2 (found at /redfish/v1/ExampleEntryCollection/Page2/$ref)
{ "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", "Members@odata.count": 10, "Members": [ { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing6", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing7", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing8", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing9", "SensorNumber": 1, <Other properties> }, { "@odata.id": "/redfish/v1/ExampleEntryCollection/Thing10", "SensorNumber": 1, <Other properties> } ] } Take note that the Members@odata.count is 10 on both pages, which is the total number of entries in the collection (not the number of entries on the page)
|
|
|
Post by gericson on May 29, 2017 19:06:05 GMT
tophercantrell: There are some additional options and things to consider. 1) Redfish protocol is based on the OData protocol, so for more background see there. For most purposes Redfish is a proper subset. 2) Redfish protocol supports the $skip query parameter. So for example, you can skip the first 4000 records: GET "/redfish/v1/ExampleEntryCollection?$Skip=4000" 3) An entity type that is a Redfish resource collection is not an OData collection, but for the most part, Redfish treats it as one. 4) OData conformant access to the collected entities of a resource collection would look like: GET "/redfish/v1/ExampleEntryCollection/Members?$Skip=4000" NOTE: For various reasons, the client should generally not rely on returning the same members or in the same order across multiple GETs for the same resource. 5) In the schema, you noted that the logEntryCollection/Members navigation property is annotated with <Annotation Term="OData.AutoExpand"/> This is a default behavior. You can override this by adding the /$ref segment to the URL to have it return only the references. GET "/redfish/v1/ExampleEntryCollection/$ref 6) The nextlink, should be appropriate to continue the request. For that reason, the /$ref segment should not be in the Nextlink response unless references are being returned. The example should show. "Members@odata.nextLink": "/redfish/v1/ExampleEntryCollection/Page2"
|
|
|
Post by tophercantrell on May 30, 2017 12:16:41 GMT
That all makes perfect sense. Thanks for detailed information and example!
|
|