You can use the search endpoint to retrieve search results for any text-based query with filtering options for type of application, groups, etc. When a custom document is displayed it will also include a SearchFields node containing some special fields and any custom fields you have added to the index.
See Example search queries for specific examples of endpoint urls to limit results using filters.
EndpointGETapi.ashx/v2/search.xml (or .json)
RequestSearchResultListRequest
| Query |
Optional |
Query is not required but you should use either Query or Filters otherwise you'll get all documents in the search index. |
| Filters |
Optional |
Filters is not required but you should use either Query or Filters otherwise you'll get all documents in the search index. |
| Sort |
Optional |
Two options for sort are titlesort and date and it also supports asc and desc. To sort by title ascending use sort=titlesort+asc, to sort by date descending use sort=date+desc. |
| StartDate |
Optional |
StartDate |
| EndDate |
Optional |
EndDate |
| Collapse |
Optional |
Result collapsing will default to true if not specified. |
| FieldFacets |
Optional |
FieldFacets |
| DateRangeFacets |
Optional |
DateRangeFacets |
| FieldFilters |
Optional |
FieldFilters |
| DateRangeFilters |
Optional |
DateRangeFilters |
| Tags |
Optional |
Comma delimited list of tags. |
| LogicallyOrTags |
Optional |
Whether to AND or OR tags specified in the Tags parameter. Default is False, logically AND tags. |
| PageSize |
Optional |
Specify the number of results to return per page. If not set the default is 20. The max is 100. |
| PageIndex |
Optional |
Specify the page number of paged results to return. Zero-based index. If not specified the default is 0. |
Example (C#)
var webClient = new WebClient();
// replace the "admin" and "Admin's API key" with your valid user and apikey!
// http://telligent.com/community/developers/w/wiki/how-to-generate-an-api-key.aspx
var adminKey = String.Format("{0}:{1}", "Admin's API Key", "admin");
var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));
webClient.Headers.Add("Rest-User-Token", adminKeyBase64);
var requestUrl = "http://mysite.com/api.ashx/v2/search.xml?query=sample"; // or .json
var xml = webClient.DownloadString(requestUrl);
Console.WriteLine(xml);
Example Response (XML)
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Info />
<Warnings />
<Errors />
<SearchResults PageSize="20" PageIndex="0" TotalCount="2">
<SearchResult>
<Id>Telligent.Evolution.Wikis.Components.Wiki, Telligent.Evolution.Wikis|1</Id>
<ContentId>1</ContentId>
<Title>Sample Wiki</Title>
<Url>http://localhost/tetest1/sample_group/w/sample_wiki/default.aspx</Url>
<Date>2011-06-22T19:29:00-04:00</Date>
<ContentType>wikiapp</ContentType>
<Body />
<BestMatch />
<BestMatchTitle>Sample Wiki</BestMatchTitle>
<SearchFields>
<category>wiki</category>
</SearchFields>
<SectionId />
<ThreadId />
<WikiId>1</WikiId>
<Group>
<Id>3</Id>
<AvatarUrl>http://mysite.com/utility/defaulthub.gif</AvatarUrl>
<DateCreated>2011-01-17T10:00:58.133</DateCreated>
<Description />
<Key>sample_group</Key>
<Name>Sample Group</Name>
<ParentGroupId>1</ParentGroupId>
<Url>http://mysite.com/sample_group/default.aspx</Url>
<TotalMembers>0</TotalMembers>
<HasGroups>true</HasGroups>
<GroupCount>2</GroupCount>
<GroupType>Joinless</GroupType>
<EnableGroupMessages>true</EnableGroupMessages>
<EnableContact>false</EnableContact>
<SearchUniqueId>Telligent.Evolution.Components.Group, Telligent.Evolution.Components|3</SearchUniqueId>
<ExtendedAttributes />
</Group>
<IndexedAt>2011-06-22T15:40:00.465-04:00</IndexedAt>
</SearchResult>
<SearchResult>
<Id>Telligent.Evolution.MediaGalleries.Components.MediaGallery, Telligent.Evolution.MediaGalleries|1</Id>
<ContentId>1</ContentId>
<Title>Sample Media</Title>
<Url>http://localhost/tetest1/sample_group/m/samplemedia/default.aspx</Url>
<Date>2011-06-22T15:29:00-04:00</Date>
<ContentType>fileapp</ContentType>
<Body />
<BestMatch />
<BestMatchTitle>Sample Media</BestMatchTitle>
<SearchFields>
<category>file</category>
</SearchFields>
<SectionId>1</SectionId>
<ThreadId />
<WikiId />
<Group>
<Id>3</Id>
<AvatarUrl>http://mysite.com/utility/defaulthub.gif</AvatarUrl>
<DateCreated>2011-01-17T10:00:58.133</DateCreated>
<Description />
<Key>sample_group</Key>
<Name>Sample Group</Name>
<ParentGroupId>1</ParentGroupId>
<Url>http://mysite.com/sample_group/default.aspx</Url>
<TotalMembers>0</TotalMembers>
<HasGroups>true</HasGroups>
<GroupCount>2</GroupCount>
<GroupType>Joinless</GroupType>
<EnableGroupMessages>true</EnableGroupMessages>
<EnableContact>false</EnableContact>
<SearchUniqueId>Telligent.Evolution.Components.Group, Telligent.Evolution.Components|3</SearchUniqueId>
<ExtendedAttributes />
</Group>
<IndexedAt>2011-06-22T15:40:01.536-04:00</IndexedAt>
</SearchResult>
</SearchResults>
</Response>
Example Response (JSON)
{
"PageSize": 20,
"PageIndex": 0,
"TotalCount": 2,
"SearchResults": [
{
"Id": "Telligent.Evolution.Wikis.Components.Wiki, Telligent.Evolution.Wikis|1",
"ContentId": "1",
"Title": "Sample Wiki",
"Url": "http://localhost/tetest1/sample_group/w/sample_wiki/default.aspx",
"Date": "2011-06-22T19:29:00-04:00",
"ContentType": "wikiapp",
"Body": "",
"BestMatch": "",
"BestMatchTitle": "Sample Wiki",
"SearchFields": [
{
"Name": "category",
"Value": "wiki"
}
],
"SectionId": null,
"ThreadId": null,
"WikiId": 1,
"Tags": null,
"Group": {
"AvatarUrl": "http://mysite.com/utility/defaulthub.gif",
"DateCreated": "2011-01-17T10:00:58.133",
"Description": "",
"Key": "sample_group",
"Name": "Sample Group",
"ParentGroupId": 1,
"Url": "http://mysite.com/sample_group/default.aspx",
"TotalMembers": 0,
"HasGroups": true,
"GroupCount": 2,
"GroupType": 0,
"EnableGroupMessages": true,
"EnableContact": false,
"SearchUniqueId": "Telligent.Evolution.Components.Group, Telligent.Evolution.Components|3",
"ExtendedAttributes": [],
"Id": 3
},
"Users": null,
"IndexedAt": "2011-06-22T15:40:00.465-04:00"
},
{
"Id": "Telligent.Evolution.MediaGalleries.Components.MediaGallery, Telligent.Evolution.MediaGalleries|1",
"ContentId": "1",
"Title": "Sample Media",
"Url": "http://localhost/tetest1/sample_group/m/samplemedia/default.aspx",
"Date": "2011-06-22T15:29:00-04:00",
"ContentType": "fileapp",
"Body": "",
"BestMatch": "",
"BestMatchTitle": "Sample Media",
"SearchFields": [
{
"Name": "category",
"Value": "file"
}
],
"SectionId": 1,
"ThreadId": null,
"WikiId": null,
"Tags": null,
"Group": {
"AvatarUrl": "http://mysite.com/utility/defaulthub.gif",
"DateCreated": "2011-01-17T10:00:58.133",
"Description": "",
"Key": "sample_group",
"Name": "Sample Group",
"ParentGroupId": 1,
"Url": "http://mysite.com/sample_group/default.aspx",
"TotalMembers": 0,
"HasGroups": true,
"GroupCount": 2,
"GroupType": 0,
"EnableGroupMessages": true,
"EnableContact": false,
"SearchUniqueId": "Telligent.Evolution.Components.Group, Telligent.Evolution.Components|3",
"ExtendedAttributes": [],
"Id": 3
},
"Users": null,
"IndexedAt": "2011-06-22T15:40:01.536-04:00"
}
],
"Info": [],
"Warnings": [],
"Errors": []
}