summaryrefslogtreecommitdiff
path: root/doc/api-action-procedures.markdown
blob: 5dd88f4ab03cf4bde68c2657ac960bcda18ac3c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
API Automatic Actions Procedures
================================

### getAvailableActions

- Purpose: **Get list of available automatic actions**
- Parameters: none
- Result on success: **list of actions**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "getAvailableActions",
    "id": 1217735483
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 1217735483,
    "result": {
        "TaskLogMoveAnotherColumn": "Add a comment logging moving the task between columns",
        "TaskAssignColorUser": "Assign a color to a specific user",
        "TaskAssignColorColumn": "Assign a color when the task is moved to a specific column",
        "TaskAssignCategoryColor": "Assign automatically a category based on a color",
        "TaskAssignColorCategory": "Assign automatically a color based on a category",
        "TaskAssignSpecificUser": "Assign the task to a specific user",
        "TaskAssignCurrentUser": "Assign the task to the person who does the action",
        "TaskUpdateStartDate": "Automatically update the start date",
        "TaskAssignUser": "Change the assignee based on an external username",
        "TaskAssignCategoryLabel": "Change the category based on an external label",
        "TaskClose": "Close a task",
        "CommentCreation": "Create a comment from an external provider",
        "TaskCreation": "Create a task from an external provider",
        "TaskDuplicateAnotherProject": "Duplicate the task to another project",
        "TaskMoveColumnAssigned": "Move the task to another column when assigned to a user",
        "TaskMoveColumnUnAssigned": "Move the task to another column when assignee is cleared",
        "TaskMoveAnotherProject": "Move the task to another project",
        "TaskOpen": "Open a task"
    }
}
```

### getAvailableActionEvents

- Purpose: **Get list of available events for actions**
- Parameters: none
- Result on success: **list of events**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "getAvailableActionEvents",
    "id": 2116665643
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 2116665643,
    "result": {
        "bitbucket.webhook.commit": "Bitbucket commit received",
        "task.close": "Closing a task",
        "github.webhook.commit": "Github commit received",
        "github.webhook.issue.assignee": "Github issue assignee change",
        "github.webhook.issue.closed": "Github issue closed",
        "github.webhook.issue.commented": "Github issue comment created",
        "github.webhook.issue.label": "Github issue label change",
        "github.webhook.issue.opened": "Github issue opened",
        "github.webhook.issue.reopened": "Github issue reopened",
        "gitlab.webhook.commit": "Gitlab commit received",
        "gitlab.webhook.issue.closed": "Gitlab issue closed",
        "gitlab.webhook.issue.opened": "Gitlab issue opened",
        "task.move.column": "Move a task to another column",
        "task.open": "Open a closed task",
        "task.assignee_change": "Task assignee change",
        "task.create": "Task creation",
        "task.create_update": "Task creation or modification",
        "task.update": "Task modification"
    }
}
```

### getCompatibleActionEvents

- Purpose: **Get list of events compatible with an action**
- Parameters:
    - **action_name** (string, required)
- Result on success: **list of events**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "getCompatibleActionEvents",
    "id": 899370297,
    "params": [
        "TaskClose"
    ]
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 899370297,
    "result": {
        "bitbucket.webhook.commit": "Bitbucket commit received",
        "github.webhook.commit": "Github commit received",
        "github.webhook.issue.closed": "Github issue closed",
        "gitlab.webhook.commit": "Gitlab commit received",
        "gitlab.webhook.issue.closed": "Gitlab issue closed",
        "task.move.column": "Move a task to another column"
    }
}
```

### getActions

- Purpose: **Get list of actions for a project**
- Parameters:
    - **project_id** (integer, required)
- Result on success: **list of actions properties**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "getActions",
    "id": 1433237746,
    "params": [
        "1"
    ]
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 1433237746,
    "result": [
        {
            "id" : "13",
            "project_id" : "2",
            "event_name" : "task.move.column",
            "action_name" : "TaskAssignSpecificUser",
            "params" : {
                "column_id" : "5",
                "user_id" : "1"
            }
        }
    ]
}
```

### createAction

- Purpose: **Create an action**
- Parameters:
    - **project_id** (integer, required)
    - **event_name** (string, required)
    - **action_name** (string, required)
    - **params** (key/value parameters, required)
- Result on success: **action_id**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "createAction",
    "id": 1433237746,
    "params": {
        "project_id" : "2",
        "event_name" : "task.move.column",
        "action_name" : "TaskAssignSpecificUser",
        "params" : {
            "column_id" : "3",
            "user_id" : "2"
        }
    }
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 1433237746,
    "result": 14
}
```

### removeAction

- Purpose: **Remove an action**
- Parameters:
    - **action_id** (integer, required)
- Result on success: **true**
- Result on failure: **false**

Request example:

```json
{
    "jsonrpc": "2.0",
    "method": "removeAction",
    "id": 1510741671,
    "params": [
        1
    ]
}
```

Response example:

```json
{
    "jsonrpc": "2.0",
    "id": 1510741671,
    "result": true
}
```