Retrieving record instances using REST API
The RecordInstanceDataPageQuery REST API is used to retrieve record instances from any record definition based on certain filtering conditions or query predicates.
Use the following syntax for RecordInstanceDataPageQuery:
&pageSize=<<any valid number as pageSize>>
&startIndex=<<any valid number as startIndex>>
&recorddefinition=<<fully qualified name of the recorddefinition>>
&propertySelection=<<comma separated fieldIds>>
&sortBy=<<comma separated fieldIds>>
&<<fieldID>>=<<fieldvalue>>
&<<distinct>>=<<boolean value>>
Which includes the following parameters:
Parameter | Description |
---|---|
dataPageType | Specifies the fully qualified class name of the RecordInstanceDataPageQuery. Note: Do not change the value of this parameter. |
pageSize | Specifies how many records should be fetched on this page. |
startIndex | Specifies the first record's index of the "page". For example:
|
recorddefinition | Specifies the name of the record definition. |
(Optional) propertySelection | Specifies the list of comma-separated properties which should appear in the response object, that is, the DataPage.data. The propertySelection parameter accepts numeric fieldIds. For example,
|
(Optional) sortBy | Specifies the list of comma-separated properties by which data should get sorted. The sortBy parameter accepts numeric fieldIds. To indicate descending sort, prefix the value with a hyphen (-). For example:
|
(Optional) fieldId | Specifies the filtering condition of the query, using field IDs of the record definition. You can specify multiple name-value pairs and the relational qualification between these name-value pairs is always set as AND. For example:
|
queryExpression | Specifies complex queries that should be supported by RecordInstanceDataPageQuery. You can specify the attribute Id in place of the attribute name, and specify the existing way of adding qualifications. Make sure that you follow the URL encoding rules while specifying queryExpression. For example:
|
(Optional) distinct | Specifies that only distinct values should be retrieved and displayed in the query results. |
Example 1
To fetch the tasks where the 'status' of the task is new, use the following REST API call:
&pageSize=500&startIndex=0&recorddefinition=com.example.taskmanager-lib:Task&7=new
In this example, the instances will be fetched from com.example.taskmanager-lib:Task RecordDefinition and 7 is one of the FieldDefinitinition's ID on this RecordDefinition.
Example 2
To fetch the tasks where the 'status' of the task is new and data is to be fetched for fieldIds 1, 8, 7, 379 and the tasks should be sorted on fieldId 1, use the following REST API call:
pageSize=500&startIndex=0&recorddefinition=com.example.taskmanager-lib:Task&7=new&propertySelection=1,8,7,379&sortBy=1
In this example, the instances will be fetched from com.example.taskmanager-lib:Task RecordDefinition and 7 is one of the FieldDefinition's ID on this RecordDefinition. 1, 8, 7, 379 are Ids of the FieldDefinitions on this RecordDefinition.
Example 3
To fetch the tasks where the 'Description' of the task is Printing, use the following REST API call:
&pageSize=500&startIndex=0&recorddefinition=com.example.taskmanager-lib:Task&queryExpression=(%27Description%27%3D%22Printing%22)
In this example, the instances will be fetched from com.example.taskmanager-lib:Task RecordDefinition.
Related topics