Remove webhook endpoint to create tasks (breaking change)
This commit is contained in:
@@ -22,6 +22,10 @@ Bug fixes:
|
|||||||
|
|
||||||
* Do not send notifications to disabled users
|
* Do not send notifications to disabled users
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
* Webhook to create tasks have been removed, use the API instead.
|
||||||
|
|
||||||
Version 1.0.28
|
Version 1.0.28
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Kanboard\Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Webhook controller
|
|
||||||
*
|
|
||||||
* @package controller
|
|
||||||
* @author Frederic Guillot
|
|
||||||
*/
|
|
||||||
class Webhook extends BaseController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Webhook to create a task
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
public function task()
|
|
||||||
{
|
|
||||||
$this->checkWebhookToken();
|
|
||||||
|
|
||||||
$defaultProject = $this->project->getFirst();
|
|
||||||
|
|
||||||
$values = array(
|
|
||||||
'title' => $this->request->getStringParam('title'),
|
|
||||||
'description' => $this->request->getStringParam('description'),
|
|
||||||
'color_id' => $this->request->getStringParam('color_id'),
|
|
||||||
'project_id' => $this->request->getIntegerParam('project_id', $defaultProject['id']),
|
|
||||||
'owner_id' => $this->request->getIntegerParam('owner_id'),
|
|
||||||
'column_id' => $this->request->getIntegerParam('column_id'),
|
|
||||||
'category_id' => $this->request->getIntegerParam('category_id'),
|
|
||||||
);
|
|
||||||
|
|
||||||
list($valid, ) = $this->taskValidator->validateCreation($values);
|
|
||||||
|
|
||||||
if ($valid && $this->taskCreation->create($values)) {
|
|
||||||
return $this->response->text('OK');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->response->text('FAILED');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= t('URL and token') ?></h2>
|
<h2><?= t('Webhook token') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<section class="listing">
|
<section class="listing">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -24,10 +24,6 @@
|
|||||||
<?= t('Webhook token:') ?>
|
<?= t('Webhook token:') ?>
|
||||||
<strong><?= $this->text->e($values['webhook_token']) ?></strong>
|
<strong><?= $this->text->e($values['webhook_token']) ?></strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<?= t('URL for task creation:') ?>
|
|
||||||
<input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->href('webhook', 'task', array('token' => $values['webhook_token']), false, '', true) ?>">
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?>
|
<?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -269,36 +269,3 @@ Screenshot created:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
How to create a task with a web hook?
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
Firstly, you have to get the token from the settings page. After that, just call this url from anywhere:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create a task for the default project inside the first column
|
|
||||||
curl "http://myserver/?controller=webhook&action=task&token=superSecretToken&title=mySuperTask"
|
|
||||||
|
|
||||||
# Create a task to another project inside a specific column with the color red
|
|
||||||
curl "http://myserver/?controller=webhook&action=task&token=superSecretToken&title=task123&project_id=3&column_id=7&color_id=red"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Available responses
|
|
||||||
|
|
||||||
- When a task is created successfully, Kanboard return the message "OK" in plain text.
|
|
||||||
- However if the task creation fail, you will get a "FAILED" message.
|
|
||||||
- If the token is wrong, you got a "Not Authorized" message and a HTTP status code 401.
|
|
||||||
|
|
||||||
### Available parameters
|
|
||||||
|
|
||||||
Base URL: `http://YOUR_SERVER_HOSTNAME/?controller=webhook&action=task`
|
|
||||||
|
|
||||||
- `token`: Token displayed on the settings page (required)
|
|
||||||
- `title`: Task title (required)
|
|
||||||
- `description`: Task description
|
|
||||||
- `color_id`: Supported colors are yellow, blue, green, purple, red, orange and gray
|
|
||||||
- `project_id`: Project id (Get the id from the project page)
|
|
||||||
- `owner_id`: Assignee (Get the user id from the user's page)
|
|
||||||
- `column_id`: Column on the board (Get the column id from the projects page, mouse over on the column name)
|
|
||||||
|
|
||||||
Only the token and the title parameters are mandatory. The different id can also be found in the database.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user