Risk Factors
Get All Risk Factors
This endpoint retrieves a list of Risk Factor resources.
GET /api/v2/risk-factors/
GET /api/v2/risk-factors/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [
{
"answers": [
{
"answer": "A1",
"score": 1
},
{
"answer": "A2",
"score": 2
}
],
"created": "2015-06-05T02:55:54.231254Z",
"function": "max",
"id": 1,
"name": "MyRiskFactor",
"last_updated": "2015-06-05T02:55:54.231254Z"
},
{
"answers": [
{
"answer": "A50",
"score": 100
},
{
"answer": "A123",
"score": 20
}
],
"created": "2015-06-05T02:55:54.231254Z",
"function": "min",
"id": 2,
"name": "SomeFactor",
"last_updated": "2015-06-05T02:55:54.231254Z"
}
]
}
Create a New Risk Factor
Fields | Required | Description |
---|---|---|
name | Yes | The name of the new risk factor (no spaces allowed). Used in a project classification factor_expression : for example, "RiskFactor1", "RF1", or "MyRiskFactor". |
function | Yes | The function to perform on the answers of this risk factor. (supported functions: max, min, sum, avg - case sensitive) |
answers | Yes | A list of answers and their scores. |
answers.answer | Yes | An answer in the factor, must be available in the organization. |
answers.score | Yes | The score or weight for the respective answer (integer). |
POST /api/v2/risk-factors/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"name": "MyRiskFactor",
"function": "max",
"answers": [{
"answer": "A1",
"score": 1
}]
}
HTTP/1.1 201 CREATED
Content-Type: application/json
{
"answers": [
{
"answer": "A1",
"score": 1
}
],
"created": "2015-06-05T02:55:54.231254Z",
"function": "max",
"id": 1,
"name": "MyRiskFactor",
"last_updated": "2015-06-05T02:55:54.231254Z"
}
Update a Risk Factor
Update a single risk factor. The risk factor to update is identified by the id.
PATCH /api/v2/risk-factors/{risk_factor_id}/
URL Parameters
Parameter | Description |
---|---|
risk_factor_id | The id of the risk factor to edit must be submitted in the request |
Payload
Fields | Required | Description |
---|---|---|
name | No | The name of the new risk factor. |
function | No | The function to perform on the answers of this risk factor. (supported functions: max, min, sum, avg - case sensitive) |
answers | No | A list of answers and their scores. |
PATCH /api/v2/risk-factors/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"answers": [
{
"answer": "A20",
"score": 10
}
]
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [
{
"answer": "A20",
"score": 10
}
],
"created": "2015-06-05T02:55:54.231254Z",
"id": 1,
"name": "MyRiskFactor",
"function": "max",
"last_updated": "2015-06-05T02:55:54.231254Z"
}
Delete a Risk Factor
This endpoint deletes a single Risk Factor resource, as specified by the id parameter.
DELETE /risk-factors/{risk_factor_id}/
URL Parameters
Parameter | Description |
---|---|
risk_factor_id | The id of the risk factor to delete must be submitted in the request. |
DELETE /api/v2/risk-factors/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 204 NO CONTENT
Get a Specific Risk Factor
This endpoint retrieves a specific risk factor resource, as specified by the id parameter.
GET /api/v2/risk-factors/{risk_factor_id}/
URL Parameters
Parameter | Description |
---|---|
risk_factor_id | The id of the risk factor to retrieve |
GET /api/v2/risk-factors/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [
{
"answer": "A1",
"score": 1
},
{
"answer": "A2",
"score": 2
}
],
"created": "2015-06-05T02:55:54.231254Z",
"function": "max",
"id": 1,
"name": "MyRiskFactor",
"last_updated": "2015-06-05T02:55:54.231254Z"
}