Search code examples
kiwi-tcms

Does kiwi tcms has Node.js api?


I practice to use tcms_api in python now, but i want to use node.js to call kiwi api. I did not find the relevant information on the network.

Can anyone give me some suggestions?? Thanks.


Solution

  • The API is exported both over XML-RPC and JSON-RPC protocols. The JSON-RPC protocol is very simple, see https://www.jsonrpc.org/specification and you can easily create your own client.

    While Kiwi TCMS doesn't provide a stand-alone JavaScript client you can use the following as an example: https://github.com/kiwitcms/Kiwi/blob/master/tcms/static/js/jsonrpc.js

    Warning: the code above doesn't handle authentication b/c it is designed to execute in the browser which already keeps a session cookie after the user has been logged in. If you are designing a generic client that will be used outside the browser your first call should be to the Auth.login method which returns the session ID and also sets a Cookie header in the response. The existing Python API client just parses the Cookie header and provides it on subsequent requests, see: https://github.com/kiwitcms/tcms-api/blob/master/tcms_api/xmlrpc.py#L19