Last updated 4 years ago
To create a redirect using the GraphQL API, you will need the following:
The site id. Sent as the input.siteId variable.
input.siteId
A valid . Include this as a Bearer authorization header.
Bearer
The old and new URLs. Sent as the input.payload variable.
input.payload
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 } } }