| 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 |
|
|||||||||||||||||||||||||||||||||||||||||||||
| Result |
success | error | ||||||||||||||||||||||||||||||||||||||||||||
{ "status": 1,
"msg": "success",
"result": "Saved"
}
|
{
"status": 0,
"msg": "error",
"result": {
"name": [
"『Product Name』 should not be empty."
]
}
}
|
|||||||||||||||||||||||||||||||||||||||||||||