codedx-api-client-java
Requirements
Building the API client library requires Maven to be installed.
Installation
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Maven users
Add this dependency to your project's POM:
<dependency>
<groupId>com.codedx</groupId>
<artifactId>codedx-api-client-java</artifactId>
<version>3.5.0</version>
<scope>compile</scope>
</dependency>
Gradle users
Add this dependency to your project's build file:
compile "com.codedx:codedx-api-client-java:3.5.0"
Others
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/codedx-api-client-java-3.5.0.jar
- target/lib/*.jar
Getting Started
Please follow the installation instruction and execute the following Java code:
import com.codedx.client.*;
import com.codedx.client.auth.*;
import com.codedx.client.model.*;
import com.codedx.client.api.ActionsApi;
import java.io.File;
import java.util.*;
public class ActionsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: APIKeyHeader
ApiKeyAuth APIKeyHeader = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyHeader");
APIKeyHeader.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyHeader.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
ActionsApi apiInstance = new ActionsApi();
Integer findingId = 56; // Integer | The finding ID.
try {
apiInstance.clearSeverityOverride(findingId);
} catch (ApiException e) {
System.err.println("Exception when calling ActionsApi#clearSeverityOverride");
e.printStackTrace();
}
}
}
Documentation for API Endpoints
All URIs are relative to http://localhost/codedx
Class | Method | HTTP request | Description |
---|---|---|---|
ActionsApi | clearSeverityOverride | DELETE /api/findings/{finding-id}/severity-override | Severity Override [Clear] |
ActionsApi | overrideSeverity | PUT /api/findings/{finding-id}/severity-override | Severity Override [Set] |
ActionsApi | postComment | POST /api/findings/{finding-id}/comment | Post Comment |
ActionsApi | setBulkStatus | POST /api/projects/{project-id}/bulk-status-update | Bulk Status Update |
ActionsApi | setStatus | PUT /api/findings/{finding-id}/status | Status Update |
AnalysisApi | createAnalysisPrep | POST /api/analysis-prep | Create Analysis Prep |
AnalysisApi | deleteInput | DELETE /api/analysis-prep/{prep-id}/{input-id} | Delete Input |
AnalysisApi | deletePendingInput | DELETE /api/analysis-prep/{prep-id}/pending | Delete Input (pending) |
AnalysisApi | getAllAnalysisDetails | GET /api/projects/{project-id}/analyses | Get All Analysis Details |
AnalysisApi | getAnalysisDetails | GET /api/projects/{project-id}/analyses/{analysis-id} | Get Analysis Details |
AnalysisApi | getInputMetadata | GET /api/analysis-prep/{prep-id}/{input-id} | Get Input Metadata |
AnalysisApi | queryAnalysisPrepState | GET /api/analysis-prep/{prep-id} | Query Analysis Prep State |
AnalysisApi | runPreparedAnalysis | POST /api/analysis-prep/{prep-id}/analyze | Run Prepared Analysis |
AnalysisApi | setAnalysisName | PUT /api/projects/{project-id}/analyses/{analysis-id} | Name Analysis |
AnalysisApi | setDisplayTag | PUT /api/analysis-prep/{prep-id}/{input-id}/tag/{tag-id} | Enable/Disable Display Tag |
AnalysisApi | uploadFile | POST /api/analysis-prep/{prep-id}/upload | Upload File to Analysis Prep |
FindingDataApi | getFindingData | GET /api/findings/{finding-id} | Finding Data |
FindingDataApi | getFindingDescription | GET /api/findings/{finding-id}/description | Finding Descriptions |
FindingDataApi | getFindingFlow | POST /api/projects/{project-id}/findings/flow | Finding Flow Data |
FindingDataApi | getFindingHistory | GET /api/findings/{finding-id}/history | Finding History |
FindingDataApi | getFindingsCount | POST /api/projects/{project-id}/findings/count | Finding Count |
FindingDataApi | getFindingsGroupCount | POST /api/projects/{project-id}/findings/grouped-counts | Findings Grouped Count |
FindingDataApi | getFindingsTable | POST /api/projects/{project-id}/findings/table | Finding Table Data |
FindingDataApi | getSourceFileContents | GET /api/projects/{project-id}/files/{path-id} | Source File Contents |
FindingDataApi | getSourceFileContentsFromPath | GET /api/projects/{project-id}/files/tree/{path} | Source File Contents (tree) |
FindingDataMaintenanceApi | getDisabledToolResultCount | GET /api/projects/{project-id}/disabled-tool-result-count | Disabled Tool Result Count Query |
FindingDataMaintenanceApi | purgeDisabledToolResults | POST /api/projects/{project-id}/purge-disabled-tool-results | Purge Disabled Tool Results |
JobsApi | getJobResult | GET /api/jobs/{job-id}/result | Get Job Result |
JobsApi | getJobStatus | GET /api/jobs/{job-id} | Query Job Status |
MetadataApi | createMetadataField | POST /api/project-fields | Create Project Metadata Field |
MetadataApi | deleteMetadata | DELETE /api/project-fields/{field-id} | Delete Project Metadata Field |
MetadataApi | getAllMetadata | GET /api/project-fields | Get Project Metadata Fields (list) |
MetadataApi | getMetadata | GET /api/project-fields/{field-id} | Get Project Metadata Fields (single) |
MetadataApi | getMetadataValue | GET /api/projects/{project-id}/metadata | Get Project Metadata Field Values |
MetadataApi | modifyMetadata | PUT /api/project-fields/{field-id} | Modify Project Metadata Field |
MetadataApi | updateMetadataValue | PUT /api/projects/{project-id}/metadata | Update Project Metadata Field Values |
ProfileApi | profileChangePassword | POST /api/profile/password | Change your password |
ProjectsApi | createProject | PUT /api/projects | Create Project |
ProjectsApi | deleteProject | DELETE /api/projects/{project-id} | Delete Project |
ProjectsApi | getAllUserRoles | GET /api/projects/{project-id}/user-roles | User Roles |
ProjectsApi | getMappings | POST /api/projects/{project-id}/files/mappings | File Mappings |
ProjectsApi | getProjectFiles | GET /api/projects/{project-id}/files | Project Files |
ProjectsApi | getProjects | GET /api/projects | List Projects |
ProjectsApi | getStatuses | GET /api/projects/{project-id}/statuses | Project Statuses |
ProjectsApi | getUserRole | GET /api/projects/{project-id}/user-roles/user/{user-id} | User Role |
ProjectsApi | queryProjects | POST /api/projects/query | Query Projects |
ProjectsApi | queryProjectsCount | POST /api/projects/query/count | Query Projects Count |
ProjectsApi | updateProject | PUT /api/projects/{project-id} | Update Project |
ProjectsApi | updateUserRole | PUT /api/projects/{project-id}/user-roles/user/{user-id} | Update User Role |
ReportingApi | generateReport | POST /api/projects/{project-id}/report/{report-type} | Generate Report |
ReportingApi | getReportTypes | GET /api/projects/{project-id}/report/types | Report Types |
ResultsApi | createDetectionMethod | POST /api/detection-methods | Create Detection Method |
ResultsApi | createManualResult | POST /api/manual-results | Create Manual Result |
ResultsApi | deleteDetectionMethod | DELETE /api/detection-methods/{detection-method-id} | Delete Detection Method. |
ResultsApi | deleteManualResult | DELETE /api/manual-results/{result-id} | Delete Manual Result |
ResultsApi | getAllDetectionMethods | GET /api/detection-methods | List Detection Methods |
ResultsApi | getManualResultAllowedTools | GET /api/manual-results/allowed-tools | Get Allowed Manaul Result Tools |
ResultsApi | modifyManualResultAllowedTool | POST /api/manual-results/allowed-tools | Modify Allowed Manual Result Tool |
ResultsApi | renameDetectionMethod | PUT /api/detection-methods/{detection-method-id} | Rename Detection Method |
ResultsApi | replaceManualResult | POST /api/manual-results/{result-id}/replace | Replace Manual Result |
RuleSetsApi | addRuleCriteria | POST /api/ruleset/{ruleset-id}/rule/{rule-id}/criteria | Add Rule Criteria |
RuleSetsApi | cloneRuleSet | POST /api/ruleset/{ruleset-id}/clone | Clone Rule Set |
RuleSetsApi | createRule | POST /api/ruleset/{ruleset-id}/rule | Create Rule |
RuleSetsApi | createRuleSet | POST /api/ruleset | Create Rule Set |
RuleSetsApi | deleteRule | DELETE /api/ruleset/{ruleset-id}/rule/{rule-id} | Delete Rule |
RuleSetsApi | deleteRuleCriteria | DELETE /api/ruleset/{ruleset-id}/rule/{rule-id}/criteria | Delete Rule Criteria |
RuleSetsApi | deleteRuleSet | DELETE /api/ruleset/{ruleset-id} | Delete Rule Set |
RuleSetsApi | exportRuleSet | GET /api/ruleset/{ruleset-id}/export | Export Rule Set |
RuleSetsApi | getAllRuleSets | GET /api/ruleset/all | Get Rule Sets |
RuleSetsApi | getRuleData | GET /api/ruleset/{ruleset-id}/rule/{rule-id} | Get Rule Data |
RuleSetsApi | getRuleSetContents | GET /api/ruleset/{ruleset-id} | Get Rule Set Contents |
RuleSetsApi | modifyRuleData | PUT /api/ruleset/{ruleset-id}/rule/{rule-id} | Modify Rule Descriptor |
RuleSetsApi | renameRuleSet | PUT /api/ruleset/{ruleset-id} | Rename Rule Set |
RuleSetsApi | updateRuleSet | POST /api/ruleset/{ruleset-id}/update | Update Rule Set |
RuleSetsApi | uploadRuleSet | POST /api/ruleset/import | Import Rule Set |
StandardsApi | getStandards | GET /api/standards/filter-views | Get Standards |
SystemApi | getSystemInfo | GET /api/system-info | System Information |
UserAdministrationApi | changeUserPassword | POST /api/admin/users/local/{user-id}/password | Change Password |
UserAdministrationApi | createExternalUser | POST /api/admin/users/external | Create External User |
UserAdministrationApi | createKeyUser | POST /api/admin/users/key | Create API Key User |
UserAdministrationApi | createLdapUser | POST /api/admin/users/ldap | Create LDAP User |
UserAdministrationApi | createLocalUser | POST /api/admin/users/local | Create Local User |
UserAdministrationApi | deleteUser | DELETE /api/admin/users/{user-id} | Delete User |
UserAdministrationApi | getAllUsers | GET /api/admin/users | List All Users |
UserAdministrationApi | getExternalUsers | GET /api/admin/users/external | List External Users |
UserAdministrationApi | getKeyUsers | GET /api/admin/users/key | List API Key Users |
UserAdministrationApi | getLdapUsers | GET /api/admin/users/ldap | List LDAP Users |
UserAdministrationApi | getLocalUsers | GET /api/admin/users/local | List Local Users |
UserAdministrationApi | modifyUser | PUT /api/admin/users/{user-id} | Disable User or Add/Remove Admin |
UserAdministrationApi | regenerateApiKey | POST /api/admin/users/key/{user-id}/regenerate | Regenerate API Key |
Documentation for Models
- ActivityEvent
- Analysis
- AnalysisDetails
- AnalysisName
- AnalysisPrepResponse
- AnalysisQueryResponse
- AnalysisRecord
- Cookie
- Count
- CreateRule
- CreateUser
- CreatedBy
- Cwe
- DateRange
- Description
- DescriptionFormat
- Descriptions
- DetectionMethod
- DisableUser
- DisabledToolResultsCount
- DisplayTagState
- Element
- ElementType
- Enabled
- Error
- FileMapping
- FileUploadResponse
- Filter
- Finding
- FindingDescription
- FindingDescriptor
- FlowData
- FlowRequest
- GenerateReport
- GroupedCount
- GroupedCountsRequest
- Header
- InputDisplayInfo
- Issue
- IssueStatus
- Job
- JobStatus
- Location
- LocationRange
- ManualResultRequest
- ManualResultResponse
- MappingsRequest
- Metadata
- MetadataUpdate
- MetadataValue
- ModifyRuleResponse
- Option
- Pagination
- Password
- Path
- PathType
- PostComment
- ProfilePasswordChange
- Project
- ProjectFile
- ProjectId
- ProjectQuery
- ProjectQueryFilter
- ProjectQueryResponse
- Projects
- Query
- ReportConfigOption
- ReportConfigOptionType
- ReportConfigRegex
- ReportConfigRequired
- ReportType
- RequestResponse
- ResultDescription
- Rev
- Roles
- Rule
- RuleCriteria
- RuleCriteriaType
- RuleDescriptor
- RuleGroup
- RuleSet
- RuleSetContents
- RuleSetDeleteError
- RuleSetDeleteResponse
- ScmInfo
- ScmSetup
- SetStatus
- SetStatusBulk
- Severity
- SeverityKey
- SeverityOverride
- SeverityValue
- Sort
- SortDescriptor
- SortDirection
- Standard
- Status
- SystemInfo
- ToolResult
- ToolResultLocation
- ToolResultPath
- UpdateProject
- User
- UserRole
- Variant
Documentation for Authorization
Authentication schemes defined for the API:
APIKeyHeader
- Type: API key
- API key parameter name: API-Key
- Location: HTTP header
basicAuth
- Type: HTTP basic authentication
Recommendation
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.