- Checkmarx Documentation
- Checkmarx SAST
- SAST API Guide
- CXSAST (REST) API
- CxSAST (REST) API v2.1
- GENERAL
GENERAL
Gets details of a specific project
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/projects/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const headers = {
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://***.***.***.***/cxrestapi/help/projects/{id}', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://***.***.***.***/cxrestapi/help/projects/{id}',
params: {
}, headers: headers
p JSON.parse(result)
GET /projects/{id}
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Unique ID of a specific project |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
200 | Ok | Cx.ProjectManagement.Presentation.Dtos.ProjectBaseDtoV2_1WithOwner | |
400 | Bad Request | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Updates an existing project
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json;v=2.1"},
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://***.***.***.***/cxrestapi/help/projects/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const inputBody = '{
"name": "string",
"owningTeam": 0,
"customFields": [
{
"id": 0,
"value": "string"
}
]
}';
const headers = {
'Content-Type':'application/json;v=2.1',
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json;v=2.1',
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://***.***.***.***/cxrestapi/help/projects/{id}', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json;v=2.1',
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://***.***.***.***/cxrestapi/help/projects/{id}',
params: {
}, headers: headers
p JSON.parse(result)
PUT /projects/{id}
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Unique ID of a project to update |
body | body | true | Project details | |
» name | body | string | true | Specifies the name of the project |
» owningTeam | body | integer(int32) | true | Specifies the team id which owns the project |
» customFields | body | [Cx.ProjectManagement.Presentation.Dtos.UpdateCustomFieldDto] | true | Specifies the custom fields in a project |
»» id | body | integer(int64) | false | none |
»» value | body | string | false | none |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
204 | No Content | Inline | |
400 | Bad Request | None |
Response Schema
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Deletes an existing project with all related scans
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json;v=2.1"},
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://***.***.***.***/cxrestapi/help/projects/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const inputBody = '{
"deleteRunningScans": true
}';
const headers = {
'Content-Type':'application/json;v=2.1',
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}',
{
method: 'DELETE',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json;v=2.1',
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://***.***.***.***/cxrestapi/help/projects/{id}', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json;v=2.1',
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://***.***.***.***/cxrestapi/help/projects/{id}',
params: {
}, headers: headers
p JSON.parse(result)
DELETE /projects/{id}
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Unique ID of a project to delete |
body | body | true | A set of rules that specifies how the project should be deleted | |
» deleteRunningScans | body | boolean | false | Specifies whether the running scans must be deleted |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
202 | Accepted | Inline | |
400 | Bad Request | None |
Response Schema
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Updates an existing project’s name or team Id
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json;v=2.1"},
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PATCH", "https://***.***.***.***/cxrestapi/help/projects/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const inputBody = '{
"name": "SomeProject",
"owningTeam": 12345678
}';
const headers = {
'Content-Type':'application/json;v=2.1',
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json;v=2.1',
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.patch('https://***.***.***.***/cxrestapi/help/projects/{id}', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json;v=2.1',
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.patch 'https://***.***.***.***/cxrestapi/help/projects/{id}',
params: {
}, headers: headers
p JSON.parse(result)
PATCH /projects/{id}
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Unique ID of a project to update |
body | body | true | Project details | |
» name | body | string | false | Specifies the name of the project |
» owningTeam | body | integer(int32) | false | Specifies the team id which owns the project |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
204 | No Content | Inline | |
400 | Bad Request | None |
Response Schema
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Gets details of all visible projects
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/projects", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const headers = {
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://***.***.***.***/cxrestapi/help/projects', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://***.***.***.***/cxrestapi/help/projects',
params: {
}, headers: headers
p JSON.parse(result)
GET /projects
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
projectName | query | string | false | Name of a specific project |
teamId | query | string | false | Unique ID of a specific team |
Responses
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
anonymous | false | none | none | |
» id | integer(int64) | false | read-only | none |
» teamId | integer(int32) | false | read-only | none |
» name | string | false | read-only | none |
» isPublic | boolean | false | read-only | none |
» customFields | [Cx.ProjectManagement.Domain.ValueObjects.ProjectCustomField] | false | read-only | none |
»» id | integer(int64) | false | none | none |
»» value | string | false | none | none |
»» name | string | false | none | none |
» links | false | none | none | |
»» rel | string | false | read-only | none |
»» uri | string | false | read-only | none |
» projectQueueSettings | Cx.ProjectManagement.Presentation.Dtos.ProjectQueueSettingsDto | false | none | none |
»» queueKeepMode | string | false | none | none |
»» scansType | string | false | none | none |
»» includeScansInProcess | boolean | false | none | none |
»» identicalCodeOnly | boolean | false | none | none |
Enumerated Values
Property | Value |
|---|---|
queueKeepMode | KeepAll |
queueKeepMode | KeepOld |
queueKeepMode | KeepNew |
scansType | All |
scansType | OnlyFull |
scansType | OnlyIncremental |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Creates a new project with default preset and configuration settings
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json;v=2.1"},
"Accept": []string{"application/json;v=2.1"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://***.***.***.***/cxrestapi/help/projects", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
const inputBody = '{
"name": "SomeProject",
"owningTeam": "1",
"isPublic": true
}';
const headers = {
'Content-Type':'application/json;v=2.1',
'Accept':'application/json;v=2.1',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json;v=2.1',
'Accept': 'application/json;v=2.1',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://***.***.***.***/cxrestapi/help/projects', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json;v=2.1',
'Accept' => 'application/json;v=2.1',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://***.***.***.***/cxrestapi/help/projects',
params: {
}, headers: headers
p JSON.parse(result)
POST /projects
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
body | body | true | Project details | |
» name | body | string | false | Specifies the name of the project |
» owningTeam | body | string | true | Specifies the team id which owns the project |
» isPublic | body | boolean | true | Specifies whether the project public or not |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
201 | Created | ||
400 | Bad Request | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )