- Checkmarx Documentation
- Checkmarx SAST
- SAST API Guide
- CXSAST (REST) API
- CxSAST (REST) API v4
- GENERAL
GENERAL
Gets a server license data
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=4.0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/serverLicenseData", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/serverLicenseData");
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=4.0',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/serverLicenseData',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=4.0',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://***.***.***.***/cxrestapi/help/serverLicenseData', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=4.0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://***.***.***.***/cxrestapi/help/serverLicenseData',
params: {
}, headers: headers
p JSON.parse(result)
GET /serverLicenseData
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
200 | Ok | Cx.CrossCutting.WebAPIHost.ValueObjects.LicenseDetailsResponse |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Gets project branching status
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=4.0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/projects/branch/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/branch/{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=4.0',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/branch/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=4.0',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://***.***.***.***/cxrestapi/help/projects/branch/{id}', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=4.0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://***.***.***.***/cxrestapi/help/projects/branch/{id}',
params: {
}, headers: headers
p JSON.parse(result)
GET /projects/branch/{id}
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Unique Id of the branched project |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
200 | OK |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Get the query id and query version code
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=4.0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/queries/queryVersionCode", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/queries/queryVersionCode?language=string&severity=Info&queryName=string");
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=4.0',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/queries/queryVersionCode?language=string&severity=Info&queryName=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=4.0',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://***.***.***.***/cxrestapi/help/queries/queryVersionCode', params={
'language': 'string', 'severity': 'Info', 'queryName': 'string'
}, headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=4.0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://***.***.***.***/cxrestapi/help/queries/queryVersionCode',
params: {
'language' => 'string',
'severity' => 'string',
'queryName' => 'string'
}, headers: headers
p JSON.parse(result)
GET /queries/queryVersionCode
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
language | query | string | true | Language of the query |
severity | query | string | true | Severity of the query, default value is “Info” |
queryName | query | string | true | Query name of the query |
Enumerated Values
Parameter | Value |
|---|---|
severity | Info |
severity | Low |
severity | Medium |
severity | High |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
200 | Ok | Cx.QueryManagement.Presentation.Queries.Responses.QueryVersionCodeResponse | |
404 | Not Found | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Upload a zipped source code
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json;v=4.0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://***.***.***.***/cxrestapi/help/projects/{id}/sourceCode/attachments", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}/sourceCode/attachments");
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 = '{
"zippedSource": "string"
}';
const headers = {
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json;v=4.0',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}/sourceCode/attachments',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json;v=4.0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://***.***.***.***/cxrestapi/help/projects/{id}/sourceCode/attachments', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/json;v=4.0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://***.***.***.***/cxrestapi/help/projects/{id}/sourceCode/attachments',
params: {
}, headers: headers
p JSON.parse(result)
POST /projects/{id}/sourceCode/attachments
zippedSource: string
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | true | Unique Id of the specific project |
body | body | object | false | none |
» zippedSource | body | string(binary) | false | Zipped source code to scan |
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 )
Set project’s next scheduled scan to be excluded from “no code changes” detection
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json;v=4.0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://***.***.***.***/cxrestapi/help/projects/{id}/forceScanOnNoCodeChanges", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://***.***.***.***/cxrestapi/help/projects/{id}/forceScanOnNoCodeChanges");
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 headers = {
'Accept':'application/json;v=4.0',
'Authorization':'Bearer {access-token}'
};
fetch('https://***.***.***.***/cxrestapi/help/projects/{id}/forceScanOnNoCodeChanges',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json;v=4.0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://***.***.***.***/cxrestapi/help/projects/{id}/forceScanOnNoCodeChanges', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json;v=4.0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://***.***.***.***/cxrestapi/help/projects/{id}/forceScanOnNoCodeChanges',
params: {
}, headers: headers
p JSON.parse(result)
POST /projects/{id}/forceScanOnNoCodeChanges
Parameters
Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer(int64) | true | Id of the project |
Responses
Status | Meaning | Description | Schema |
|---|---|---|---|
200 | OK | Inline |
Response Schema
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )