# ThreatsApi
All URIs are relative to *https://demo.iriusrisk.com/api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost**](ThreatsApi.md#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost) | **POST** /libraries/{libraryRef}/riskpatterns/{riskPatternRef}/usecases/{useCaseRef}/threats | Creates a new threat in a library.
[**librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut**](ThreatsApi.md#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut) | **PUT** /libraries/{libraryRef}/riskpatterns/{riskPatternRef}/usecases/{useCaseRef}/threats/{threatRef}/countermeasures | Associates a countermeasure to a threat in a risk pattern.
[**librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut**](ThreatsApi.md#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut) | **PUT** /libraries/{libraryRef}/riskpatterns/{riskPatternRef}/usecases/{useCaseRef}/threats/{threatRef}/weaknesses | Associates weakness to a threat in a risk pattern.
[**librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut**](ThreatsApi.md#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut) | **PUT** /libraries/{libraryRef}/riskpatterns/{riskPatternRef}/usecases/{useCaseRef}/threats/{threatRef}/weaknesses/{weaknessRef}/countermeasures | Associates a countermeasure to a weakness in a risk pattern.
[**productsRefThreatsGet**](ThreatsApi.md#productsRefThreatsGet) | **GET** /products/{ref}/threats | Gets a list of all threats of a product
# **librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost**
> LibraryThreat librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost(apiToken, libraryRef, riskPatternRef, useCaseRef, createThreatLibraryRequestBody)
Creates a new threat in a library.
Creates a new threat in a library. Conditions to be able to perform the action: - To have the permission **LIBRARY_UPDATE** granted.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.ThreatsApi;
ThreatsApi apiInstance = new ThreatsApi();
String apiToken = "apiToken_example"; // String | Authentication token
String libraryRef = "libraryRef_example"; // String | Reference for library
String riskPatternRef = "riskPatternRef_example"; // String | Reference for Risk Pattern
String useCaseRef = "useCaseRef_example"; // String | Reference for Use Case
CreateThreatLibraryRequestBody createThreatLibraryRequestBody = new CreateThreatLibraryRequestBody(); // CreateThreatLibraryRequestBody | JSON data that contains information of the fields
try {
LibraryThreat result = apiInstance.librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost(apiToken, libraryRef, riskPatternRef, useCaseRef, createThreatLibraryRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ThreatsApi#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsPost");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiToken** | **String**| Authentication token |
**libraryRef** | **String**| Reference for library |
**riskPatternRef** | **String**| Reference for Risk Pattern |
**useCaseRef** | **String**| Reference for Use Case |
**createThreatLibraryRequestBody** | [**CreateThreatLibraryRequestBody**](CreateThreatLibraryRequestBody.md)| JSON data that contains information of the fields |
### Return type
[**LibraryThreat**](LibraryThreat.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut**
> LibraryControl librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, associateCountermeasureThreatLibraryRequestBody)
Associates a countermeasure to a threat in a risk pattern.
Associates a countermeasure to a threat in a risk pattern. Conditions to be able to perform the action: - To have the permission **LIBRARY_UPDATE** granted.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.ThreatsApi;
ThreatsApi apiInstance = new ThreatsApi();
String apiToken = "apiToken_example"; // String | Authentication token
String libraryRef = "libraryRef_example"; // String | Reference for library
String riskPatternRef = "riskPatternRef_example"; // String | Reference for Risk Pattern
String useCaseRef = "useCaseRef_example"; // String | Reference for Use Case
String threatRef = "threatRef_example"; // String | Reference for Threat
AssociateCountermeasureThreatLibraryRequestBody associateCountermeasureThreatLibraryRequestBody = new AssociateCountermeasureThreatLibraryRequestBody(); // AssociateCountermeasureThreatLibraryRequestBody | JSON data that contains information of the fields
try {
LibraryControl result = apiInstance.librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, associateCountermeasureThreatLibraryRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ThreatsApi#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefCountermeasuresPut");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiToken** | **String**| Authentication token |
**libraryRef** | **String**| Reference for library |
**riskPatternRef** | **String**| Reference for Risk Pattern |
**useCaseRef** | **String**| Reference for Use Case |
**threatRef** | **String**| Reference for Threat |
**associateCountermeasureThreatLibraryRequestBody** | [**AssociateCountermeasureThreatLibraryRequestBody**](AssociateCountermeasureThreatLibraryRequestBody.md)| JSON data that contains information of the fields |
### Return type
[**LibraryControl**](LibraryControl.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut**
> LibraryWeakness librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, associateWeaknessThreatLibraryRequestBody)
Associates weakness to a threat in a risk pattern.
Associates weakness to a threat in a risk pattern. Conditions to be able to perform the action: - To have the permission **LIBRARY_UPDATE** granted.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.ThreatsApi;
ThreatsApi apiInstance = new ThreatsApi();
String apiToken = "apiToken_example"; // String | Authentication token
String libraryRef = "libraryRef_example"; // String | Reference for library
String riskPatternRef = "riskPatternRef_example"; // String | Reference for Risk Pattern
String useCaseRef = "useCaseRef_example"; // String | Reference for Use Case
String threatRef = "threatRef_example"; // String | Reference for Threat
AssociateWeaknessThreatLibraryRequestBody associateWeaknessThreatLibraryRequestBody = new AssociateWeaknessThreatLibraryRequestBody(); // AssociateWeaknessThreatLibraryRequestBody | JSON data that contains information of the fields
try {
LibraryWeakness result = apiInstance.librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, associateWeaknessThreatLibraryRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ThreatsApi#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesPut");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiToken** | **String**| Authentication token |
**libraryRef** | **String**| Reference for library |
**riskPatternRef** | **String**| Reference for Risk Pattern |
**useCaseRef** | **String**| Reference for Use Case |
**threatRef** | **String**| Reference for Threat |
**associateWeaknessThreatLibraryRequestBody** | [**AssociateWeaknessThreatLibraryRequestBody**](AssociateWeaknessThreatLibraryRequestBody.md)| JSON data that contains information of the fields |
### Return type
[**LibraryWeakness**](LibraryWeakness.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut**
> LibraryControl librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, weaknessRef, associateCountermeasureWeaknessLibraryRequestBody)
Associates a countermeasure to a weakness in a risk pattern.
Associates a countermeasure to a weakness in a risk pattern. Conditions to be able to perform the action: - To have the permission **LIBRARY_UPDATE** granted.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.ThreatsApi;
ThreatsApi apiInstance = new ThreatsApi();
String apiToken = "apiToken_example"; // String | Authentication token
String libraryRef = "libraryRef_example"; // String | Reference for library
String riskPatternRef = "riskPatternRef_example"; // String | Reference for Risk Pattern
String useCaseRef = "useCaseRef_example"; // String | Reference for Use Case
String threatRef = "threatRef_example"; // String | Reference for Threat
String weaknessRef = "weaknessRef_example"; // String | Reference for Weakness
AssociateCountermeasureWeaknessLibraryRequestBody associateCountermeasureWeaknessLibraryRequestBody = new AssociateCountermeasureWeaknessLibraryRequestBody(); // AssociateCountermeasureWeaknessLibraryRequestBody | JSON data that contains information of the fields
try {
LibraryControl result = apiInstance.librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut(apiToken, libraryRef, riskPatternRef, useCaseRef, threatRef, weaknessRef, associateCountermeasureWeaknessLibraryRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ThreatsApi#librariesLibraryRefRiskpatternsRiskPatternRefUsecasesUseCaseRefThreatsThreatRefWeaknessesWeaknessRefCountermeasuresPut");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiToken** | **String**| Authentication token |
**libraryRef** | **String**| Reference for library |
**riskPatternRef** | **String**| Reference for Risk Pattern |
**useCaseRef** | **String**| Reference for Use Case |
**threatRef** | **String**| Reference for Threat |
**weaknessRef** | **String**| Reference for Weakness |
**associateCountermeasureWeaknessLibraryRequestBody** | [**AssociateCountermeasureWeaknessLibraryRequestBody**](AssociateCountermeasureWeaknessLibraryRequestBody.md)| JSON data that contains information of the fields |
### Return type
[**LibraryControl**](LibraryControl.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **productsRefThreatsGet**
> List<ComponentUseCaseThreatShort> productsRefThreatsGet(apiToken, ref)
Gets a list of all threats of a product
Returns a list of all the threats of a product. Conditions to be able to perform the action: - To have the permission **THREAT_VIEW** granted, or - To have the permission **THREAT_UPDATE** granted.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.ThreatsApi;
ThreatsApi apiInstance = new ThreatsApi();
String apiToken = "apiToken_example"; // String | Authentication token
String ref = "ref_example"; // String | ID for product
try {
List result = apiInstance.productsRefThreatsGet(apiToken, ref);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ThreatsApi#productsRefThreatsGet");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiToken** | **String**| Authentication token |
**ref** | **String**| ID for product |
### Return type
[**List<ComponentUseCaseThreatShort>**](ComponentUseCaseThreatShort.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json