Klocwork Code Review Web API cookbook
The Code Review API provides administrators with a scriptable interface to the Klocwork database. The API allows you to assign, list, remove, rename and unassign tags, as well as generate search queries.
By default, access to the Web API is given to Project Root Administrators and Project Administrators. You can grant permission for other users to access the Web API using the roles tab in Klocwork Static Code Analysis or through the Access Control API.
Use of the API is as simple as posting an HTTP request to the following URL:
Note: Use https:// if a secure Klocwork Server connection has been configured.
The output is in the form of JSON records, with one valid JSON record per line. If the API returns multiple lines, you must process each line of JSON separately or create a script to join the lines. This is done to allow processing of a large number of results without reading the entire response into a string before processing. For more information about JSON, see http://www.json.org/.
You can place the HTTP requests with a utility as simple as curl, or with the scripting language of your choice. Running curl will allow you to read the JSON output, but if you want to further process the output, you'll need to use a scripting language such as Python or Ruby. You can write scripts in any language that supports sending POST HTTP requests and that processes JSON output. All of the examples in this article use curl.