Manipulating Large Collection Results Requests - Intergraph Smart Instrumentation - Version 2.3 - Training - Intergraph

Intergraph Smart Instrumentation Web API Tutorial

Language
English
Product
Intergraph Smart Instrumentation
Subproduct
Web API
Search by Category
Training
Smart Instrumentation Web Version
2.3.6

The maximum number of items that can be retrieved on a single page of the payload is set to 25. The pagination uses $top and $skip query options to select the next set of data. We recommend including the $orderby query option on properties with distinct values as part of the request, so that pagination is consistent. Alternately, you can sort by multiple properties.

It is important to understand that the $count reflects the scope of the data and is not affected by the number of items showing in the page (i.e. if you ask for $top=3 the count will not necessarily be 3).

The system queries add options to the request that help with keeping the number of items displayed in the result.

Method

Description

$orderby

The $orderby query option specifies the order in which items are returned from the service.

$top

The $top query option specifies a non-negative integer n that limits the number of items displayed on the page.

$skip

The $skip query option specifies a non-negative integer n that excludes the first n items of the queried collection from the result

Get Pagination - Default

This request fetches the Items in ascending order, using the $orderby method.

  1. Select the 05.01 Pagination - Default request and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$select=Id,InstrumentName,InstrumentType,LoopName&$orderby=InstrumentName asc

    The bottom of the response displays a link to the next items, skipping the first 25 items.

  2. Click the ellipses (…) next to the request and select Duplicate from the list.

  3. Copy the link and paste it in the GET address bar to retrieve the next set of 25 items.

Get Pagination - $top=3

This request uses '$top' to include only the top number of items in the result. In our case, the request is for the first three instruments.

  1. Select the 05.02 Pagination - $top=3 request and click Send.

{{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$select=Id,InstrumentName,InstrumentType,LoopName&$orderby=InstrumentName asc&$top=3&$count=true

In this case there is no next link and the count reflects the total number of items.

Get Pagination - $top under $expand

This request expands the top three cable sets of a cable with Id=4568. This cable is "C-101-JB-DCS-001/1" from the demo database.

  • Select the 05.03 Pagination - $top under $expand request and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/CableProject('4568')?$expand=CableSetCable($count=true;$top=3)

For more information and uses of the $expand method, see Requests using $expand Method (see $expand Method Requests).