Add Product

2020-03-24 10:41:57
John Ten
2550
Last edited by Taotao on 2020-03-24 17:19:36
Share links
Summary : By requesting this method, you can add a product, and specify the person in charge and set the product type and access control.
Method Description

By requesting this method, you canadd a product, and specify the person in charge and set the product type and access control. Note: If the parameter acl=custom, you can pass additional parameters, e.g.'whitelist' => array(1, 2), and add the IDs in the privilege group to the whitelist.

Example
public function addProduct()
{
    include_once('../vendor/zentao/zentao.php');
    $zentao = new \zentao();
    $params = array(
        'name'         => 'product-200',
        'code'         => 'p200',
        'line'         => 0,
        'PO'           => 'lisi',
        'QD'           => 'zhangsan',
        'RD'           => 'wangwu',
        'type'         => 'normal',
        'status'       => 'normal',
        'desc'         => 'product description,product description',
        'acl'          => 'custom',
        'whitelist'    => array(1, 2)
    );    // request parameter
    $result = $zentao->addProduct($params);
    return $result;
}
Request POST
Method

addProduct

Parameter
Name Type Required Description
name
string Required Product name
code
string Required Product code
line
int Optional Product line ID
PO
string Optional Product owner username
QD
string Optional QA manager username
RD
string Optional Release manager username
type
string Optional Product type【normal|branch|platform】
desc string Optional Product description
acl
string Optional ACL【open|private|custom】
whitelist array Optional Whitelist, IDs in privilege groups
Result
success error
{  "status": 1,
    "msg": "success",
    "result": "Saved"
}
{
    "status": 0,
    "msg": "error",
    "result": {
        "name": [
            "『Product Name』 should not be empty."
        ]
    }
}
Write a Comment
Comment will be posted after it is reviewed.