Projects Bulk Operations

Project Bulk Operations

This endpoint allows CREATE, UPDATE, and DELETE operations on multiple projects in a single request.

Bulk Operation Notes

  • The maximum number of projects that can be operated on with a single request is configurable via the environment variable PROJECTS_BULK_CREATE_LIMIT (Ask your SDE Admin to adjust this if needed).
  • The default maximum is set to 20 projects.

Project Entity Fields

The following fields detail the fields of a project entity. A list of these entities can be passed to the CREATE and UPDATE bulk methods. Examples are listed under each method.

Fields Required Description
application Yes The ID of the application the project should be created under.
groups No A list of dictionaries per group that are to be assigned to the project. Each dictionary should contain the group's id and desired role.
Note: If this parameter is included, the Business Unit that the application will add the new project to must either have these groups as members or be configured with the "All Users" option.
name Yes The name of the new project.
profile No The ID of the desired profile for the project.
users No A list of dictionaries per user that are to be assigned to the project. Each dictionary should contain the user's email and desired role.
locked No A boolean field to lock or unlock the project. It can only be used by users that have the lock_project_survey permission
risk_policy No The ID of the risk policy that applies to this project.
tags No A list of tags applicable to the project.
answers No An array of Answer IDs that represent survey answers that apply to this project. Answer IDs are strings and deployment-specific.
Note: For each project, SD Elements selects Answers first from the Survey profile and then from the Answers that users provide while manually completing the Survey.
custom_attributes Depends The JSON of custom attributes as defined by your administrator. This field is not required unless mandated by your administrator. See Project attributes for more information.
Note: The custom_attributes field is case-sensitive. Fields included with a project payload that have not been added through the web front-end are saved but only accessible via the API.

Bulk Create Projects

This endpoint accepts a list of Project entities to create.

In the event of a request timeout, this endpoint will commit all operations successfully done up until the timeout to the database. This means that retrying the same request will surface error messages for the projects that were successfully created in the previous request, indicating that they already exist.

POST /api/v2/projects/bulk/

POST /api/v2/projects/bulk/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

