LoadJson

The LoadJson method uses the LoadCollection method of an IDO to query either an IDO collection or a database table and return the results to the user in JSON format.

Syntax

public string LoadJson( string strSessionToken,
                        string strIDOName,
                        string strPropertyList,
                        string strFilter,
                        string strOrderBy,
                        string strPostQueryMethod,
                        int iRecordCap )

Parameters

Name Description
strSessionToken This is the session token obtained through a call to the CreateSessionToken API.
strIDOName This is the name of the IDO collection.
strPropertyList This is a comma-delimited list of the IDO properties.
strFilter This parameter allows you to filter the results of the operation. You can use ny valid SQL WHERE clause syntax.
strOrderBy This is a comma-delimited list of properties that govern the order in which the result set should be sorted. To sort a given property in descending order, use the DESC keyword after the property name.
strPostQueryMethod 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 PQ option in Load/Save Overrides and uses the same syntax.
iRecordCap

This parameter determines how many records are to be retrieved in one request. Values are:

  • -1 – 200 records are retrieved.
  • 0 – All records are retrieved.
  • Any other positive integer – The specified number of records are retrieved.

Output

Returns a JSON string containing the results of the query. The returned data can be filtered by any IDO-level filters. For information about IDO filters, see the online help.

This is an example of JSON output:

{
  "IDOName": "UserNames",
  "Items": [
   {
      "EditStatus": 0,
      "ID": "PBT=[UserNames] UserNames.DT=[2019-05-03 13:24:07.080] UserNames.ID=[2bebf824-6b0f-4725-9150-da7303cc86ec]",
      "Properties": [
         {
            "Property": "11",
            "Updated": false
         },
         {
            "Property": "sa",
            "Updated": false
         },
         {
            "Property": "System Admin",
            "Updated": false
         }
      ]
   },
    {
      "EditStatus": 0,
      "ID": "PBT=[UserNames] UserNames.DT=[2019-07-25 11:40:06.753] UserNames.ID=[c3878782-0843-4be7-8c0f-dad8dc00a6d7]",
      "Properties": [
        {
          "Property": "32",
          "Updated": false
        },
        {
          "Property": "jdelacruz",
          "Updated": false
        },
        {
          "Property": "Juan Dela Cruz",
          "Updated": false
        }
      ]
    }
  ],
  "PropertyList": [
    "UserId",
    "Username",
    "UserDesc"
  ]
}

Example

string sessionToken = "b/XdI6IQzCviZOGJ0E+002…5vl903teP0jSDwkFs";
string ido = "UserNames";
string properties = "UserId, Username, UserDesc";
string filter = string.Empty;
string orderBy = "UserId";
string postQueryMethod = string.Empty;
int recordCap = -1;
 
IDOWebService.DOWebServiceSoapClient soapClient = new 
IDOWebService.DOWebServiceSoapClient();
string json = soapClient.LoadJson( sessionToken, ido, properties, filter, orderBy, postQueryMethod, recordCap );