Add Project

2020-03-24 10:46:08
John Ten
2680
Last edited by Taotao on 2020-03-24 21:02:12
Share links
Summary : This method is used to add a project. When adding a project, you can specify the person in charge and set the type and access control.
Method Description

This method is used to add a project. When adding a project, you can specify the person in charge and set the type and access control.

Notes 1. If acl = custom, pass extra parameters, e.g. 'whitelist' => array(1, 2)  means the IDs in privilege groups of the whitelist.
2. Extra fields of one or multiple products linked, , e.g. 'products' => array(4, 5) means to link Product ID=4 or 5.
3. Extra fields of one or multiple plans linked, e.g. 'plans' => array(5, 6) means to link Plan ID=5 to Product ID=4and to link Plan ID=6 to Product ID=5.
Example
public function addProject()
{
    include_once('../vendor/zentao/zentao.php');
    $zentao = new \zentao();
    $params = array(
        'name'        => 'ZenTao Dev',
        'code'        => 'zentao',
        'begin'       => '2020-01-01',
        'end'         => '2020-06-06',
        'days'        => '100',
        'team'        => 'Dev Team',
        'type'        => 'sprint',
        'status'      => 'wait',
        'products[0]' => 0,
        'plans[0]'    => 0,
        'desc'        => 'ZenTao is a professional ALM tool.',
        'acl'         => 'custom',
        'whitelist'   => array(1, 2),
        'products'    => array(4, 5),
        'plans'       => array(5, 6)
    );    // request parameter
    $result = $zentao->addProject($params);
    return $result;
}
Request
POST
Method

addProject

Parameter
Name
Type
Required
Description
name
string Required
Project name
code
string
Required
Project code
begin
string
Required
Begin date【format: 2019-11-20】
end
string
Required
End date【format: 2019-11-20】
days
int
Optional
Available workdays
team
string
Optional
Team name
type
string
Optional
Project type【sprint|waterfall|ops】
desc
string
Optional
Project description
acl
string
Optional
ACL【open|private|custom】
whitelist array Optional
ID in a privilege group of a whitelist
products
array
Optional
ID of linked products
plans
array
Optional
ID of linked plans of a product
Result
success error
{
    "status": 1,
    "msg": "success",
    "result": "Saved"
}
{
    "status": 0,
    "msg": "error",
    "result": {
        "name": [
            "『Project name』 has 『ZenTao Dev』existed. Go to Admin->Data->Recycle to restore it if you have deleted it."
        ],
        "code": [
            "『Project code』 has 『zentao』existed. Go to Admin->Data->Recycle to restore it if you have deleted it."
        ]
    }
}
Write a Comment
Comment will be posted after it is reviewed.