[
    {
        "application": 1,
        "name": "Proj 1"
    },
    {
        "application": 1,
        "name": "Proj 2"
    },
    {
        "application": 1,
        "name": "Proj 3",
        "answers": [
            "A1",
            "A2"
        ],
        "profile": "P9",
        "users": [
            {
                "email": "admin@example.com",
                "role": "PR4"
            }
        ]
    }
]
HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "number_records_processed": 3,
    "number_records_failed": 0,
    "total": 3,
    "results": {
        "created_records": [
            {
                "project": {
                    "application": 1,
                    "application_tags": [],
                    "archived": false,
                    "base_project": null,
                    "components": [],
                    "connected_component": null,
                    "created": "2024-09-27T15:00:34.458724-04:00",
                    "creator": 1,
                    "custom_attributes": {},
                    "description": "",
                    "groups": [],
                    "id": 33,
                    "locked": false,
                    "locked_by": null,
                    "locked_on": null,
                    "lookup_data": {},
                    "name": "Proj 1",
                    "parent": null,
                    "profile": {
                        "id": "P1",
                        "name": "Blank",
                        "logo_url": "/static/images/logo-other.png",
                        "active": true
                    },
                    "profile_draft": null,
                    "release_project": false,
                    "project_classification": null,
                    "project_locked": false,
                    "project_lock_modified_on": null,
                    "project_lock_modified_by": null,
                    "risk_policy": 1,
                    "risk_policy_compliant": null,
                    "slug": "proj-1",
                    "survey_dirty": false,
                    "survey_complete": true,
                    "tags": [],
                    "updated": "2024-09-27T15:00:34.842478-04:00",
                    "url": "http://example.com/bunits/bu1/app1/proj-1/",
                    "users": [
                        {
                            "id": 1,
                            "email": "admin@example.com",
                            "first_name": "Admin",
                            "last_name": "Testerton",
                            "is_active": true,
                            "role": "PR4",
                            "is_creator": true
                        }
                    ],
                    "external_id": "project-3a8d2f94-7b5a-490e-878d-42f02e5f614d"
                }
            },
            {
                "project": {
                    "application": 1,
                    "application_tags": [],
                    "archived": false,
                    "base_project": null,
                    "components": [],
                    "connected_component": null,
                    "created": "2024-09-27T15:00:35.613878-04:00",
                    "creator": 1,
                    "custom_attributes": {},
                    "description": "",
                    "groups": [],
                    "id": 34,
                    "locked": false,
                    "locked_by": null,
                    "locked_on": null,
                    "lookup_data": {},
                    "name": "Proj 2",
                    "parent": null,
                    "profile": {
                        "id": "P1",
                        "name": "Blank",
                        "logo_url": "/static/images/logo-other.png",
                        "active": true
                    },
                    "profile_draft": null,
                    "release_project": false,
                    "project_classification": null,
                    "project_locked": false,
                    "project_lock_modified_on": null,
                    "project_lock_modified_by": null,
                    "risk_policy": 1,
                    "risk_policy_compliant": null,
                    "slug": "proj-2",
                    "survey_dirty": false,
                    "survey_complete": true,
                    "tags": [],
                    "updated": "2024-09-27T15:00:36.011167-04:00",
                    "url": "http://example.com/bunits/bu1/app1/proj-2/",
                    "users": [
                        {
                            "id": 1,
                            "email": "admin@example.com",
                            "first_name": "Admin",
                            "last_name": "Testerton",
                            "is_active": true,
                            "role": "PR4",
                            "is_creator": true
                        }
                    ],
                    "external_id": "project-94c695dc-3589-4c3c-8e79-1ddb7cb14ae9"
                }
            },
            {
                "project": {
                    "application": 1,
                    "application_tags": [],
                    "archived": false,
                    "base_project": null,
                    "components": [
                        {
                            "id": "SC2",
                            "title": "Database Server"
                        },
                        {
                            "id": "SC24",
                            "title": "Mobile App"
                        },
                        {
                            "id": "SC25",
                            "title": "Android App"
                        },
                        {
                            "id": "SC48",
                            "title": "Software"
                        }
                    ],
                    "connected_component": null,
                    "created": "2024-09-27T15:00:37.628788-04:00",
                    "creator": 1,
                    "custom_attributes": {},
                    "description": "",
                    "groups": [],
                    "id": 35,
                    "locked": false,
                    "locked_by": null,
                    "locked_on": null,
                    "lookup_data": {},
                    "name": "Proj 3",
                    "parent": null,
                    "profile": {
                        "id": "P9",
                        "name": "Android App",
                        "logo_url": "/static/images/logo-android.png",
                        "active": true
                    },
                    "profile_draft": null,
                    "release_project": false,
                    "project_classification": null,
                    "project_locked": false,
                    "project_lock_modified_on": null,
                    "project_lock_modified_by": null,
                    "risk_policy": 1,
                    "risk_policy_compliant": null,
                    "slug": "proj-3",
                    "survey_dirty": false,
                    "survey_complete": true,
                    "tags": [],
                    "updated": "2024-09-27T15:00:39.540707-04:00",
                    "url": "http://example.com/bunits/bu1/app1/proj-3/",
                    "users": [
                        {
                            "id": 1,
                            "email": "admin@example.com",
                            "first_name": "Admin",
                            "last_name": "Testerton",
                            "is_active": true,
                            "role": "PR4",
                            "is_creator": true
                        }
                    ],
                    "external_id": "project-dad47602-a4c1-4e83-8ff2-52dcfb92a64d"
                }
            }
        ],
        "errors": []
    }
}

Bulk Update Projects

Similar to the CREATE operation, this endpoint accepts a list of project entities to update. Additionally, an id referencing the project to be updated must be part of every project payload provided.

PUT /api/v2/projects/bulk/

PUT /api/v2/projects/bulk/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

