- Checkmarx Documentation
- Checkmarx SAST
- SAST API Guide
- CXSAST (REST) API
- CxSAST (REST) API v2
- SAST
SAST
Gets the scan settings
package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json;v=2.0"}, "Authorization": []string{"Bearer {access-token}"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://***.***.***.***/cxrestapi/help/sast/scanSettings/{projectId}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... }
URL obj = new URL("https://***.***.***.***/cxrestapi/help/sast/scanSettings/{projectId}"); 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.0', 'Authorization':'Bearer {access-token}' }; fetch('https://***.***.***.***/cxrestapi/help/sast/scanSettings/{projectId}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); });
import requests headers = { 'Accept': 'application/json;v=2.0', 'Authorization': 'Bearer {access-token}' } r = requests.get('https://***.***.***.***/cxrestapi/help/sast/scanSettings/{projectId}', headers = headers) print(r.json())
require 'rest-client' require 'json' headers = { 'Accept' => 'application/json;v=2.0', 'Authorization' => 'Bearer {access-token}' } result = RestClient.get 'https://***.***.***.***/cxrestapi/help/sast/scanSettings/{projectId}', params: { }, headers: headers p JSON.parse(result)
GET /sast/scanSettings/{projectId}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
projectId | path | integer(int64) | true | Unique Id of the specific Project |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Cx.Sast.ScanSettings.Presentation.Dtos.ScanSettingsResponseDtoV2 | |
400 | Bad Request | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Update the scan settings
package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Content-Type": []string{"application/json;v=2.0"}, "Accept": []string{"application/json;v=2.0"}, "Authorization": []string{"Bearer {access-token}"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("PUT", "https://***.***.***.***/cxrestapi/help/sast/scanSettings", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... }
URL obj = new URL("https://***.***.***.***/cxrestapi/help/sast/scanSettings"); 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 = '{ "projectId": 1, "presetId": 1, "engineConfigurationId": 1, "postScanActionId": 1, "emailNotifications": { "failedScan": [ "string" ], "beforeScan": [ "string" ], "afterScan": [ "string" ] } }'; const headers = { 'Content-Type':'application/json;v=2.0', 'Accept':'application/json;v=2.0', 'Authorization':'Bearer {access-token}' }; fetch('https://***.***.***.***/cxrestapi/help/sast/scanSettings', { 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.0', 'Accept': 'application/json;v=2.0', 'Authorization': 'Bearer {access-token}' } r = requests.put('https://***.***.***.***/cxrestapi/help/sast/scanSettings', headers = headers) print(r.json())
require 'rest-client' require 'json' headers = { 'Content-Type' => 'application/json;v=2.0', 'Accept' => 'application/json;v=2.0', 'Authorization' => 'Bearer {access-token}' } result = RestClient.put 'https://***.***.***.***/cxrestapi/help/sast/scanSettings', params: { }, headers: headers p JSON.parse(result)
PUT /sast/scanSettings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Cx.Sast.ScanSettings.Presentation.Dtos.ScanSettingsRequestDto | true | Scan settings details |
» projectId | body | integer(int64) | true | none |
» presetId | body | integer(int64) | true | none |
» engineConfigurationId | body | integer(int64) | true | none |
» postScanActionId | body | integer(int64) | false | none |
» emailNotifications | body | Cx.Sast.ScanSettings.Presentation.Dtos.EmailNotificationsDto | false | none |
»» failedScan | body | [string] | false | none |
»» beforeScan | body | [string] | false | none |
»» afterScan | body | [string] | false | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | ||
400 | Bad Request | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )
Define the scan settings
package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Content-Type": []string{"application/json;v=2.0"}, "Accept": []string{"application/json;v=2.0"}, "Authorization": []string{"Bearer {access-token}"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("POST", "https://***.***.***.***/cxrestapi/help/sast/scanSettings", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... }
URL obj = new URL("https://***.***.***.***/cxrestapi/help/sast/scanSettings"); 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 = '{ "projectId": 1, "presetId": 1, "engineConfigurationId": 1, "postScanActionId": 1, "emailNotifications": { "failedScan": [ "string" ], "beforeScan": [ "string" ], "afterScan": [ "string" ] } }'; const headers = { 'Content-Type':'application/json;v=2.0', 'Accept':'application/json;v=2.0', 'Authorization':'Bearer {access-token}' }; fetch('https://***.***.***.***/cxrestapi/help/sast/scanSettings', { 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.0', 'Accept': 'application/json;v=2.0', 'Authorization': 'Bearer {access-token}' } r = requests.post('https://***.***.***.***/cxrestapi/help/sast/scanSettings', headers = headers) print(r.json())
require 'rest-client' require 'json' headers = { 'Content-Type' => 'application/json;v=2.0', 'Accept' => 'application/json;v=2.0', 'Authorization' => 'Bearer {access-token}' } result = RestClient.post 'https://***.***.***.***/cxrestapi/help/sast/scanSettings', params: { }, headers: headers p JSON.parse(result)
POST /sast/scanSettings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Cx.Sast.ScanSettings.Presentation.Dtos.ScanSettingsRequestDto | true | Scan settings details |
» projectId | body | integer(int64) | true | none |
» presetId | body | integer(int64) | true | none |
» engineConfigurationId | body | integer(int64) | true | none |
» postScanActionId | body | integer(int64) | false | none |
» emailNotifications | body | Cx.Sast.ScanSettings.Presentation.Dtos.EmailNotificationsDto | false | none |
»» failedScan | body | [string] | false | none |
»» beforeScan | body | [string] | false | none |
»» afterScan | body | [string] | false | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | ||
400 | Bad Request | None |
To perform this operation, you must be authenticated by means of one of the following methods: Bearer ( Scopes: sast_api )