Project Attributes
ℹ️ Note: This feature is only available when Decision Engine is enabled.
Get All Project Attributes
This endpoint retrieves a list of Attribute resources relevant to a particular Project.
GET /api/v2/projects/{project_id}/attributes/
URL Parameters
| Parameter | Description |
|---|---|
| project_id | The id of the Project to retrieve Attributes for |
Query Parameters
| Parameter | Description |
|---|---|
| id | Filter by Attribute ID |
| id__in | Filter by a list of Attribute IDs. Comma-separated (e.g. AT1,AT2) |
| name | Filter by Attribute name |
| name__in | Filter by a list of Attribute names. Comma-separated |
| search | Filter by performing a text search on Attribute name and description |
| ordering | Sort by the specified field. Prefix field name with minus to sort descending. Supported fields: id, name |
GET /api/v2/projects/1/attributes/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [
{
"id": "AT1",
"name": "Password Authentication",
"description": "The application uses password-based authentication"
},
{
"id": "AT2",
"name": "Stores Sensitive Data",
"description": "The application stores sensitive user data"
}
]
}
Include Parameters
See the Include Parameters section for more details.
| Parameter | Description |
|---|---|
| sources | A list of sources explaining why the Attribute is relevant to the Project. |
GET /api/v2/projects/1/attributes/?include=sources HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [
{
"id": "AT1",
"name": "Password Authentication",
"description": "The application uses password-based authentication",
"sources": [
{
"type": "survey",
"reason": "Answer [Uses password authentication](/path/to/answer/)",
"actor": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
}
}
]
},
{
"id": "AT2",
"name": "Stores Sensitive Data",
"description": "The application stores sensitive user data",
"sources": [
{
"type": "diagram",
"reason": "Diagram node [Database Server](/path/to/node/)",
"actor": {
"id": 2,
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com"
}
}
]
}
]
}
Get a Specific Project Attribute
This endpoint retrieves a specific Attribute resource relevant to a particular Project.
GET /api/v2/projects/{project_id}/attributes/{attribute_id}/
URL Parameters
| Parameter | Description |
|---|---|
| project_id | The id of the Project to retrieve Attributes for |
| attribute_id | The id of the Attribute to retrieve |
GET /api/v2/projects/1/attributes/AT1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "AT1",
"name": "Password Authentication",
"description": "The application uses password-based authentication"
}
Include Parameters
All of the include parameters for the Get All Project Attributes endpoint apply here as well.
Manually add Project Attributes
ℹ️ Note: This feature is only available when the
ENABLE_PROJECT_ATTRIBUTES_PAGEfeature flag is enabled.
This endpoint manually adds one or more Attributes to a given Project. Each Attribute is added with a manually_added source that records the requesting user and the reason it was added.
Any parent Attributes implied by the manually added Attributes are also added to the Project with a manually_added_implied source. All content changes are refreshed and accepted automatically.
POST /api/v2/projects/{project_id}/attributes/bulk/
URL Parameters
| Parameter | Description |
|---|---|
| project_id | The id of the Project to add Attributes to. |
Request Body
The request body is a list of objects, each with the following fields:
| Field | Required | Description |
|---|---|---|
| attribute_id | Yes | The id of the Attribute to add to the Project. |
| source_reason | No | The reason the Attribute is being added, up to 1024 characters. Defaults to Manually added to the project. |
The response contains the added Project Attributes and their sources. Attributes that were added because they are implied by the requested Attributes are not included in the response.
The request fails with a 400 Bad Request if the same Attribute is listed more than once, if any Attribute is not available to the organization, or if any Attribute is already in the Project. No Attributes are added when the request fails.
Adding Attributes requires the edit_project_attributes permission on the Project.
POST /api/v2/projects/1/attributes/bulk/ HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
[
{
"attribute_id": "AT1",
"source_reason": "Needed for compliance"
},
{
"attribute_id": "AT2"
}
]
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "AT1",
"name": "Password Authentication",
"description": "The application uses password-based authentication",
"sources": [
{
"type": "manually_added",
"reason": "Needed for compliance",
"actor": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
}
}
]
},
{
"id": "AT2",
"name": "Stores Sensitive Data",
"description": "The application stores sensitive user data",
"sources": [
{
"type": "manually_added",
"reason": "Manually added to the project",
"actor": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
}
}
]
}
]
Delete a manually added Project Attribute source
ℹ️ Note: This feature is only available when the
ENABLE_PROJECT_ATTRIBUTES_PAGEfeature flag is enabled.
This endpoint deletes the manually added source, if it exists, and its implied sources for a specific Attribute resource relevant to a particular Project, as specified by the id parameters. Any Project Attributes left without sources as a result of this action are also deleted.
DELETE /api/v2/projects/{project_id}/attributes/{attribute_id}/sources/manual/
URL Parameters
| Parameter | Description |
|---|---|
| project_id | The id of the Project to retrieve Attributes for |
| attribute_id | The id of the Attribute to retrieve |
DELETE /api/v2/projects/1/attributes/AT1/sources/manual/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
{}