Klocwork Web API cookbook

The Klocwork Web API provides administrators with a scriptable interface to the Klocwork database. For examples relating to detected issues and metrics, see Issue and metric API examples. For examples relating to access control, see Access control API examples.

By default, access to the Web API is granted to Project Root Administrators and Project Administrators. You can grant permission for other users to access the Web API using the roles tab in Validate or through the Access Control API.

The API allows you, for example, to generate lists of detected issues and create views.

Use of the API is as simple as posting an HTTP request to the following URL:

http(s)://<klocwork_server_host>:<klocwork_server_port>/review/api

Use https:// if a secure Klocwork Server connection has been configured.

The output is in the form of JSON records. 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.