If you need to perform a simple search, you can use the SearchService.SimpleSearch method. It allows you to search for articles that contain a specific text and belong to a given category. You will be able to specify paging values and a sort option .
The SimpleSearch parameter contains the following fields
- CategoryId: The root category
- SearchText: The text will be searched in titles and descriptions
- Language: The articles’ language (example: German, French, both)
- PageSize: The number of articles per page
- PageNumber: The page index
- SortBy: The column to which the sort will be applied
- AscendingSort: Set to true to sort in ascending order (false for descending)
- CategoryInfos: Set to true to retrieve the number of articles by category
JSON Example
- POST https://ws.ricardo.ch/ricardoapi/SearchService.Json.svc/SimpleSearch HTTP/1.1
- Content-Type: application/json
- Ricardo-Username: [YOUR TokenCredential]
- Host: ws.betaqxl.com
{
"simpleSearchParameter": {
"AscendingSort": true,
"CategoryId": 1,
"CategoryInfos": true,
"Language": 1,
"PageNumber": 1,
"PageSize": 10,
"SearchText": "test",
"SortBy": 0
}
}
SOAP Example
- POST https://ws.ricardo.ch/RicardoApi/SearchService.Soap.svc HTTP/1.1
- Content-Type: application/soap+xml; charset=utf-8
- Host: ws.betaqxl.com
- Accept-Encoding: gzip, deflat
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://ricardo.contracts/ISearchService/SimpleSearch</a:Action>
<a:MessageID>urn:uuid:82134e38-5a82-41f1-9b70-c2d1ef6061d0</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken>
<Username>YOUR TOKEN</Username>
<Password></Password>
</UsernameToken>
</Security>
</s:Header>
<s:Body>
<SimpleSearch xmlns="http://ricardo.contracts">
<simpleSearchParameter xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AscendingSort>true</AscendingSort>
<CategoryId>1</CategoryId>
<CategoryInfos>true</CategoryInfos>
<Language>SwitzerlandFrAndDe</Language>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<SearchText>test</SearchText>
<SortBy>Default</SortBy>
</simpleSearchParameter>
</SimpleSearch>
</s:Body>
</s:Envelope>