With ZenTao 9.6+, you can integrate third-party applications in ZenTao, so to share your data between two systems. The third-party application can access ZenTao in the way of GET, and ZenTao will return the data in .json format.
1. Configure
Log in ZenTao as the super-Admin, and go to Admin->Develop->Application and Click Add Application.
Then enter the information of the application that you want to add to ZenTao.
- Name: The name of the application
- Code: The alias of the application
- Key: Key is generated automatically in ZenTao
- IP: This is a whitelist of IP. Check All means there is no limit to any IP.
2. API Authentication
API authentication is required when the third-party applications request data from ZenTao. The format is /api.php?m=moduleName&f=methodName& params=params &code=code&token=token
- m=moduleName&f=methodName& params=params is the parameters that the data request, and you should set it according to your own situation.
- code is the alias of the application and should be the same as that is in ZenTao.
- token is the digital authentication, and its algorithm is to remove the md5 and add the key, then md5 again.
For example, the code of the application is myApp and the key is 427c579384224abf9570779d82969d1e, so the algorithm of the token is as shown below,
$key = '427c579384224abf9570779d82969d1e'; $query = 'm=project&f=view&id=1&code=myApp'; $token = md5(md5($query) . $key);
3. Error Code
300001 No code parameter. Check whether the requested API contains the code.
300002 No token parameter. Check whether the requested API contains the token.
310001 Application does not exist. Check whether the requested application exists in ZenTao or deleted.
310002 Application has no key set up. Check whether the requested application has a key set up.
320001 IP is restricted. Check the IP setting of this requested application in ZenTao.
330001 Invalid token parameters.
If a redirection happens when requesting, ZenTao should check the session to authenticate whether the request after the redirection is valid. For example, when requesting the index method in the index module, it will redirect to the index method in the my module.
340001 No session code. Check whether $_SESSION['ENTRY_CODE'] is correct after the redirection.
340002 Session authentication failed. Check the authentication logic of the session, as well as whether $_SERVER['REMOTE_ADDR'] is correct after the redirection.