Library Workflow Prompt Contexts
Library Workflow Prompt Contexts are supporting content attached to a Library Workflow Prompt. A prompt may have at most two contexts.
Contexts cannot be created, updated, or deleted on a built-in prompt.
Get All Library Workflow Prompt Contexts
This endpoint retrieves a list of Library Workflow Prompt Context resources for a specific Library Workflow Prompt.
GET /api/v2/library/workflow-prompts/{prompt_id}/contexts/
URL Parameters
| Parameter | Description |
|---|---|
| prompt_id | The id of the Library Workflow Prompt the Library Workflow Prompt Contexts to list belong to. |
Query Parameters
| Parameter | Description |
|---|---|
| search | Filter Library Workflow Prompt Contexts by performing a textual search on its id or label. |
| ordering | Sort Library Workflow Prompt Contexts by the specified field. Prefix field name with minus to sort descending. Sortable fields: id, label. |
GET /api/v2/library/workflow-prompts/WP1/contexts/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [
{
"id": "WPC1",
"db_id": 1,
"label": "Testing",
"content": "Use this skill when adding or modifying tests..."
},
{
"id": "WPC2",
"db_id": 2,
"label": "Code review standards",
"content": "Use this skill when reviewing existing code..."
}
]
}
Get a specific Library Workflow Prompt Context
This endpoint retrieves a single Library Workflow Prompt Context resource.
GET /api/v2/library/workflow-prompts/{prompt_id}/contexts/{context_id}/
URL Parameters
| Parameter | Description |
|---|---|
| prompt_id | The id of the Library Workflow Prompt the Library Workflow Prompt Context to retrieve belongs to. |
| context_id | The id of the Library Workflow Prompt Context to retrieve. |
GET /api/v2/library/workflow-prompts/WP1/contexts/WPC1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "WPC1",
"db_id": 1,
"label": "Testing",
"content": "Use this skill when adding or modifying tests..."
}
Create a Library Workflow Prompt Context
This endpoint creates a new Library Workflow Prompt Context resource on the specified Library Workflow Prompt. A prompt cannot have more than two contexts.
POST /api/v2/library/workflow-prompts/{prompt_id}/contexts/
URL Parameters
| Parameter | Description |
|---|---|
| prompt_id | The id of the Library Workflow Prompt the new Library Workflow Prompt Context will belong to. |
Payload
| Fields | Required | Description |
|---|---|---|
| label | Yes | The label of the Library Workflow Prompt Context. Maximum length: 255 characters. |
| content | Yes | The context content. Maximum size: 512 KB as UTF-8 encoded bytes. |
POST /api/v2/library/workflow-prompts/CWP1/contexts/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"label": "Database conventions",
"content": "Use this skill for schema, migration, and query changes..."
}
HTTP/1.1 201 CREATED
Content-Type: application/json
{
"id": "CWPC1",
"db_id": -1,
"label": "Database conventions",
"content": "Use this skill for schema, migration, and query changes..."
}
Update a Library Workflow Prompt Context
This endpoint updates a specific Library Workflow Prompt Context resource, as specified by the id parameter.
PATCH /api/v2/library/workflow-prompts/{prompt_id}/contexts/{context_id}/
URL Parameters
| Parameter | Description |
|---|---|
| prompt_id | The id of the Library Workflow Prompt the Library Workflow Prompt Context to update belongs to. |
| context_id | The id of the Library Workflow Prompt Context to update. |
Payload
| Fields | Required | Description |
|---|---|---|
| label | No | The label of the Library Workflow Prompt Context. Maximum length: 255 characters. |
| content | No | The context content. Maximum size: 512 KB as UTF-8 encoded bytes. |
PATCH /api/v2/library/workflow-prompts/CWP1/contexts/CWPC1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"label": "Frontend",
"content": "Use this skill for React/UI work..."
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "CWPC1",
"db_id": -1,
"label": "Frontend",
"content": "Use this skill for React/UI work..."
}
Delete a Library Workflow Prompt Context
This endpoint deletes a specific Library Workflow Prompt Context resource, as specified by the id parameter.
DELETE /api/v2/library/workflow-prompts/{prompt_id}/contexts/{context_id}/
URL Parameters
| Parameter | Description |
|---|---|
| prompt_id | The id of the Library Workflow Prompt the Library Workflow Prompt Context to delete belongs to. |
| context_id | The id of the Library Workflow Prompt Context to delete. |
DELETE /api/v2/library/workflow-prompts/CWP1/contexts/CWPC1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
{}