# API - Keyword Query
### 電文結構
````json
Request:
{
"rqheader":{...},
"rqbody":{...}
}
Response:
{
"rsheader":{...},
"rsbody":{...}
}
````
### 說明
> Request URL: https://admindev.agrianalytis.tw/api/keyword/query
> Request Method: POST
> Content-Type: application/json; charset=UTF-8
> X-Requested-With: XMLHttpRequest
> Request Payload: json format string
## Request
### rqheader參數:
| Key | Description | Remark |
|:---------:|:--------------------:|:----------------:|
| user_type | 表示前端或後端使用者 | frontend/backend |
| api_token | api_token | |
| user_sn | 使用者序號(system_user) | |
### rqbody參數:
| Key| Description | Option | Type | Remark |
| :---:| :---: | :---:| :---:| :---:|
|page|搜尋第幾頁的資料 |✓|Int|從1開始|
|rows_per_page|每頁資料筆數 |✓|Int||
|topic_sn|主題序號||Array||
### 範例
````json
{
"rqheader":{
"user_type":"frontend",
"api_token":"",
"user_sn":""
},
"rqbody":{
"page": 1,
"rows_per_page": 2,
"topic_sn":[1,2,3,4,5,6,7,8,9]
}
}
````
## Response
### rsheader參數:
| Key| Description | Remark |
| :---:| :---: | :---:|
|returnCode|HTTP 回傳代碼 ||
|msg|Server端訊息 ||
### rsbody參數:
| Key | Description | Type | Remark |
|:--------:|:-----------:|:-----:|:---------------------:|
| keywords | 關鍵字 | Array | 以usage_count大小排序 |
| usage_count_per_year | 每一年的使用次數 | Array | 以最近的年份開始排序 |
### 範例
````json
{
"rsheader": {
"return_code": 200,
"msg": "success"
},
"rsbody": {
"keywords": [
{
"sn": 23,
"word": "simulation",
"usage_count": 210,
"usage_count_per_year":[
{ "2000": 110 } ,
{ "1999" : 100}
]
},
{
"sn": 4,
"word": "dynamic programming",
"usage_count": 18
"usage_count_per_year":[
{ "2000": 9 } ,
{ "1999" : 9}
]
}
]
}
}
````