- 1. API
- 2 Configuration
- 3. Department
-
4. User
- 4.1 Get Parameters of Add User
- 4.2 Add User
- 4.3 Get User List
- 5. Product
- 6. Project
-
7. Task
- 7.1 Get Task List
- 7.2 Get Task Optional Information
- 7.3 Add Task
- 7.4 Finish Task Optional Information
- 7.5 Finish Task
- 8. Bug
Configuration
- 2020-03-23 13:44:11
- John Ten
- 6283
- Last edited by Taotao on 2020-03-24 10:58:39
- Share links
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 [email protected] or [email protected].
Support
- Book a Demo
- Tech Forum
- GitHub
- SourceForge
About Us
- Company
- Privacy Policy
- Term of Use
- Blogs
- Partners
Contact Us
- Leave a Message
- Email Us: [email protected]