Add Task

2020-03-24 22:18:49
John Ten
4145
Last edited by Taotao on 2020-03-25 07:50:58
Share links
Summary : This method is used to add a task. When adding a new task, the relevant project, assigned user, the priority and other related information can be set.
Method Description

This method is used to add a task. When adding a new task, the relevant project, assigned user, the priority and other related information can be set.

Example
public function addTask()
{
    include_once('../vendor/zentao/zentao.php');
    $zentao = new \zentao();
    $params = array(
        'project'          => 1,
        'type'             => 'ui',
        'module'           => 0,
        'assignedTo[]'     => 'lisi',
        'testAssignedTo[]' => 'lisi',
        'color'            => '',
        'name'             => 'Add Task 2 for Test',
        'pri'              => 2,
        'estimate'         => 1,
        'desc'             => 'Add task description for Test Add task description for Test',
        'estStarted'       => '2019-11-11',
        'deadline'         => '2019-11-12',
        'mailto[1]'        => 'lisi'
    );    // request parameters
    $result = $zentao->addTask($params);
    return $result;
}
Request
POST
Method

addTask

Parameter
Name
Type
Required
Description
project
int Required Linked Project ID
type
string
Required Task status【design|devel|test|study|discuss|ui|affair|misc】
module
int Optional
Linked Module ID
color
string
Optional
task color【e.g. #ff4e3e】
name
string
Required Task name
pri
int Optional
Priority【1, 2, 3, 4】
estimate
int Optional
Estimates【hour】
desc
string
Optional
Task description
estStarted
string
Optional
Planned begin date【format: 2019-11-20】
deadline
string
Optional
Planned end date【format: 2019-11-28】
assignedTo
array
Optional
Assigned user, e.g. 'assignedTo' => array('zhangsan')
mailto
array Optional
Mailto, e.g. 'mailto' => array('lisi', 'niuqi', 'zhangsan'), which means to cc 3 users.
Result
success error
{
    "status": 1,
    "msg": "success",
    "result": "Saved"
}
{
    "status": 0,
    "msg": "error",
    "result": {
        "name": [
            "『Task name』 should not be empty."
        ]
    }
}
Write a Comment
Comment will be posted after it is reviewed.