GET api/Jokes?query={query}&page={page}&resultsPerPage={resultsPerPage}
Gets a collection of jokes that contain the query word(s).
Request Information
URI Parameters
| Name | Description | Type | Additional information |
|---|---|---|---|
| query |
A search query. i.e words separated by spaces. |
string |
Required |
| page |
Page number (one-based). |
integer |
Default value is 1 |
| resultsPerPage |
Number of results to return per page. |
integer |
Default value is 50 |
Body Parameters
None.
Response Information
Resource Description
Returns a collection of jokes that contain the query word(s).
SearchResultsModel| Name | Description | Type | Additional information |
|---|---|---|---|
| PaginationModel | PaginationModel |
None. |
|
| Jokes |
The list of jokes on the current page. |
Collection of JokeQnaModel |
None. |
| Query |
The search query. |
string |
None. |
Response Formats
application/json, text/json
Sample:
{
"PaginationModel": {
"TotalResults": 1,
"Page": 2,
"TotalPages": 3,
"ResultsPerPage": 4
},
"Jokes": [
{
"JokeId": 1,
"IsVerified": true,
"Question": "sample string 2",
"Answer": "sample string 3"
},
{
"JokeId": 1,
"IsVerified": true,
"Question": "sample string 2",
"Answer": "sample string 3"
}
],
"Query": "sample string 1"
}
text/xml
Sample:
<SearchResultsModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/VeryPunny.Models">
<Jokes>
<JokeQnaModel>
<Answer>sample string 3</Answer>
<Question>sample string 2</Question>
<IsVerified>true</IsVerified>
<JokeId>1</JokeId>
</JokeQnaModel>
<JokeQnaModel>
<Answer>sample string 3</Answer>
<Question>sample string 2</Question>
<IsVerified>true</IsVerified>
<JokeId>1</JokeId>
</JokeQnaModel>
</Jokes>
<PaginationModel>
<Page>2</Page>
<ResultsPerPage>4</ResultsPerPage>
<TotalPages>3</TotalPages>
<TotalResults>1</TotalResults>
</PaginationModel>
<Query>sample string 1</Query>
</SearchResultsModel>