Library Profiles

Get All Profiles

This endpoint retrieves a list of Profiles resources.

Query Parameters

Parameter Description
active__in Returns a list of profile resources which are either activated or deactivated
ordering Returns a list of profile resources ordered by the specified field. This endpoint supports ordering by id, name, and description.
type__in Returns a list of profile resources which are either builtin or custom profiles
GET /api/v2/profiles/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [
        {
            "id": "P1",
            "db_id": 2,
            "name": "Blank",
            "description": "An empty profile. Get started with an unanswered project survey or select this if no other profile matches your application.",
            "type": "Built-in",
            "active": true,
            "answers": ["A740"],
            "logo_url": "/static/images/logo-other.png",
            "db_id": 1,
            "created_by": {
                "id": 1,
                "email": "no-reply+content_admin@localhost",
                "first_name": "SD Elements",
                "last_name": "admin"
            },
            "created_date":"2024-03-19T14:16:31.964223-04:00",
            "last_updated_date": "2024-03-19T14:16:31.964223-04:00",
            "last_updated_by": {
                "id": 1,
                "email": "no-reply+content_admin@localhost",
                "first_name": "SD Elements",
                "last_name": "admin"
            }
        }
    ]
}

Expand Parameters

See the Expand Parameters section for more details.

Parameter Description
answers answers is expanded

GET /api/v2/profiles/?expand=answers
Accept: application/json
Authorization: Token: "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [
        {
            "id": "P1",
            "name": "Blank",
            "description": "An empty profile. Get started with an unanswered project survey or select this if no other profile matches your application.",
            "type": "Built-in",
            "default": true,
            "active": true,
            "answers": [
                {
                    "id": "A740",
                    "text": "This is a new project",
                    "description": "",
                    "display_text": "Internal Properties (Use this, for all hidden answers) - This is a new project",
                    "is_active": true
                }
            ],
            "logo_url": "/static/images/logo-other.png",
            "db_id": 1,
            "created_by": {
                "id": 1,
                "email": "no-reply+content_admin@localhost",
                "first_name": "SD Elements",
                "last_name": "admin"
            },
            "created_date":"2024-03-19T14:16:31.964223-04:00",
            "last_updated_date": "2024-03-19T14:16:31.964223-04:00",
            "last_updated_by": {
                "id": 1,
                "email": "no-reply+content_admin@localhost",
                "first_name": "SD Elements",
                "last_name": "admin"
            }
        }
    ]
}

Create a Profile

This endpoint creates a new Profile resource.

POST /api/v2/profiles/

Fields Required Description
name Yes The name of the profile. Note: This name cannot match existing profile names
description Yes The description of the profile.
answers No An string array that represents the survey answers that will automatically be selected when somebody creates a project with this profile.
POST /api/v2/profiles/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

{
    "name": "New Profile",
    "description": "Description",
    "answers": [
        "A740",
        "A713"
    ]
}
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "CP1",
    "name": "New Profile",
    "description": "Description",
    "type": "Custom",
    "active": true,
    "answers": [
        "A740",
        "A713"
    ],
    "logo_url": "/static/images/logo-other.png",
    "db_id": 1,
    "created_by": 
    {
        "id": 1,
        "email": "admin@example.com",
        "first_name": "Admin",
        "last_name": "Example"
    },
    "created_date": "2024-03-19T14:16:31.964223-04:00",
    "last_updated_date": "2024-03-19T14:16:31.964223-04:00",
    "last_updated_by": {
        "id": 1,
        "email": "admin@example.com",
        "first_name": "Admin",
        "last_name": "Example"
    }          
}

Update a Profile

PATCH /api/v2/profiles/{profile_id}/

URL Parameters

Parameter Description
profile_id The id of the Profile to update

Payload

Fields Required Description
name No The name of the Profile. Note: This field can be updated on custom profiles, but cannot be updated on built-in profiles.
description No Profile description. Note: This field can be updated on custom profiles, but cannot be updated on built-in profiles.
answers No An string array that represents the survey answers that will automatically be selected when somebody creates a project with this profile. Note: This field can be updated on custom profiles, but cannot be updated on built-in profiles or the Default profile.
active No Builtin profiles can be activated or deactivated.
default No Builtin or Custom profiles can be set to default. Default profiles can neither be deleted or deactivated.
PATCH /api/v2/profiles/CP1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

{
    "name": "Updated profile name",
    "description": "Updated profile description",
    "answers": [
        "A740",
        "A713"
    ],
    "default": true,
    "active": true
}
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "CP1",
    "name": "Updated profile name",
    "description": "Updated profile description",
    "type": "Custom",
    "active": true,
    "answers": [
        "A740",
        "A713"
    ],
    "logo_url": "/static/images/logo-other.png",
    "db_id": -1,
    "default": true,
    "created_by": 
    {
        "id": 1,
        "email": "admin@example.com",
        "first_name": "Admin",
        "last_name": "Example"
    },
    "created_date": "2024-03-19T14:16:31.964223-04:00",
    "last_updated_date": "2024-04-19T14:16:31.964223-04:00",
    "last_updated_by": {
        "id": 1,
        "email": "admin@example.com",
        "first_name": "Admin",
        "last_name": "Example"
    }
}

Delete a Profile

This endpoint deletes a specific Profile resource, as specified by the id parameter. Only custom profiles can be deleted.

DELETE /api/v2/profiles/{profile_id}/

URL Parameters

Parameter Description
profile_id The id of the profile to delete
DELETE /api/v2/profiles/CP1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 204 NO CONTENT
Content-Type: application/json

{}

results matching ""

    No results matching ""