Library Answers
ℹ️ Note: The attribute field is only available when Decision Engine is enabled.
Get all Library Answers
This endpoint retrieves a list of Library Answer resources.
GET /api/v2/library/answers/
GET /api/v2/library/answers/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [
{
"db_id": 1,
"id": "A1",
"text": "Java",
"description": "Java is a popular programming language used for building web applications, mobile apps, and enterprise-grade solutions, leveraging Java EE, Spring, and Android. Security tasks involve assessing code for vulnerabilities like SQL injection, securing mobile environments, and ensuring data protection compliance.",
"display_text": "Programming Language - Java",
"is_active": true,
"attribute": "AT340",
"type": "Built-in",
"ordinal": 50,
"implied_answers": [
"A58",
"A92",
"A683",
"A1102"
],
"question": "Q109"
},
{
"db_id": 2,
"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,
"attribute": "AT279",
"type": "Built-in",
"ordinal": 20,
"implied_answers": [
"A58",
"A683",
"A48"
],
"question": "Q109"
},
{
"db_id": 3,
"id": "A3",
"text": "JavaScript",
"description": "JavaScript is a high-level programming language commonly used for creating interactive effects within web browsers, often seen in frameworks like React or Node.js. Security work involves addressing vulnerabilities such as cross-site scripting (XSS) and ensuring secure handling of user inputs and data exposure.",
"display_text": "Programming Language - JavaScript",
"is_active": true,
"attribute": "AT348",
"type": "Built-in",
"ordinal": 60,
"implied_answers": [
"A1102"
],
"question": "Q109"
}
]
}
Get a specific Library Answer
This endpoint retrieves a specific active Library Answer, as specified by the id parameter.
GET /api/v2/library/answers/{answer_id}/
URL Parameters
| Parameter | Description |
|---|---|
| answer_id | The id of the Library Answer to retrieve. |
GET /api/v2/library/answers/A1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"db_id": 1,
"id": "A1",
"text": "Java",
"description": "Java is a popular programming language used for building web applications, mobile apps, and enterprise-grade solutions, leveraging Java EE, Spring, and Android. Security tasks involve assessing code for vulnerabilities like SQL injection, securing mobile environments, and ensuring data protection compliance.",
"display_text": "Programming Language - Java",
"is_active": true,
"attribute": "AT340",
"type": "Built-in",
"ordinal": 50,
"implied_answers": [
"A58",
"A92",
"A683",
"A1102"
],
"question": "Q109"
}
Create a Custom Answer
This endpoint creates a Custom Library Answer resource.
POST /api/v2/library/answers/
Payload
| Fields | Required | Description |
|---|---|---|
| text | Yes | The name of the Library Answer. |
| description | No | A description of the Library Answer. |
| question | Yes | The ID of the question to which the Library Answer belongs. |
| attribute | No | The ID of the attribute to which this Library Answer maps. This field is only available when Decision Engine is enabled. |
| implied_answers | No | A list of implied answer IDs for the Library Answer. |
| ordinal | No | The position of the Library Answer among other Library Answers for the same question. Lower numbers appear first. If unspecified, the Library Answer will appear first in the question. |
| is_active | No | The active status of the Library Answer (defaults to true). |
POST /api/v2/library/attributes/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"text": "My Answer",
"description": "A description for this new answer",
"question": "Q101",
"attribute": "AT2",
"implied_answers": ["A1"],
"ordinal": 0,
"is_active": true
}
HTTP/1.1 201 CREATED
Content-Type: application/json
{
"db_id": -1,
"id": "CA1",
"text": "My Answer",
"description": "A description for this new answer",
"display_text": "Components In Development - My Answer",
"is_active": true,
"attribute": "AT2",
"type": "Custom",
"ordinal": 93,
"implied_answers": [
"A1"
],
"question": "Q101"
}
Update the active status for a specific Library Answer
Update the active status for a specific Library Answer, as specified by the id parameter.
PATCH /api/v2/library/answers/{answer_id}/
URL Parameters
| Parameter | Description |
|---|---|
| answer_id | The id of the Library Answer to update. |
Payload
| Fields | Required | Description |
|---|---|---|
| is_active | Yes | Boolean value to activate/deactivate an Answer |
PATCH /api/v2/library/answers/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"is_active": true
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"db_id": 1,
"id": "A1",
"text": "Java",
"description": "Java is a popular programming language used for building web applications, mobile apps, and enterprise-grade solutions, leveraging Java EE, Spring, and Android. Security tasks involve assessing code for vulnerabilities like SQL injection, securing mobile environments, and ensuring data protection compliance.",
"display_text": "Programming Language - Java",
"is_active": true,
"attribute": "AT340",
"type": "Built-in",
"ordinal": 50,
"implied_answers": [
"A58",
"A92",
"A683",
"A1102"
],
"question": "Q109"
}