## 授權機制
[授權機制](授權機制)
## 觸發器接口
#### 獲取觸發器列表
**Request**
```
GET /agents/{agentId}/actions
```
**Url parameters**
| Parameters | |
| -------- | -------- |
| page | 頁碼,從0開始,default: 0 |
| size | 每頁記錄數, default: 20 |
**Request body**
```
EMPTY
```
**Response body**
```
{
"content": [
object(Action)
]
"pagination": {
"totalElements": number,
"page": number,
"size": number
}
}
```
> resource <a href = "#Action">Action</a>
#### 獲取觸發器信息
**Request**
```
GET /agents/{agentId}/actions/{actionId}
```
**Path parameters**
| Parameters | |
| -------- | -------- |
| agentId | Agent ID |
| actionId | Action ID |
**Request body**
```
EMPTY
```
**Response body**
> object( <a href = "#Action">Action</a>)
#### 創建觸發器
**Request**
```
POST /agents/{agentId}/actions
```
**Path parameters**
| Parameters | |
| -------- | -------- |
| agentId | Agent ID |
**Request body**
> object( <a href = "#ActionInput">ActionInput</a>)
**Response body**
> object( <a href = "#Action">Action</a>)
#### 修改觸發器信息
**Request**
```
POST /agents/{agentId}/actions/{actionId}
```
**Path parameters**
| Parameters | |
| -------- | -------- |
| agentId | Agent ID |
| actionId | Action ID |
**Request body**
> object( <a href = "#ActionInput">ActionInput</a>)
**Response body**
> object( <a href = "#Action">Action</a>)
#### 刪除助理
**Request**
```
DELETE /agents/{agentId}/actions/{actionId}
```
**Path parameters**
| Parameters | |
| -------- | -------- |
| agentId | Agent ID |
| actionId | Action ID |
Request body
```
EMPTY
```
Response body
```
EMPTY
```
## Resource
### <a name="Action">Action</a>
```json
{
"id": string,
"name": string,
"url": string,
"method": enum(RequestMethod),
"headers":{
"{string}": string
},
"body": string,
"enableCache": boolean,
"cacheExpireTime": enum(CacheExpireTime),
"cacheKeys": [string]
}
```
### <a name="ActionInput">ActionInput</a>
```json
{
"name": string,
"url": string,
"method": enum(RequestMethod),
"headers":{
"{string}": string
},
"body": string,
"enableCache": boolean,
"cacheExpireTime": enum(CacheExpireTime),
"cacheKeys": [string]
}
```
### <a name="RequestMethod">RequestMethod</a>
enum
```
POST
GET
```
### <a name="CacheExpireTime">CacheExpireTime</a>
enum
```
OneHour,
TheSameDAy,
TwentyFourHours,
OneWeek
```