redirects
Creates, updates, deletes, gets or lists a redirects resource.
Overview
| Name | redirects |
| Type | Resource |
| Id | vercel.bulk_redirects.redirects |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
case_sensitive | boolean | (false, true) (wire: caseSensitive) |
destination | string | |
permanent | boolean | (false, true) |
preserve_query_params | boolean | (false, true) (wire: preserveQueryParams) |
query | boolean | (false, true) |
sensitive | boolean | (false, true) |
source | string | |
status_code | number | (wire: statusCode) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | project_id | version_id, q, diff, page, per_page, sort_by, sort_order, team_id, slug | Get the version history for a project's bulk redirects |
update | update | project_id, redirect | team_id, slug | Edits a single redirect identified by its source path. Stages a new change with the modified redirect and returns the alias for the new version in the response. |
stage | replace | project_id, team_id | slug | Stages new redirects for a project and returns the new version. |
delete | delete | project_id | team_id, slug | Deletes the provided redirects from the latest version of the projects' bulk redirects. Stages a new change with the new redirects and returns the alias for the new version in the response. |
restore | exec | projectId, redirects | teamId, slug | Restores the provided redirects in the staging version to the value in the production version. If no production version exists, removes the redirects from staging. |
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 |
|---|---|---|
projectId | string | |
project_id | string | (wire: projectId) |
diff | | |
page | integer | |
per_page | integer | |
q | string | |
slug | string | The Team slug to perform the request on behalf of. |
sort_by | string | |
sort_order | string | |
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) |
version_id | string | (wire: versionId) |
SELECT examples
- list
Get the version history for a project's bulk redirects
SELECT
case_sensitive,
destination,
permanent,
preserve_query_params,
query,
sensitive,
source,
status_code
FROM vercel.bulk_redirects.redirects
WHERE project_id = '{{ project_id }}' -- required
AND version_id = '{{ version_id }}'
AND q = '{{ q }}'
AND diff = '{{ diff }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND sort_by = '{{ sort_by }}'
AND sort_order = '{{ sort_order }}'
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;
UPDATE examples
- update
Edits a single redirect identified by its source path. Stages a new change with the modified redirect and returns the alias for the new version in the response.
UPDATE vercel.bulk_redirects.redirects
SET
name = '{{ name }}',
redirect = '{{ redirect }}',
restore = {{ restore }}
WHERE
project_id = '{{ project_id }}' --required
AND redirect = '{{ redirect }}' --required
AND team_id = '{{ team_id}}'
AND slug = '{{ slug}}'
RETURNING
alias,
version;
REPLACE examples
- stage
Stages new redirects for a project and returns the new version.
REPLACE vercel.bulk_redirects.redirects
SET
project_id = '{{ project_id }}',
team_id = '{{ team_id }}',
overwrite = {{ overwrite }},
name = '{{ name }}',
redirects = '{{ redirects }}'
WHERE
project_id = '{{ project_id }}' --required
AND team_id = '{{ team_id }}' --required
AND slug = '{{ slug}}'
RETURNING
alias,
version;
DELETE examples
- delete
Deletes the provided redirects from the latest version of the projects' bulk redirects. Stages a new change with the new redirects and returns the alias for the new version in the response.
DELETE FROM vercel.bulk_redirects.redirects
WHERE project_id = '{{ project_id }}' --required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;
Lifecycle Methods
EXEC variables use wire (API) names.
- restore
Restores the provided redirects in the staging version to the value in the production version. If no production version exists, removes the redirects from staging.
EXEC vercel.bulk_redirects.redirects.restore
@projectId='{{ projectId }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"name": "{{ name }}",
"redirects": "{{ redirects }}"
}'
;