Project Survey Draft
Reset the draft
Reverts changes to the draft to the last saved state.
DELETE /api/v2/projects/{project_id}/survey/draft/
DELETE /api/v2/projects/1/survey/draft/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [{
"id": "A21",
"selected": false,
"valid": true
}],
"survey_complete": true,
"dirty": false,
"matched_classification_answers": [],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00",
"is_unclassified": false
}
}
Save the draft
This saves the current changes to the draft to the project. This may cause changes in the applicable tasks & other content for the project as well as accepting any other unaccepted changes to the tasks. It will also update and return the project's risk classification based on the selected answers.
POST /api/v2/projects/{project_id}/survey/draft/
POST /api/v2/projects/1/survey/draft/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [{
"id": "A21",
"selected": false,
"valid": true
}],
"survey_complete": true,
"dirty": false,
"matched_classification_answers": [
{
"id": "A21",
"text": "Passwords stored in configuration files",
"description": "The application stores passwords in configuration files, such as passwords for database connection strings.",
"display_text": "Encryption - Passwords stored in configuration files",
"is_active": true
}
],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00",
"is_unclassified": false
}
}
Modify an answer in the draft
Modifies the specified answer in the draft and returns the full draft state. This may affect other answer's selected and valid values.
PATCH /api/v2/projects/{project_id}/survey/draft/{answer_id}/
Field | Required | Description |
---|---|---|
selected | Yes | Selects or unselects the specified answer |
PATCH /api/v2/projects/1/survey/draft/A21/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{"selected": true}
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [{
"id": "A21",
"selected": true,
"valid": true
}],
"survey_complete": true,
"dirty": true,
"matched_classification_answers": [],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00",
"is_unclassified": false
}
}
Clone a profile to the draft
Clears the current draft and uses the answers set on the specified profile for the draft instead. Any unsaved changes will be lost.
PATCH /api/v2/projects/{project_id}/survey/draft/
Field | Required | Description |
---|---|---|
profile | Yes | Profile id of profile to clone from |
PATCH /api/v2/projects/1/survey/draft/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{"profile": "P21"}
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [{
"id": "A21",
"selected": true,
"valid": true
}],
"survey_complete": true,
"dirty": true,
"matched_classification_answers": [
{
"id": "A21",
"text": "Passwords stored in configuration files",
"description": "The application stores passwords in configuration files, such as passwords for database connection strings.",
"display_text": "Encryption - Passwords stored in configuration files",
"is_active": true
}
],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00",
"is_unclassified": false
}
}
Get the current state of the project survey draft
Returns the current state of the survey draft. All non-hidden answers are returned along with whether they are selected and whether they are valid for the current survey state. Dirty is a boolean representing whether the current draft state is different from the last saved survey.
GET /api/v2/projects/{project_id}/survey/draft/
GET /api/v2/projects/1/survey/draft/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [
{
"hidden": false,
"id": "A1",
"dirty": false,
"selected": false,
"valid": true,
"question": "Q109"
},
{
"hidden": false,
"id": "A2",
"dirty": true,
"selected": true,
"question": "Q109",
"valid": true
}
],
"survey_complete": true,
"dirty": false,
"matched_classification_answers": [
{
"id": "A2",
"text": "C#",
"description": "C# is a multi-paradigm programming language developed by Microsoft within its .NET framework.",
"display_text": "Programming Language - C#",
"is_active": true
}
],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00",
"is_unclassified": false
}
}
Include Filters
See the Include Parameters section for more details.
Parameter | Description |
---|---|
survey | Includes a full representation of the survey structure with metadata |
hidden | Includes hidden answers and questions |
Note: format
field: SC for single choice, else MC
GET /api/v2/projects/1/survey/draft/?include=survey,hidden HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"answers": [
{
"hidden": true,
"selected": false,
"dirty": false,
"question": "Q109",
"id": "A1",
"valid": true
},
{
"hidden": false,
"selected": true,
"dirty": true,
"question": "Q109",
"id": "A2",
"valid": true
}
],
"survey_complete": true,
"dirty": false,
"sections": [{
"id": "S1",
"title": "Application Survey",
"slug": "application-survey",
"subsections": [{
"id": "Q1",
"title": "Programming Language",
"questions": [{
"id": "Q21",
"text": "Is this a question?",
"description": "Help text",
"format": "MC",
"mandatory": false,
"satisfied": true,
"comment_required": false,
"subquestions": [{
"mandatory": false,
"description": "",
"format": "MC",
"text": "Sub Question?",
"satisfied": true,
"comment_required": false,
"answers": [
{
"description": "Description 1",
"text": "Answer 1",
"selected": false,
"selected_by": [],
"valid": true,
"id": "A11"
},
{
"description": "Description 2",
"text": "Answer 2",
"selected": false,
"selected_by": [],
"valid": true,
"id": "A12"
}
],
"id": "Q216"
}],
"answers": [{
"id": "A21",
"text": "Yes",
"description": "Help text",
"selected": false,
"valid": true,
"selected_by": []
}]
}]
}]
}],
"matched_classification_answers": [
{
"id": "A2",
"text": "C#",
"description": "C# is a multi-paradigm programming language developed by Microsoft within its .NET framework.",
"display_text": "Programming Language - C#",
"is_active": true
}
],
"project_classification": {
"id": 1,
"ordinal": 1,
"name": "Critical",
"description": "Critical Risk Classification",
"default_risk_policy": null,
"risk_policies": [],
"answers": [
"A2"
],
"last_update_date_time": "2019-06-27T11:40:13.231502-04:00"
}
}