Pattern Variables
The /pattern_variables endpoint provides read-only access to pattern variables and their resolved values. Pattern variables are configurable parameters defined at the pattern level whose values can be overridden at different scopes: project, instance folder, or instance.
See Also
- Authentication — Required for all API requests
- Variables — Variable configuration in patterns
- Pattern Definition — Administering pattern definitions
- Patterns API — Pattern definitions
- Instance Folders API — Instance folder hierarchy
GET /api/v1/pattern_variables — Find Pattern Variables
Retrieve a list of pattern variables and their values at different scopes. The response includes the resolved value and the level at which it was defined.
Endpoint
GET https://app.metakraftwerk.com/api/v1/pattern_variablesQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | No | Filter by pattern name. |
pattern_id | integer | No | Filter by pattern ID. |
project | string | No | Scope to a project by name. |
project_id | integer | No | Scope to a project by ID. |
instance_folder | string | No | Scope to an instance folder by name. |
instance_folder_id | integer | No | Scope to an instance folder by ID. |
instance | string | No | Scope to an instance by name. |
instance_id | integer | No | Scope to an instance by ID. |
name | string | No | Filter by variable name. |
value | string | No | Filter by variable value. |
Value Resolution Cascade
Pattern variable values are resolved using a cascading hierarchy. The most specific scope wins:
| Priority | Level | Description |
|---|---|---|
| 1 (highest) | instance | Value defined for a specific instance. |
| 2 | instance_folder | Value defined at a folder level (traverses up the folder tree). |
| 3 | project | Value defined at the project level. |
| 4 (lowest) | default | Default value from the pattern variable definition. |
Response Schema
Returns an array of pattern variable objects:
| Field | Type | Description |
|---|---|---|
pattern_variable_id | integer | Pattern variable definition ID. |
pattern_id | integer | Associated pattern ID. |
name | string | Variable name. |
value | string | Resolved variable value. |
level | string | Scope level at which the value was defined: default, project, instance_folder, or instance. |
project_id | integer | Project ID (if scoped to a project). |
instance_folder_id | integer | Instance folder ID (if scoped to a folder). |
instance_folder | string | Computed folder path (if scoped to a folder). |
instance_id | integer | Instance ID (if scoped to an instance). |
Examples
cURL
bash
# Find by pattern name (returns default values)
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Scoped to a project (returns project-level overrides and defaults)
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&project=DEMO_PROJECT" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Scoped to an instance folder
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&instance_folder=RAW_VAULT" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Scoped to an instance
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&instance=AIRLINE" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Filter by variable name
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?name=CORE_SCHEMA" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Filter by value
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern_id=808&value=CORE" \
-H "Authorization: Bearer $ACCESS_TOKEN"JavaScript (Fetch)
javascript
const response = await fetch(
'https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&project=DEMO_PROJECT',
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
const variables = await response.json();Response Example
json
[
{
"pattern_variable_id": 222,
"pattern_id": 808,
"name": "CORE_SCHEMA",
"value": "CORE",
"level": "default",
"project_id": null,
"instance_folder_id": null,
"instance_folder": null,
"instance_id": null
}
]Error Responses
| Status | Condition | Example Message |
|---|---|---|
401 | Missing or invalid token | Not authenticated |
404 | Pattern not found | A pattern with the name 'X' does not exist! |
GET /api/v1/pattern_variables/:id — Get Pattern Variable
Retrieve a single pattern variable definition by its ID.
Endpoint
GET https://app.metakraftwerk.com/api/v1/pattern_variables/:idPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | The pattern variable ID. |
Examples
cURL
bash
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables/222" \
-H "Authorization: Bearer $ACCESS_TOKEN"JavaScript (Fetch)
javascript
const response = await fetch(
'https://app.metakraftwerk.com/api/v1/pattern_variables/222',
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
const variable = await response.json();Error Responses
| Status | Condition | Example Message |
|---|---|---|
401 | Missing or invalid token | Not authenticated |
404 | Pattern variable not found | No record found for id 'X' |
POST /api/v1/pattern_variables — Create
Not implemented
PUT /api/v1/pattern_variables — Update
Not implemented
PATCH /api/v1/pattern_variables/:id — Patch
Not implemented
DELETE /api/v1/pattern_variables/:id — Remove
Not implemented