minute to read


REQUEST HALAMAN TERTENTU

Dapatkan halaman tertentu dengan kunci halaman.

Semua permintaan ke API memerlukan API Token. Anda dapat menemukan token di pengaturan plugin API.

Admin panel > Plugins > API > API Token

HTTP Request

GET /api/pages/{page key}

Parameters

key value Default value
required token string API Token

Response

HTTP Code: 200
Content-Type: application/json
Body:
{
    "status": "0",
    "message": "Page filtered by key: my-dog",
    "data": {
        "key": "my-dog",
        "title": "My dog",
        "content": "...",
        "contentRaw": "...",
        "description": "...",
        "type": "published",
        "slug": "my-dog",
        "date": "2019-02-02 00:09:38",
        "dateUTC": "2019-02-02 22:09:38",
        "tags": "",
        "permalink": "https://www.example.com/my-dog",
        "coverImage": false,
        "coverImageFilename": false
    }
}

CURL command example

Anda dapat meminta halaman tertentu dengan kunci halaman.

Contoh berikut menunjukkan cara mendapatkan halaman dengan kunci my-dog.

$ curl -X GET "https://www.example.com/api/pages/my-dog?token=80a09ba055b73f68e3c9e7c9ea12b432"

Response Body

{
    "status": "0",
    "message": "Page filtered by key: my-dog",
    "data": {
        "key": "my-dog",
        "title": "My dog",
        "content": "...",
        "contentRaw": "...",
        "description": "...",
        "type": "published",
        "slug": "my-dog",
        "date": "2019-02-02 00:09:38",
        "dateUTC": "2019-02-02 22:09:38",
        "tags": "",
        "permalink": "https://www.example.com/my-dog",
        "coverImage": false,
        "coverImageFilename": false
    }
}

Javascript example

Anda dapat menggunakan Fetch API untuk mendapatkan halaman.

<script>
    fetch("https://www.example.com/api/pages/my-dog?token=eaf5df0a626145cc6d37b76f3eccc826", {
        method: 'get'
    }).then(function(response) {
        return response.json();
    }).then(function(json) {
        console.log(json.data);
    });
</script>