BaseCMS GraphQL API
Documentation Home
  • Getting Started
  • Connecting to the API
  • Modifying Data
    • Introduction
    • Creating a redirect
    • Creating content
    • Modifying content
    • Scheduling content
  • Querying Data
    • Introduction
    • Retrieving a Company
    • Retrieving multiple Companies
    • Retrieving published content
Powered by GitBook
On this page
  1. Modifying Data

Creating a redirect

PreviousIntroductionNextCreating content

Last updated 4 years ago

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
    }
  }
}

access token