Build API examples
In this topic: |
These article covers some examples of build API calls for both system (regular) and CI builds.
You can update, read, and clear build tags using the update_build, builds, update_ci_build, or ci_builds web API calls.
For additional information on build and other request parameters, visit http(s)://<klocwork_server_host>:<klocwork_server_port>/review/api.
API calls for regular builds
Example: List regular builds and their name, keepit, and tags properties
curl --data "action=builds&user=myself&project=demosthenes" http://localhost:8080/review/api
Example: Rename a regular build
curl --data "action=update_build&user=myself&name=build_1&new_name=build_1_renamed&keepit=&project=demosthenes" http://localhost:8080/review/api
Example: Set keepit
curl --data "action=update_build&user=myself&name=build_2&keepit=TRUE&project=demosthenes" http://localhost:8080/review/api
Example: Set tags
curl --data "action=update_build&user=myself&name=build_3&keepit=&tags=tags,for,3&project=demosthenes" http://localhost:8080/review/api
Example: Rename a build and set keepit
curl --data "action=update_build&user=myself&name=build_4&new_name=build_4_renamed&keepit=TRUE&project=demosthenes" http://localhost:8080/review/api
Example: Rename a build and set tags
curl --data "action=update_build&user=myself&name=build_5&new_name=build_5_renamed&keepit=&tags=tags,for,5&project=demosthenes" http://localhost:8080/review/api
Example: Set keepit and set tags
curl --data "action=update_build&user=myself&name=build_6&keepit=TRUE&tags=tags,for,6&project=demosthenes" http://localhost:8080/review/api
Example: Rename a build, set keepit, and set tags
curl --data "action=update_build&user=myself&name=build_7&new_name=build_7_renamed&keepit=TRUE&tags=tags,for,7&project=demosthenes" http://localhost:8080/review/api
curl --data "action=builds&user=myself&project=demosthenes" http://localhost:8080/review/api
Example: Clear tags
curl --data "action=update_build&user=myself&name=build_7_renamed&tags=&project=demosthenes" http://localhost:8080/review/api
curl --data "action=builds&user=myself&project=demosthenes" http://localhost:8080/review/api
API calls for CI builds
Example: List CI builds and their name and tags properties
curl --data "action=ci_builds&user=myself&project=demosthenes_ci_2" http://localhost:8080/review/api
Example: Rename a build
curl --data "action=update_ci_build&user=myself&name=ci_0&new_name=ci_0_renamed&project=demosthenes_ci_2" http://localhost:8080/review/api
Example: Set tags
curl --data "action=update_ci_build&user=myself&name=ci_1&tags=tags,for,1&project=demosthenes_ci_2" http://localhost:8080/review/api
Example: Rename a build and set tags
curl --data "action=update_ci_build&user=myself&name=ci_2&new_name=ci_2_renamed&tags=tags,for,2&project=demosthenes_ci_2" http://localhost:8080/review/api
curl --data "action=ci_builds&user=myself&project=demosthenes_ci_2" http://localhost:8080/review/api
Example: Clear tags
curl --data "action=update_ci_build&user=myself&name=ci_2_renamed&tags=&project=demosthenes_ci_2" http://localhost:8080/review/api
curl --data "action=ci_builds&user=myself&project=demosthenes_ci_2" http://localhost:8080/review/api