[
    {
        "id": 1,
        "application": 1,
        "name": "Project Test Update Name"
    },
    {
        "id": 2,
        "application": 1,
        "name": "Project Test Update Name2"
    }
]
HTTP/1.1 200 OK
Content-Type: application/json
{
    "number_records_processed": 2,
    "number_records_failed": 0,
    "total": 2,
    "results": {
        "updated_records": [
            {
                "application": 1,
                "application_tags": [],
                "archived": false,
                "base_project": null,
                "components": [],
                "connected_component": null,
                "created": "2024-08-30T16:20:18.310025-04:00",
                "creator": 1,
                "custom_attributes": {},
                "description": "",
                "groups": [],
                "id": 2,
                "locked": false,
                "locked_by": null,
                "locked_on": null,
                "lookup_data": {},
                "name": "Project Test Update Name2",
                "parent": null,
                "profile": {
                    "id": "P1",
                    "name": "Blank",
                    "logo_url": "/static/images/logo-other.png",
                    "active": true
                },
                "profile_draft": null,
                "release_project": false,
                "project_classification": null,
                "project_locked": false,
                "project_lock_modified_on": "2024-08-30T16:20:36.149613-04:00",
                "project_lock_modified_by": {
                    "id": 1,
                    "email": "admin@example.com",
                    "first_name": "Admin",
                    "last_name": "Testerton"
                },
                "risk_policy": 1,
                "risk_policy_compliant": true,
                "slug": "proj2",
                "survey_dirty": false,
                "survey_complete": true,
                "tags": [],
                "updated": "2024-09-26T15:49:46.871233-04:00",
                "url": "http://example.com/bunits/bu1/app1/proj2/",
                "users": [
                    {
                        "id": 1,
                        "email": "admin@example.com",
                        "first_name": "Admin",
                        "last_name": "Testerton",
                        "is_active": true,
                        "role": "PR4",
                        "is_creator": true
                    }
                ],
                "external_id": "project-455629f1-7105-4cd7-814b-70563682b4f8"
            },
            {
                "application": 1,
                "application_tags": [],
                "archived": false,
                "base_project": null,
                "components": [
                    {
                        "id": "SC29",
                        "title": "Web Application - Backend"
                    },
                    {
                        "id": "SC48",
                        "title": "Software"
                    }
                ],
                "connected_component": null,
                "created": "2024-08-29T14:13:31.469705-04:00",
                "creator": 1,
                "custom_attributes": {},
                "description": "",
                "groups": [],
                "id": 1,
                "locked": false,
                "locked_by": null,
                "locked_on": null,
                "lookup_data": {},
                "name": "Project Test Update Name",
                "parent": null,
                "profile": {
                    "id": "P1",
                    "name": "Blank",
                    "logo_url": "/static/images/logo-other.png",
                    "active": true
                },
                "profile_draft": null,
                "release_project": false,
                "project_classification": null,
                "project_locked": false,
                "project_lock_modified_on": "2024-08-29T14:14:26.216254-04:00",
                "project_lock_modified_by": {
                    "id": 1,
                    "email": "admin@example.com",
                    "first_name": "Admin",
                    "last_name": "Testerton"
                },
                "risk_policy": 1,
                "risk_policy_compliant": false,
                "slug": "proj1",
                "survey_dirty": false,
                "survey_complete": true,
                "tags": [],
                "updated": "2024-09-26T15:49:47.031899-04:00",
                "url": "http://example.com/bunits/bu1/app1/proj1/",
                "users": [
                    {
                        "id": 1,
                        "email": "admin@example.com",
                        "first_name": "Admin",
                        "last_name": "Testerton",
                        "is_active": true,
                        "role": "PR4",
                        "is_creator": true
                    }
                ],
                "external_id": "project-c3cc7ffa-e15e-4281-88ea-b323cb2dcd2c"
            }
        ],
        "errors": []
    }
}

Bulk Delete Projects

The bulk DELETE operation accepts a list of project ids to be deleted.

DELETE /api/v2/projects/bulk/

DELETE /api/v2/projects/bulk/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

[
    1,
    2,
    3,
    4
]
HTTP/1.1 200 OK
Content-Type: application/json

{
    "number_records_processed": 4,
    "number_records_failed": 0,
    "total": 4,
    "results": {
        "deleted_item_ids": [
            1,
            2,
            3,
            4
        ],
        "errors": []
    }
}

results matching ""

    No results matching ""