Routing API

Endpoints

Search Records

GET /core/v1/routing/records?limit=50[&offset=20[&__json__=<See JSON below>]]
{
  "filters": [
    <record filter>,
    <record filter>,
    ...
  ]
}

200 OK

{
  "records": [
    {
      "path": "path/to/external/redirect",
      "resource": {
        "external-redirect": {
          "href": "https://www.example.org/",
          "code": 302
        }
      }
    },
    {
      "path": "static-pages/some-layout-page",
      "resource": {
        "layout-page": {
          "id": "66ac95356999be9ddafa45cc"
        }
      }
    },
    {
      "path": "path/to/any/other/resource",
      "resource": <resource>
    },
    ...
  ],
  "records_count": 345
}

Hints:

Search Redirects

GET /core/v1/routing/redirects/records?limit=50[&offset=20[&__json__=<See JSON below>]]
{
  "filters": [
    <record filter>,
    <record filter>,
    ...
  ]
}

200 OK

{
  "records": [
    {
      "path": "path/to/internal/redirect",
      "resource": {
        "internal-redirect": {
          "path": "path/to/any/other/resource",
          "code": 301
        }
      }
    },
    {
      "path": "path/to/external/redirect",
      "resource": {
        "override": {
          "delegate": {
            "external-redirect": {
              "href": "https://www.example.org/",
              "code": 302
            }
          },
          "original": <resource>
        }
      }
    },
    ...
  ],
  "records_count": 234
}

Hints:

Remove Records

PUT /core/v1/routing/records?__json__=<See JSON below>
{
  "filters": [
    <record filter>,
    <record filter>,
    ...
  ],
  "commands": [
    {"remove": {}}
  ]
}

200 OK

{
  "records_count": 345
}

Hints:

Remove Redirects

GET /core/v1/routing/redirects/records?__json__=<See JSON below>
{
  "filters": [
    <record filter>,
    <record filter>,
    ...
  ],
  "commands": [
    {"remove": {}}
  ]
}

200 OK

{
  "records_count": 234
}

Hints:

Create Redirect

POST /core/v1/routing/redirects/records
{
  "path": "path/to/new/redirect",
  "resource": {
    "internal-redirect": {
      "path": "path/to/any/other/resource",
      "code": 305
    }
  }
}

200 OK

{
  "record": {
    "path": "path/to/new/redirect",
    "resource": {
      "internal-redirect": {
        "path": "path/to/any/other/resource",
        "code": 305
      }
    }
  }
}

Export Redirects (async/await)

Async

POST /core/v1/routing/records/export?__json__=<See JSON below>
{
  "filters": [
    <record filter>,
    <record filter>,
    ...
  ],
  "format": {
    "csv": {
      "fields": []
    }
  },
  "filename": "redirects-export"  // optional
}

200 OK

{
  "task": {
    "id": "38e9eea7-fc5b-4373-90f0-cb2d59109113",
    "is_ready": false,
    "progress": null,
    "response": null,
    "exception": null
}

Await

GET /core/v1/routing/records/export?task_id=38e9eea7-fc5b-4373-90f0-cb2d59109113

200 OK

{
  "task": {
    "id": "38e9eea7-fc5b-4373-90f0-cb2d59109113",
    "is_ready": true,
    "progress": null,
    "response": {
      "download_href": "https://s3.amazonaws.com/site-assets.rbl.ms/sites/17243519/exports/routing/redirects-export.csv"
    },
    "exception": null
}

Hints:

Resources

External Redirect

Represents an external redirect.

{
  "external-redirect": {
    "href": "https://www.example.org/",
    "code": 302
  }
}

Internal Redirect

Represents an internal redirect.

{
  "internal-redirect": {
    "path": "path/to/any/other/resource",
    "code": 301
  }
}

Layout Page

Represents a custom static page (see: Pages API).

{
  "layout-page": {
    "id": "66ac95356999be9ddafa45cc"
  }
}

Override

Represents any resource that is overridden by another resource. For example, a so-called “link-out” – an article page that is overridden by an external redirect.

{
  "override": {
    "delegate": {
      "external-redirect": {
        "href": "https://www.example.org/",
        "code": 302
      }
    },
    "original": <resource>
  }
}

Record Filters

  • {“path”: {“prefix”: “path/to”}} – filter by path prefix - TODO: Consider {“syntax”: {“prefix”: {}}, “phrase”: “path/to”}, see: Phrase Filter Syntaxes

  • {“paths”: [“path/to/record-1”, “path/to/record-2”]} – filter by exact paths

  • {“resource-types”: [“<resource type>”, “<resource type>”]} – filter by resource types

Hints: