Get Website Redirects (WSM 4.5.7.0+ only)

Obtains redirects for a given website.

URL

/api/v1/website/[website_id]/redirects

HTTP Method

GET

URL Parameters

Parameter

Required

Type

Description

website_id

true

integer

Specifies the website ID to return redirects for.

Response Parameters

Response is an array of redirect_details objects. A redirect_details object contains the following:

Parameter Type Description
proto string

The scheme being redirected.

"http" → HTTP

"https" → HTTPS

It is an error to specify http for an https-only website, or https for an http-only website.

match_type string

The type of match to perform.

"prefix" → Literal prefix matching path

"regex" → Regular expression matching path

"vhost regex" → Regular expression matching virtual host

match string Content to match.
rd_exernally_to string Full URL to redirect to, including scheme.

Example: Get redirects for website 1

Request

GET

/api/v1/website/1/redirects

cURL

curl -kv \
-u api_ninja:ninja_password \
-X GET \
https://172.31.1.172:4849/api/v1/website/1/redirects

Response

[
{
"proto": "http",
"match_type": "prefix",
"match": "/prefix",
"rd_externally_to": "http://example.com/prefix/"
},
{
"proto": "https",
"match_type": "prefix",
"match": "/https-prefix",
"rd_externally_to": "http://example.com/prefix/"
},
{
"proto": "http",
"match_type": "regex",
"match": "\\d+",
"rd_externally_to": "http://example.com/number/"
}
]