Project Survey History

Get a Project Survey's History

This endpoint retrieves a list of all logged updates to the Project Survey associated with the project with id "project_id".

GET /api/v2/projects/{project_id}/survey/history/

GET /api/v2/projects/1/survey/history/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [{
        "project": 1,
        "answer": "A1",
        "actor": 5,
        "draft": true,
        "transition": "select",
        "reason": "manual",
        "timestamp": "2020-04-08T12:38:08.115521-04:00",
        "scan": null
    }]
}

Query Parameters

The following parameters may be used to filter the project survey history log entries in the response:

Parameter Description
answer Returns history for specified answer. Supports multiple answers.
latest Returns only the most recent update for each answer.
draft If true, returns history for updates to project survey drafts only. If false, returns history for updates to project surveys only.
visible_only If true, excludes answers that are not visible in the project survey.

Expand Parameters

See the Expand Parameters section for more details.

Parameter Description
actor Actor field is expanded into id, first name, last name, email, role, active status, super user status, last login, date joined, and groups sub-fields.
answer Answer field is expanded into url, section_slug, section_id, question_id, subquestion_id, section_title, , subsection_text, question_text, subquestion_text, id, is_active and text.
scan Scan field is expanded into id, user, result, status, message, updated, project, repo, job_id, is_non_native

GET /api/v2/projects/1/survey/history/?include=tags&expand=actor,scan HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [{
        "project": 1,
        "answer": {
            "id": "A735",
            "text": "Changes to session management",
            "is_active": true,
            "section_title": "Changes Since Last Release",
            "subsection_text": "General Changes",
            "question_text": "Changes Since Last Release",
            "subquestion_text": null,
            "section_slug": "scope",
            "subsection_id": "Q219",
            "question_id": "Q220",
            "subquestion_id": null,
            "url": "http://localhost:3000/bunits/bu/app/proj/tasks/survey/questions/scope/Q219/"
        },
        "actor": {
            "id": 5,
            "email": "hamish.stout@example.com",
            "first_name": "Hamish",
            "last_name": "Stout",
            "last_login": "2020-04-14T09:11:18.482369-04:00",
            "date_joined": "2011-05-25T11:37:55-04:00",
            "is_active": true,
            "is_superuser": false,
            "role": {
                "id": "UR1",
                "name": "User"
            },
            "groups": []
        },
        "draft": true,
        "transition": "select",
        "reason": "manual",
        "timestamp": "2020-04-08T12:38:08.115521-04:00",
        "scan": {
            "id": 12,
            "result": {
                "A707": [
                    "12/depocs/__init__.py",
                    "12/tests/__init__.py"
                ]
            },
            "status": "IMPORTED",
            "message": null,
            "updated": "2024-08-12T13:35:47.188272-04:00",
            "project": 6,
            "repo": {
                "repo_id": 8,
                "project_id": 6,
                "repo_url": "https://github.com/repo_owner/repo_name.git",
                "repo_full_name": "repo_owner/repo_name",
                "integration_key": 3,
                "repo_branch": "main",
                "created": "2024-11-07T09:12:26.522863-05:00"
            },
            "job_id": "b8090af9-81a1-448f-8c2f-db52a6551ef3",
            "user": {
                "id": 1,
                "email": "user@example.com",
                "first_name": "Bob",
                "last_name": "Smith"
            },
            "is_non_native": false,
            "result_filtered_by_answer": []
        }
    }]
}

Include Parameters

See the Include Parameters section for more details.

Parameter Description
carried_over_history Includes carried over history log entries from ancestor projects

GET /api/v2/projects/1/survey/history/?include=carried_over_history HTTP/1.1
Accept: application/json
Authorization: Token: "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [
        {
            "project": 1,
            "answer": "A1",
            "actor": 5,
            "draft": true,
            "transition": "select",
            "reason": "manual",
            "timestamp": "2020-04-08T12:38:08.115521-04:00",
            "scan": null
        },
        {
            "project": 1,
            "answer": "A1",
            "actor": 5,
            "draft": false,
            "transition": "deselect",
            "reason": "survey-save",
            "timestamp": "2020-02-20T12:38:08.115521-04:00",
            "scan": null
        },
        {
            "project": 1,
            "answer": "A1",
            "actor": 5,
            "draft": true,
            "transition": "deselect",
            "reason": "profile-select",
            "timestamp": "2020-02-20T12:38:08.115521-04:00",
            "scan": null
        }
    ]
}

results matching ""

    No results matching ""