Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

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:

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

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.