Skip to main content

zone_redirections

Creates, updates, deletes, gets or lists a zone_redirections resource.

Overview​

Namezone_redirections
TypeResource
Idovh.domain.zone_redirections

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idintegerId of the redirection
descriptionstringDescription for the invisible redirection
keywordsstringKeywords for the invisible redirection
sub_domainstringSubdomain to redirect (wire: subDomain)
targetstringTarget of the redirection
titlestringTitle for the invisible redirection
typestringRedirection type: - visible -> Redirection by http code 302 - visiblePermanent -> Redirection by http code 301 - invisible -> Redirection by html frame (invisible, visible, visiblePermanent)
zonestringRedirection zone

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, zone_nameReturns a redirection: subdomain, target, type and, for an invisible one, title, description and keywords.
listselectzone_namesub_domain, x_pagination_modeReturns the identifiers of the zone redirections. Can be filtered by subdomain.
createinsertzone_name, target, typeCreates a redirection of type visible (HTTP 302), visiblePermanent (HTTP 301) or invisible (HTML frame). The change applies after the zone is refreshed.
updateupdateid, zone_nameUpdates the target, type, title, description and keywords of a redirection.
deletedeleteid, zone_nameDeletes a redirection. The change applies after the zone is refreshed.

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.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
idintegerId
zone_namestringZone name (wire: zoneName)
sub_domainstringFilter the value of subDomain property (wire: subDomain)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Returns a redirection: subdomain, target, type and, for an invisible one, title, description and keywords.

SELECT
id,
description,
keywords,
sub_domain,
target,
title,
type,
zone
FROM ovh.domain.zone_redirections
WHERE id = '{{ id }}' -- required
AND zone_name = '{{ zone_name }}' -- required
;

INSERT examples​

Creates a redirection of type visible (HTTP 302), visiblePermanent (HTTP 301) or invisible (HTML frame). The change applies after the zone is refreshed.

INSERT INTO ovh.domain.zone_redirections (
description,
keywords,
sub_domain,
target,
title,
type,
zone_name
)
SELECT
'{{ description }}',
'{{ keywords }}',
'{{ sub_domain }}',
'{{ target }}' /* required */,
'{{ title }}',
'{{ type }}' /* required */,
'{{ zone_name }}'
RETURNING
id,
description,
keywords,
sub_domain,
target,
title,
type,
zone
;

UPDATE examples​

Updates the target, type, title, description and keywords of a redirection.

UPDATE ovh.domain.zone_redirections
SET
description = '{{ description }}',
keywords = '{{ keywords }}',
target = '{{ target }}',
title = '{{ title }}',
type = '{{ type }}'
WHERE
id = '{{ id }}' --required
AND zone_name = '{{ zone_name }}' --required;

DELETE examples​

Deletes a redirection. The change applies after the zone is refreshed.

DELETE FROM ovh.domain.zone_redirections
WHERE id = '{{ id }}' --required
AND zone_name = '{{ zone_name }}' --required
;