getListItems()

Pixelsilk API function to get a collection of ListItems
Parameters:
The parameter below called "sorts" is a collection. Of what is it a collection? Think about another collection consisting of two key/value pairs. The first key is the word "field"; the value is the name of that field. The second key is the word "direction"; the value is one of two possible directions: ascending(asc) or descending(desc). "Sorts" is a collection of instances of that other collection.

The parameter below called "filters" is also a collection. Of what is it a collection? It is a collection of instances of another collection. That other collection has three key/value pairs in it. The first key is the word "field"'; its value is the name of a field. The second key is the word "comparison"; its value is a comparator from among  eq, ne, gt, lt, contains, and notcon. The third key is the word "value"; its value is the value to filter with. It might be text, a number, a boolean, and so on.

The parameter below called "filterrel" stands for filter relationship. It contains boolean expressions like "(filter1 OR (filter2 AND filter3))."

sorts: a collection of fields and directions for sorting (see above)
filters: a collection of fields, comparators, and (partial) field value for filtering (see above)
filterrel: the relationship to govern the filters (see above)
pagesize: the number of list items per page (section) for pagination
page: the page number to retrieve ListItems for
path: the path to the page (section) relative to the root
fields: the ListItem fields to bring back with the ListItems

Output:
The function getListItems returns an object that can be enumerated to extract the ListItems from it.

C# Example:
For this example, imagine the code has access to variables that have been assigned to in keeping with the descriptions above. Imagine these variables have "Var" on the end of their names.
IList<IDictionary<string, string>> sorts = sortsVar;
IList<IDictionary<string, string>> filters = filtersVar;
string filterrel = filterrelVar;
string pagesize = "1000";
string page = pageVar;
string path = pathVar;
IList<string> fields = fieldsVar;
object itemList = GetListItems(sorts, filters, filterrel, pagesize, page, path, fields);
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/getListItems HTTP/1.1
HOST: www.example.com
Content-Length: 1377
Content-Type: application/x-www-form-urlencoded
Cookie: auth=415E9771A290...5D778AD27559

Request Data:
Unencoded Data:
json={
   "sorts":[
      {
         "field":"Title",
         "direction":"Ascending"
      },
      {
         "field":"BriefDescription",
         "direction":"Ascending"
      },
      {
         "field":"FullDescription",
         "direction":"Ascending"
      }
   ],
   "filters":[
      {
         "field":"Title",
         "comparison":"contains",
         "value":"Item"
      },
      {
         "field":"BriefDescription",
         "comparison":"contains",
         "value":"item"
      },
      {
         "field":"FullDescription",
         "comparison":"contains",
         "value":"item"
      }
   ],
   "filterrel":"filter1 OR filter2 OR filter3",
   "pagesize":"1000",
   "page":"1",
   "path":"/OtherList/configuration/",
   "fields":[
      "Title",
      "BriefDescription",
      "FullDescription"
   ]
}&token=7AdbNHZQBtwc...RPTEK8UvSUQ=

Url-encoded Data:
json=%7b%0d%0a+++...%5d%0d%0a%7d&token=7AdbNHZQBtwc...TEK8UvSUQ%3d

Response Headers:
HTTP/1.1 200 OK
Set-Cookie: auth=3C497C493D9A...823490B629B; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 231

Response Data:
[{"id":"c9d7ae3c-9b8f-4fa8-ad73-9dcac07cc561",
"seriesId":"00000000-0000-0000-0000-000000000000",
"Title":"Second Item",
"BriefDescription":"The second item",
"FullDescription":"The second item on the configuration page\u003cbr /\u003e"},
{"id":"fc1f974a-92e0-4b8b-bc5f-a4a639cf0386",
"seriesId":"00000000-0000-0000-0000-000000000000",
"BriefDescription":"The first item",
"FullDescription":"The first item on the configuration page\u003cbr /\u003e",
"Title":"First Item"}]

JavaScript Example:
Method Call:
pixelsilk2.getListItems(input, callback);

Input Object:
{
    sorts:[
        {
            field:"Title",
            direction:"Ascending"
        },
        {
            field:"BriefDescription",
            direction:"Ascending"
        },
        {
            field:"FullDescription",
            direction:"Ascending"
        }
    ],
    filters:[
        {
            field:"Title",
            comparison:"contains",
            value:"item"
        },
        {
            field:"BriefDescription",
            comparison:"contains",
            value:"item"
        },
        {
            field:"FullDescription",
            comparison:"contains",
            value:"item"
        }
    ],
    filterrel:"filter1 OR filter2 OR filter3",
    pagesize:"1000",
    page:"1",
    path:"/OtherList/configuration/",
    fields:[
        "Title",
        "BriefDescription",
        "FullDescription"
    ]
}

Returned Data:
[
    {
        "id":"fc1f974a-92e0-4b8b-bc5f-a4a639cf0386",
        "seriesId":"00000000-0000-0000-0000-000000000000",
        "BriefDescription":"The first item",
        "FullDescription":"The first item on the configuration page",
        "Title":"First Item"
    }
]

Back to List Items »