Klocwork Static Code Analysis Web API Reference
To access Web API send a POST request to
http://0.0.0.0:8080/review/api with the following parameters:
- user*
- Klocwork user name
- ltoken
- kwauth login token
- action*
- action name
builds
Retrieve the list of builds for a project.
Example:
curl --data "action=builds&user=myself&project=my_project" http://0.0.0.0:8080/review/api- project*
- project name
create_group
Create a group and optionally assign users to it.
Example:
curl --data "action=create_group&user=myself&name=group_name&users=User1,User2" http://0.0.0.0:8080/review/api- name*
- the name of the group to create
- users
- comma separated list of users. If the user name contains a comma, escape it with a backslash. Backslashes can be escaped with another backslash. For example: User1\,name and User2\\name
create_module
Create a module for a project.
Example:
curl --data "action=create_module&user=myself&project=my_project&name=test&allow_all=true&paths="**/test/*"" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- module name
- allow_all
- module access (‘true’ to allow access for everyone by default)
- allow_users
- grant access to users (list of comma separated user names)
- allow_groups
- grant access to user groups (list of comma separated group names)
- deny_users
- deny access to users (list of comma separated user names)
- deny_groups
- deny access to user groups (list of comma separated group names)
- paths*
- list of comma separated path regexps
- tags
- list of comma separated tags (for example, 'c,security')
create_role
Create a role. To grant a permission on the new role, set its value to 'true'.
Example:
curl --data "action=create_role&user=myself&name=myrole&create_project=true&manage_roles=false&change_issue_status=true&allowed_status_transitions=Any,Analyze;Analyze,Fix" http://0.0.0.0:8080/review/api- name*
- the name of the role to create
- create_project
- grant or revoke the Create project permission
- manage_roles
- grant or revoke the Manage roles permission
- manage_users
- grant or revoke the Manage users permission
- access_source_files
- grant or revoke the Access source files permission
- assign_role
- grant or revoke the Assign roles permission
- change_project_settings
- grant or revoke the Change project settings permission
- create_build
- grant or revoke the Create build permission
- delete_build
- grant or revoke the Delete build permission
- delete_project
- grant or revoke the Delete project permission
- manage_modules
- grant or revoke the Manage modules permission
- use_local_configuration
- grant or revoke the Use local configuration permission
- change_issue_status
- grant or revoke the Change issue status permission
- webapi_access
- grant or revoke the Web API access permission
- execute_kwxsync
- grant or revoke the Perform cross-project synchronization permission
- allowed_status_transitions
- set the allowed status transition. (semi-colon separated list of status pairs, for example: Any,Analyze;Analyze,Fix)
create_user
Create a user.
Example:
curl --data "action=create_user&user=myself&name=user_name&password=thepassword" http://0.0.0.0:8080/review/api- name*
- the name of the user to create
- password
- assign a password to the new user (optional)
create_view
Create a view for a project.
Example:
curl --data "action=create_view&user=myself&project=my_project&name=critical&query=severity:1-3" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- view name
- query*
- search query for the view
- tags
- list of comma separated tags (for example, 'c,security')
- is_public
- whether the view is visible to all users with access to this project (true|false)
defect_types
Retrieve the list of defect types.
Example:
curl --data "action=defect_types&user=myself&project=my_project" http://0.0.0.0:8080/review/api- project*
- project name
- taxonomy
- filter by taxonomy
delete_build
Delete a build.
Example:
curl --data "action=delete_build&user=myself&project=my_project&name=build_1" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- build name
delete_group
Delete a group.
Example:
curl --data "action=delete_group&user=myself&name=group_name" http://0.0.0.0:8080/review/api- name*
- the name of the group to delete
delete_module
Delete a module.
Example:
curl --data "action=delete_module&user=myself&project=my_project&name=my_module" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- module name
delete_project
Delete a project.
Example:
curl --data "action=delete_project&user=myself&name=my_project" http://0.0.0.0:8080/review/api- name*
- project name
delete_role
Delete a role.
Example:
curl --data "action=delete_role&user=myself&name=my_role" http://0.0.0.0:8080/review/api- name*
- role name
delete_user
Delete a user.
Example:
curl --data "action=delete_user&user=myself&name=user_name" http://0.0.0.0:8080/review/api- name*
- the name of the user to delete
delete_view
Delete a view.
Example:
curl --data "action=delete_view&user=myself&project=my_project&name=my_view" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- view name
fchurns
Generate file churns report.
Example:
curl --data "action=fchurns&user=myself&component=Component" http://0.0.0.0:8080/review/api- project*
- name of the project you want to create a report for
- view
- the view you want to set for the report
- viewCreator
- view creator name
- latestBuilds
- the number of builds you want to show in the report
- component
- root component
groups
List groups.
Example:
curl --data "action=groups&user=myself&search=groupname&limit=1000" http://0.0.0.0:8080/review/api- search
- simple group name search pattern (for example, '*group' or '*groupname*'). Default: '*'
- list_users
- output user list for each group (default: 'false')
- limit
- maximum number of results to return. Default: 1000
import_project
Import project from another Klocwork server.
Example:
curl --data "action=import_project&user=myself&project=my_project&sourceURL=http://oldserver:8080&sourceAdmin=user&sourcePassword=pwd" http://0.0.0.0:8080/review/api- project*
- Name of the project to import
- sourceURL*
- URL to source Klocwork server
- sourceAdmin*
- Projects_root administrator account name
- sourcePassword
- Projects_root administrator account password
import_server_configuration
Import server settings from another Klocwork server.
Example:
curl --data "action=import_server_configuration&user=myself&sourceURL=http://oldserver:8080&sourceAdmin=user&sourcePassword=pwd" http://0.0.0.0:8080/review/api- sourceURL*
- URL to source Klocwork server
- sourceAdmin*
- Projects_root administator account name
- sourcePassword
- Projects_root administator account password
import_status
List current import status of projects.
Example:
curl --data "action=import_status&user=myself" http://0.0.0.0:8080/review/api
issue_details
Get details for the given issue id.
Example:
curl --data "action=issue_details&user=myself&project=my_project&id=650" http://0.0.0.0:8080/review/api- project*
- name of the project you want to search
- id*
- the id to search
- include_xsync
- boolean to return xSyncInfo, default is false
license_count
Retrieve the number of licenses issued for a feature.
Example:
curl --data "action=license_count&user=myself&feature=kwadmin10" http://0.0.0.0:8080/review/api
metrics
Retrieve the list of metrics.
Example:
curl --data "action=metrics&user=myself&project=my_project&query=file:MyFile.c" http://0.0.0.0:8080/review/api- project*
- project name
- query
- search query, such as narrowing by file (for example, 'file:MyFile.c')
- view
- view name
- limit
- search result limit
- aggregate
- set to true, to retrieve statistics {min, max, total, entries} for each unique metric, (aggregated across the view)
- exclude_system_files
- when set to true, system files are omitted (default:false)
modules
Retrieve the list of modules for a project.
Example:
curl --data "action=modules&user=myself&project=my_project" http://0.0.0.0:8080/review/api- project*
- project name
project_configuration
Generate project configuration report.
Example:
curl --data "action=project_configuration&user=myself&project=my_project&build=build_name" http://0.0.0.0:8080/review/api- project*
- name of the project you want to create a report for
- build
- name of the build you want to focus your report on
projects
Retrieve list of projects.
Example:
curl --data "action=projects&user=myself" http://0.0.0.0:8080/review/api
report
Generate build summary report.
Example:
curl --data "action=report&user=myself&project=my_project&build=build_1&x=Category&y=Component" http://0.0.0.0:8080/review/api- project*
- name of the project you want to create a report for
- build
- name of the build you want to focus your report on
- filterQuery
- the filter query you want to set for the report (search criteria are: State, Status, Severity, Module, Owner, Category, Code, Reference)
- view
- the view you want to set for the report
- x
- the value you want to set along the x-axis (options are: Module, Category, Severity, State, Status, Owner, Error Code)
- xDrilldown
- row drill-down item id (default: root item)
- y
- the variable you want to set along the y-axis (options are: Module, Category, Severity, State, Status, Owner, Error Code)
- yDrilldown
- column drill-down item id (default: root item)
- group_issues
- show grouped issues
role_assignments
List role assignments.
Example:
curl --data "action=role_assignments&user=myself&search=rolename" http://0.0.0.0:8080/review/api- search
- simple role filter. If the filter text starts with '+' ('%2b' if URL encoding is required) only exact matches will be returned. Otherwise all roles with names containing the text will be returned
roles
List roles.
Example:
curl --data "action=roles&user=myself&search=rolename" http://0.0.0.0:8080/review/api- search
- simple role filter. If the filter text starts with '+' ('%2b' if URL encoding is required) only exact matches will be returned. Otherwise all roles with names containing the text will be returned
search
Retrieve the list of detected issues.
Example:
curl --data "action=search&user=myself&project=my_project&query=file:MyFile.c" http://0.0.0.0:8080/review/api- project*
- project name
- query
- search query, such as narrowing by file (for example, 'file:MyFile.c')
- view
- view name
- limit
- search result limit
- summary
- include summary record to output stream
task_status
List statuses of all tasks running on Klocwork server.
Example:
curl --data "action=task_status&user=myself" http://0.0.0.0:8080/review/api
taxonomies
Retrieve the list of taxonomy terms for a project..
Example:
curl --data "action=taxonomies&user=myself&project=my_project" http://0.0.0.0:8080/review/api- project*
- project name
update_build
Update a build.
Example:
curl --data "action=update_build&user=myself&name=build_1&new_name=build_03_11_2011" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- build name
- new_name
- new build name
- keepit
- whether this build will be deleted by the auto-delete build feature (true|false)
update_defect_type
Enable or disable a defect.
Example:
curl --data "action=update_defect_type&user=myself&project=my_project&code=ECC.EMPTY&enabled=false" http://0.0.0.0:8080/review/api- project*
- project name
- code*
- defect code
- enabled
- true to enable, false to disable
- severity
- specify new defect severity
update_group
Update users in a group.
Example:
curl --data "action=update_group&user=myself&name=group_name&users=User1,User2" http://0.0.0.0:8080/review/api- name*
- the name of the group to update
- users
- comma separated list of users (replaces existing users). If the user name contains a comma, escape it with a backslash. Backslashes can be escaped with another backslash. For example: User1\,name and User2\\name
- remove_all
- if 'true', the group's user list will be cleared. Ignored if 'users' is specified
update_module
Update a module for a project.
Example:
curl --data "action=update_module&user=myself&project=my_project&name=test&new_name=aux&allow_all=true&paths="**/test/*,**/assert/*"" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- module name
- new_name
- new view name
- allow_all
- module access (‘true’ to allow access for everyone by default)
- allow_users
- grant access to users (list of comma separated user names)
- allow_groups
- grant access to user groups (list of comma separated group names)
- deny_users
- deny access to users (list of comma separated user names)
- deny_groups
- deny access to user groups (list of comma separated group names)
- paths
- list of comma separated path regexps
- tags
- list of comma separated tags (for example, 'c,security')
update_project
Update a project.
Example:
curl --data "action=update_project&user=myself&name=myproject&new_name=my_project" http://0.0.0.0:8080/review/api- name*
- project name
- new_name
- new project name
- description
- new project description
- tags
- list of comma separated tags (for example, 'c,security')
- auto_delete_builds
- whether the builds in the project should automatically be deleted (true|false)
- auto_delete_threshold
- the number of builds to keep in the project if auto_delete_builds is true (default: 20)
update_role_assignment
Add or remove a user to/from a role.
Example:
curl --data "action=update_role_assignment&user=myself&name=myrole&project=myproject&account=jdoe&group=false&remove=false" http://0.0.0.0:8080/review/api- name*
- the name of the role to update
- project
- the project id the role should be updated for, if any. The project id can be obtained from role_assignments
- account*
- the name of the account to add or remove
- group
- set to 'true' if the account is a group (default: 'false')
- remove
- set to 'true' to remove the account from the role (default: 'false')
update_role_permissions
Update role permissions. To grant a permission set its value to 'true'. To revoke a permission set its value to 'false'. Only specified permissions will be updated.
Example:
curl --data "action=update_role_permissions&user=myself&name=myrole&create_project=true&manage_roles=false&change_issue_status=true&allowed_status_transitions=Any,Analyze;Analyze,Fix" http://0.0.0.0:8080/review/api- name*
- the name of the role to update
- create_project
- grant or revoke the Create project permission
- manage_roles
- grant or revoke the Manage roles permission
- manage_users
- grant or revoke the Manage users permission
- access_source_files
- grant or revoke the Access source files permission
- assign_role
- grant or revoke the Assign roles permission
- change_project_settings
- grant or revoke the Change project settings permission
- create_build
- grant or revoke the Create build permission
- delete_build
- grant or revoke the Delete build permission
- delete_project
- grant or revoke the Delete project permission
- manage_modules
- grant or revoke the Manage modules permission
- use_local_configuration
- grant or revoke the Use local configuration permission
- change_issue_status
- grant or revoke the Change issue status permission
- webapi_access
- grant or revoke the Web API access permission
- execute_kwxsync
- grant or revoke the Perform cross-project synchronization permission
- allowed_status_transitions
- set the allowed status transition. (semi-colon separated list of status pairs, for example: Any,Analyze;Analyze,Fix)
update_status
Change the status, owner, and comment, or alternatively set the bug tracker id of issues.
Example:
curl --data "action=update_status&user=myself&project=my_project&ids=ids_list&status=new_status&comment=new_comment&owner=new_owner" http://0.0.0.0:8080/review/api- project*
- project name
- ids*
- comma seperated list of ids to change
- status
- new status to set
- comment
- new comment to set
- owner
- new owner to set
- bug_tracker_id
- new bug tracker id to set
update_view
Update a view.
Example:
curl --data "action=update_view&user=myself&project=my_project&tags=c,security&name=my_view" http://0.0.0.0:8080/review/api- project*
- project name
- name*
- current view name
- new_name
- new view name
- query
- updates the search query
- tags
- list of comma separated tags (for example, 'c,security')
- is_public
- whether the view is visible to all users with access to this project (true|false)
users
List users.
Example:
curl --data "action=users&user=myself&search=username&limit=1000" http://0.0.0.0:8080/review/api- search
- simple username search pattern (for example, '*doe' or '*username*'). Default: '*'
- limit
- maximum number of results to return. Default: 1000
version
Retrieve Klocwork server version.
Example:
curl --data "action=version&user=myself" http://0.0.0.0:8080/review/api
views
Retrieve list of views.
Example:
curl --data "action=views&user=myself&project=my_project" http://0.0.0.0:8080/review/api- project*
- project name
Troubleshooting
If the server was not able to process your request, a json object with the following
fields will be returned to the client:
- status
- http status
- message
- additional diagnostics