versions
Creates, updates, deletes, gets or lists a versions resource.
Overview
| Name | versions |
| Type | Resource |
| Id | vercel.project_routes.versions |
Fields
The following fields are returned by SELECT queries:
- list
A version of routing rules stored in S3.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the version. |
alias | string | The staging alias for previewing this version. |
created_by | string | The user who created this version. (wire: createdBy) |
is_live | boolean | Whether this version is currently live in production. (false, true) (wire: isLive) |
is_staging | boolean | Whether this version is staged and not yet promoted to production. (false, true) (wire: isStaging) |
last_modified | number | Timestamp of when this version was last modified. (wire: lastModified) |
rule_count | number | The number of routing rules in this version. (wire: ruleCount) |
s_3_key | string | The S3 key where the routing rules are stored. (wire: s3Key) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | project_id | team_id, slug | Get the version history for a project's routing rules. Returns the staging version (if one exists) followed by production versions, most recent first. The staging version has isStaging: true and the current production version has isLive: true. |
update | exec | project_id, id, action | teamId, slug | Promote staged routing rules to production, restore a previous production version, or discard staged changes. - promote: Publishes the staging version to production. - restore: Rolls back to a previous production version. - discard: Removes the staging version without publishing. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
project_id | string | |
slug | string | The Team slug to perform the request on behalf of. |
teamId | string | The Team identifier to perform the request on behalf of. |
team_id | string | The Team identifier to perform the request on behalf of. (wire: teamId) |
SELECT examples
- list
Get the version history for a project's routing rules. Returns the staging version (if one exists) followed by production versions, most recent first. The staging version has isStaging: true and the current production version has isLive: true.
SELECT
id,
alias,
created_by,
is_live,
is_staging,
last_modified,
rule_count,
s_3_key
FROM vercel.project_routes.versions
WHERE project_id = '{{ project_id }}' -- required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;
Lifecycle Methods
EXEC variables use wire (API) names.
- update
Promote staged routing rules to production, restore a previous production version, or discard staged changes. - promote: Publishes the staging version to production. - restore: Rolls back to a previous production version. - discard: Removes the staging version without publishing.
EXEC vercel.project_routes.versions.update
@project_id='{{ project_id }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"id": "{{ id }}",
"action": "{{ action }}"
}'
;