Creating a redirect
To create a redirect using the GraphQL API, you will need the following:
The example below creates a redirect.
mutation CreateWebsiteRedirect($input: CreateWebsiteRedirectMutationInput!) {
createWebsiteRedirect(input: $input) {
id
from
to
code
}
}{
"input": {
"siteId": "5d76bfaf665fc42e008b4569",
"payload": {
"from": "/old-url",
"to": "/new-url"
}
}
}X-Tenant-Key: my_tenant_key
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
{
"data": {
"createWebsiteRedirect": {
"id": "5bd8737fee1fdb00d6e83196",
"from": "/old-url",
"to": "/new-url",
"code": 301
}
}
}Last updated