- Configuration
- Department
- User
- Product
- Project
- Task
- 6 Get Task List
- 6 Get Task Optional Information
- 6 Add Task
- 6 Finish Task Optional Information
- 6 Finish Task
- Bug
Configuration
- 2020-03-23 13:44:11
- John Ten
- 2818
- Final Edition:tengfei De 2020-03-24 10:58:39
1. Congifure parameters
ZenTao PHP-SDK is added to the ZenTao framework since ZenTao open source version 12.0.1. ZenTao PHP-SDK files are under zentaoalm/sdk /php/. Before using the SDK (zentao.php) file, you need to fill in the configuration information in the SDK file. The domain name of ZenTao installed, ZenTao account, ZenTao user password, parameter request method of ZenTao configuration.
const ztUrl = 'http://zentao.*****.com'; // domain that ZenTao is installed const ztAccount = 'admin'; // ZenTao login username const ztPassword = '123456'; // ZenTao login password const ztAccessMode = 'PATH_INFO'; // ZenTao request method [ GET | PATH_INFO ]
2. ZenTao SDK list
- Get department list
- Batcg dd departments
- Get user list
- Add user optional information
- Add user
- Get product list
- Add product optional information
- Add product
- Get project list
- Add project optional information
- Add project
- Get task list
- Add task optional information
- Add task
- Finish task optional information
- Finish task
- Get bug list
- Add bug optional information
- Report bug
- Confirm bug optional information
- Confirm bug resolution
3. Note and Example
3.1 Note
Before use ZenTao SDK, make sure that the configuration is correct, and that the login account has the right permissions and that the password is not weak. All requested API results are returned in JSON format. You can decide whether the request was successful based on the status in the request result. If the request fails, APIs will give corresponding prompts. In requesting the API, take [Get Department Lists] as an example. $params contains the request parameters that can be passed. It can be an empty array. This parameter can be omitted when required parameters are not passed in the parameter. $extraFields is a customized field, which can be returned according to the required results. The customized fields are not limited to the fields as showed in the example, and it cannot be passed.
3.2 Example
Below is an example using the zentaoPHP framework. Place the SDK files in tools/zentao/. ThinkPHP, Laravel, and other mainstream frameworks can be placed in the framework directory according to your needs, and the directory should follow the ZenTao framework specification as much as possible.
/** * Get a department list * * @access public * @return void */ public function getDeptList() { include_once('../../tools/zentao/zentao.php'); $zentao = new zentao(); // Initiate the class. If failed, change it to "\new zentao();" $params = array('deptID' => 1); // the parameter requested $extraFields = array('title', 'deptID', 'parentDepts', 'sons', 'tree'); // fields returned $result = $zentao->getDeptList($params, $extraFields); // revoke SDK echo $result; }
4. FAQ
Q: An error message "Trying to get property of non-object" appears when calling a method in the ZenTao SDK class.
A: Print the result of the request ( $result) in the SDK and check the returned information for the reason.
Solution 1: Change the password settings.
Log in ZenTao and go to Admin-> Security-> Password settings. Turn off Password Strength, Force to change weak password, and Force to change password after first login.
<html><meta charset='utf-8'/> <style>body{background:white}</style> <script>self.location='/index.php?m=my&f=changepassword&t=json';</script>
Solution 2: Assign the user permission.
Log in ZenTao and go to Admin-> Privilege to set the privileges for users.
<html><meta charset='utf-8'/> <style>body{background:white}</style> <script>self.location='/index.php?m=user&f=deny&t=json&module=dept&method=browse';</script>
Solution 3 : Missing parameters .
Find the relavant method in the API list and check whether the passed parameters match that in the document list.
If any questions, contact us at renee@easycorp.ltd or troy@easycorp.ltd.
Produit
- ZDOO
- ZDOO Cloud
- ZSITE
Contactez-Nous
- A propos de nous
- Courriel: Philip@easycorp.ltd
- WhatsApp: 0086 18563953295
- Skype: philip517