Sites

Manage your sites via the API

List all sites

GET /sites

curl -X GET https://app.1pilot.io/api/v1/sites \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $TOKEN"
Headers
Authorization Authentication Token
value: Bearer $TOKEN
Accept application/json

Responses

HTTP 200 Your sites list.

{ 
    "data": [ 
        { 
            "id": 1, 
            "name": "Example.com", 
            "url": "http://example.com", 
            "admin_url": "http://example.com/backend", 
            "notes": "Demo site", 
            "status": "Ok", 
            "published": 1, 
            "tags": [ 
                { 
                    "id": 1, 
                    "name": "Test", 
                    "created_at": "2018-01-31T10:27:39+00:00", 
                    "updated_at": "2018-01-31T10:27:39+00:00" 
                }, 
                { 
                    "id": 5, 
                    "name": "Tag", 
                    "created_at": "2018-02-01T13:46:53+00:00", 
                    "updated_at": "2018-02-14T15:10:59+00:00" 
                } 
            ], 
            "server": { 
                "ip": "1.1.1.1", 
                "web": "nginx/1.13.7", 
                "php": "7.0.26-1~dotdeb+8.1", 
                "mysql": "10.0.33-MariaDB-1~jessie" 
            }, 
            "updates_count": 4,
            "created_at": "2018-01-31T08:12:42+00:00", 
            "updated_at": "2018-06-15T09:01:04+00:00", 
            "last_check_at": "2018-06-15T09:01:03+00:00" 
        }, 
        { 
            "id": 2, 
            "name": "Second test site", 
            "url": "http://dev.example.com/", 
            "admin_url": "http://dev.example.com/backend", 
            "notes": "", 
            "status": "Ok", 
            "published": 1, 
            "tags": [], 
            "server": { 
                "ip": "8.8.8.8", 
                "web": "nginx/1.13.7", 
                "php": "7.1.12-1+0~20171129100550.11+stretch~1.gbp8ded15", 
                "mysql": "10.0.33-MariaDB-1~jessie" 
            }, 
            "updates_count": 2,
            "created_at": "2018-01-31T08:13:29+00:00", 
            "updated_at": "2018-06-15T08:50:05+00:00", 
            "last_check_at": "2018-06-15T08:50:04+00:00" 
        },
        [...]
    ], 
    "links": { 
        "first": "https://app.1pilot.io/api/v1/sites?page=1", 
        "last": "https://app.1pilot.io/api/v1/sites?page=2", 
        "prev": null, 
        "next": "https://app.1pilot.io/api/v1/sites?page=2" 
    }, 
    "meta": { 
        "current_page": 1, 
        "from": 1, 
        "last_page": 2, 
        "path": "https://app.1pilot.io/api/v1/sites", 
        "per_page": 15, 
        "to": 15, 
        "total": 18 
    }
}

Get one site

GET /sites/:id

curl -X GET https://app.1pilot.io/api/v1/sites/$ID \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $TOKEN"
Headers
Authorization Bearer $TOKEN
Accept application/json

Responses

HTTP 200 Your site details.

{ 
    "data": {
        "id": 1, 
        "name": "Example.com", 
        "url": "http://example.com", 
        "admin_url": "http://example.com/backend", 
        "notes": "Demo site", 
        "status": "Ok", 
        "published": 1, 
        "tags": [ 
            { 
                "id": 1, 
                "name": "Test", 
                "created_at": "2018-01-31T10:27:39+00:00", 
                "updated_at": "2018-01-31T10:27:39+00:00" 
            }, 
            { 
                "id": 5, 
                "name": "Tag", 
                "created_at": "2018-02-01T13:46:53+00:00", 
                "updated_at": "2018-02-14T15:10:59+00:00" 
            } 
        ], 
        "server": { 
            "ip": "8.8.8.8", 
            "web": "nginx/1.13.7", 
            "php": "7.0.26-1~dotdeb+8.1", 
            "mysql": "10.0.33-MariaDB-1~jessie" 
        }, 
        "updates_count": 2,
        "created_at": "2018-01-31T08:12:42+00:00", 
        "updated_at": "2018-06-15T09:01:04+00:00", 
        "last_check_at": "2018-06-15T09:01:03+00:00" 
    }
}

Create a site

POST /sites

curl -X POST https://app.1pilot.io/api/v1/sites \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    --data '{
        "name": "Test from API",
        "cms_id": 1,
        "url": "http://example.com/",
        "admin_url": "http://example.com/admin",
        "private_key": "123456",
        "notes": "my demo site",
        "tags": [ 1, 5 ],
        "monitor": {
            "look_for_string": "home"
        }
    }'
Headers
Authorization Bearer $TOKEN
Accept application/json
Content-Type application/json
Parameters Type
name string
cms_id integer
url string
admin_url string
private_key string
monitor[look_for_string] string See Uptime Monitoring documentation

Responses

HTTP 200 Your site details.

{ 
    "data": { 
        "id": 42,
        "name": "Test from API",
        "url": "http://example.com/",
        "admin_url": "http://example.com/admin",
        "notes": "my demo site",
        "status": "Ok",
        "published": null,
        "tags": [],
        "server": {
            "ip": null,
            "web": null,
            "php": null,
            "mysql": null
        },
        "created_at": "2018-06-18T08:49:36+00:00",
        "updated_at": "2018-06-18T08:49:36+00:00",
        "last_check_at": null
    }
}

Delete a site

DELETE /sites/:id

curl -X DELETE https://app.1pilot.io/api/v1/sites/$ID \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $TOKEN"
Headers
Authorization Bearer $TOKEN
Accept application/json

Responses

HTTP 200 empty response.