Test an address against the redirects
Answers which rule matches an address and where it sends the visitor. Send rules to test an unsaved table instead of the saved one. Nothing is saved.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
Test as this domain. It must be one of the site's own. Up to 253 characters.
An unsaved table to test instead of the saved one.
Fields of each item
Defaults to true.
The path to redirect, without a query string. For a regex rule, the pattern, at most 256 bytes. Up to 2,000 characters.
Limit the rule to some of the site's own domains. Null or left out on a new rule means every domain; left out on a saved rule keeps what it has.
A saved rule's id, to keep it. Leave it out, or send null, for a new rule. At least 1.
Whether the request's query string is carried over to the target. Send false when the target has a query string of its own. Defaults to true.
Up to 120 characters.
Defaults to 301.
301302A path or an https:// address. A regex rule may use $1 to $9. A target with a query string of its own is taken only with keep_query sent as false, and never on a prefix rule, where the rest of the path is added at its end. The limit is 2,000 bytes of the target as it is stored, not 2,000 characters as sent. The host is written in lower case and each character outside ASCII is percent-encoded, so é counts as six bytes (%C3%A9).
exactprefixregexA path starting with /, or a full http:// or https:// address. Up to 4,096 characters.
Returns
200 What the table answers for the address.
Fields of the 200 answer
Each redirect the address goes through.
Fields of each item
The id of a disabled rule that would have matched. Sent only when there is one.
Where the visitor is sent. Null when no rule matches.
The ids of the rules tried before the answer.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | deleted | The site, environment or copy has been deleted, or is being deleted. Nothing can be changed on it. Restore a deleted site first if it can still be restored. |
409 | provisioning | The site is still being created. Try again in a few minutes. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/redirects/test \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"url": "/services/web-design/ecommerce?ref=footer"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/redirects/test', [
'url' => '/services/web-design/ecommerce?ref=footer',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/redirects/test', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: '/services/web-design/ecommerce?ref=footer',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/corestack/sites/1042/redirects/test",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"url": "/services/web-design/ecommerce?ref=footer",
},
)
data = res.json() if res.content else None{
"chain": [
{
"from": "/services/web-design/ecommerce?ref=footer",
"status": 301,
"to": "/services/websites/ecommerce?ref=footer"
}
],
"code": 301,
"host": "www.harbourandfinch.example.com",
"matched_rule": {
"enabled": true,
"from": "/services/web-design",
"hosts": null,
"id": 46,
"keep_query": true,
"note": null,
"position": 6,
"shadowed_by": null,
"status": 301,
"to": "/services/websites",
"type": "prefix"
},
"path": "/services/web-design/ecommerce",
"query": "ref=footer",
"target": "/services/websites/ecommerce?ref=footer",
"tried_before": [
41,
44,
45
],
"type": "prefix",
"url": "https://www.harbourandfinch.example.com/services/web-design/ecommerce?ref=footer",
"warnings": []
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "deleted",
"message": "This site is deleted and waiting to be purged. Restore it first.",
"reason": "deleted"
}{
"code": "invalid",
"errors": {
"url": [
"Enter a path such as /old-page, or a full address on this site"
]
},
"field": "url",
"message": "Enter a path such as /old-page, or a full address on this site",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}