Redirects

List redirects

List redirects on a site.

GET /api/site/{id}/redirects

Example request :

curl "https://cloud.boxydev.com/api/site/1/redirects" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"

Example response :

{
    "data": [
        {
            "id": 1,
            "from": "/old",
            "to": "/new",
            "type": "permanent",
            "status": "installed",
            "created_at": "2022-09-16T20:39:23.000000Z"
        }
    ],
    "links": {
        "first": "https://cloud.boxydev.com/api/site/1/redirects?page=1",
        "last": "https://cloud.boxydev.com/api/site/1/redirects?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://cloud.boxydev.com/api/site/1/redirects",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}

Get redirect

Show a redirect.

GET /api/site-redirect/{id}

Example request :

curl "https://cloud.boxydev.com/api/site-redirect/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"

Example response :

{
    "id": 1,
    "from": "/old",
    "to": "/new",
    "type": "permanent",
    "status": "installed",
    "created_at": "2022-09-16T20:39:23.000000Z"
}

Create redirect

Create a redirect.

POST /api/site/{id}/redirect

Parameters :

Parameter Description
from The source URL.
to The target URL.
type The redirection type: permanent or redirect.

Example request :

curl "https://cloud.boxydev.com/api/site/1/redirect" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "from": "/old",
        "to": "/new",
        "type": "permanent"
    }'

Example response :

{
    "id": 1,
    "from": "/old",
    "to": "/new",
    "type": "permanent",
    "status": "installing",
    "created_at": "2022-09-16T22:08:19.000000Z"
}

Delete redirect

Delete a redirect.

DELETE /api/site-redirect/{id}

Example request :

curl -X DELETE "https://cloud.boxydev.com/api/site-redirect/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"