API resource listing best practice#
This section provides best practices when using API GET requests when listing
resources, and examines best practices for using a number of API request parameters and parameter values.
Note
For further details on API parameters, refer to the API Guide.
The table describes API request parameters for resource listing:
Parameter |
Description |
Value |
Default |
|---|---|---|---|
|
The list resource offset as a number. |
0 |
|
|
The maximum number of resources returned. The maximum value is 2000.
If the |
1-2000 |
50 |
|
Specify if the number of resources should be counted. If false,
the |
true, false |
true |
|
The summary attribute field to sort on. |
First summary attribute |
|
|
The direction of the summary attribute field sort (asc:ascending, desc: descending). |
asc, desc |
asc |
|
Only summary data is returned in the data object. |
true, false |
true |
|
Return a model form schema where the Field Display
Policy with name [FDP name] is applied to it. Use
|
[FDP name] |
|
|
System will respond with resource information where the data was obtained from cache. (Functionally only applicable to device models and data models). |
true, false |
true |
The table lists parameters with their best practice recommendations and considerations:
|
The value of The value |
|
No performance change if another summary attribute is specified. |
|
No performance change if either values |
|
The parameter is used by the GUI for display purposes. Timing data shows that the initial call with this parameter takes longer than subsequent ones, possibly because of cache priming after a restart. Subsequent calls show the execution time is on par with requests that do not include the parameter. |
|
Depending on the data required by the request, time can be saved if the value |
|
Execution time and memory consumption is impacted if the |
The recommended parameter values for an optimal API list request (GET) are as follows:
cached=truesummary=truecount=falsepolicy_namenot used
Example results with various parameter values (36 000 Data Number Inventory resource):
count:true, skip:0, policy_name:, limit:200, summary:false in 6.51744103432 s
count:true, skip:0, policy_name:, limit:200, summary:true in 5.6118888855 s
count:false, skip:0, policy_name:, limit:200, summary:false in 1.55350899696 s
count:false, skip:0, policy_name:policy_name=HcsDNInventoryDatFDP, limit:200,
summary:true in 5.17663216591 s
count:false, skip:0, policy_name:, limit:200, summary:true in 1.09510588646 s