Advanced LoadCollection
This variation of the LoadCollection API returns the records of a specified IDO collection. Unlike the basic LoadCollection API and the LoadCollection with properties API, this variation offers various options to filter the return results.
Parameters
| Name | In | Required? | Description |
|---|---|---|---|
| responsetype | Path | Yes | Response request data format: Supply any of these values:
|
| ido | Path | Yes | This is the name of the IDO collection. |
| props | Path | Yes | This is a comma-delimited list of properties. |
| filter | Query | No | This parameter restricts the result set. This can be any valid SQL WHERE clause. |
| orderby | Query | No | This parameter is a comma-delimited list of properties that specifies the order in which the result set should be sorted. To have a property sorted in descending order, use the DESC keyword after the property name. |
| recordcap | Query | No | This parameter specifies how many records are to be retrieved in each request. These are the valid values:
|
| distinct | Query | No | This parameter specifies that a set of data that represents only distinct combinations of requested properties is to be returned. |
| clm | Query | No | This parameter is the name of a custom load method.
This parameter can be used in conjunction with the clmparms parameter. |
| clmparms | Query | No | This parameter is used for a comma-delimited list of custom load methods. |
| loadtype | Query | No | This parameter is used for load collection paging. It is used in conjunction with the bookmark parameter.
To use, specify one of these types:
|
| bookmark | Query | No | This parameter is for the bookmark ID. Bookmark IDs serve as a reference when you want to get to the next or previous records in a collection.
The “bookmark” value uses this format: <B><P><p>UserId</p></P><D><f>false</f></D><F><v>1</v></F><L><v>2</v></L></B>
where:
For an example of this, see Example: Bookmark IDs in LoadCollection responses. |
| pqc | Query | No | This parameter specifies a method to execute once for each row in the result set after the query is completed.
This is the equivalent of the WinStudio PQ option in Load/Save Overrides and uses the same syntax. |
| ro | Query | No | This parameter specifies that the return results are to be marked as "Read Only".
When this is set to True, retrieved records do not include the _ItemID property, which can be substantial for update and delete operations. |
Headers
| Name | Description |
|---|---|
| Authorization | If the API is called directly, then a Mongoose security token is obtained through a call to the GetSecurityToken API.
If the API is called through ION API, then a valid OAuth2.0 bearer token is provided by ION API. |
| X-Infor-MongooseConfig | This is the name of a configuration that is available on the application server. This is required only when using the Mongoose API through the ION API. |
Request data
None
Response data in XML format
<MGRestResponse xmlns="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Items> <item> <p>1</p> <p>sa</p> </item> </Items> <Message i:nil="true"/> <MessageCode>0</MessageCode> </MGRestResponse>
Response data in JSON format
{
"Items": [
[ "1", "sa" ]
],
"Message": null,
"MessageCode": 0
}
Response data in JSON Stream format
{
"Message": "Success",
"MessageCode": 0,
"Items": [
{
"UserId": 1,
"Username": "sa"
}
]
}
Response data in Full Schema format
<NewDataSet> <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="UserNames" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="UserNames"> <xs:complexType> <xs:sequence> <xs:element name="UserId" msdata:Caption="sUserID" type="xs:decimal"/> <xs:element name="Username" msdata:Caption="sUsername" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <UserNames> <UserId>1</UserId> <Username>sa</Username> </UserNames> </NewDataSet>
Example
This example code retrieves the user ID, username, and user description from the Users table for the 'sa' user and uses the filter parameter.
string xml = string.Empty;
using ( HttpClient client = new HttpClient() )
{
// optionally, you can use json as the response type
string ido = "UserNames";
string properties = "UserId, Username, UserDesc";
string filter = "Username%20LIKE%20'sa'";
string requestUrl = $"http://server/IDORequestService/MGRESTService.svc/xml/{ido}/{properties}/adv?filter={filter}";
// provide token in the Authorization header
client.DefaultRequestHeaders.TryAddWithoutValidation(
"Authorization",
"b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDbQj…==" );
HttpResponseMessage response = client.GetAsync( requestUrl ).Result;
using ( HttpContent content = response.Content )
{
Task<string> result = content.ReadAsStringAsync();
xml = result.Result;
}
}