REST API reference

1. Xác thực

BizflyCloud CDN API sử dụng các header X-Auth-TokenX-Tenant-Name để xác thực API

2. Lấy danh sách domains

GET https://api.cdn.bizflycloud.vn/v3/clients/domains
Ví dụ

Request

curl -H 'X-Tenant-Name: huyleviet@vccloud.vn' \
-H 'X-Auth-Token: gAAAAABgFicAtTVZ4-2QVUxuowaKLDD7CGBe5fMsG5ISN5r7cvLhQAfB7Z9RaGbGgRvcGfY5qzxPr_aSRtbg2P9t7obroeuhXOOkuGSxpdfbVOYejOITp7A_xk2RJmZO5Js-yZAJmk5cnVUCc1FfP-LRRK6FyVLHx4shiogldyY95pUxWvV8z-jIQBw0_iqZ2GsI' \
https://api.cdn.bizflycloud.vn/v3/clients/domains

Response

{
    "total": 5,
    "pages": 1,
    "next": "/clients/domains?page=1&limit=50",
    "prev": "/clients/domains?page=1&limit=50",
    "results": [
        {
            "created_at": "2020-09-30T09:54:49+00:00",
            "domain": "hieupn.ss-hn-1.vccloud.vn",
            "slug": "hieupn-ss-hn-1-vccloud",
            "domain_id": "ba24a119-e6ee-4666-9490-079aace3be09"
        },
        {
            "created_at": "2020-11-18T02:28:40+00:00",
            "domain": "demo.huylvt.com",
            "slug": "demo-huylvt",
            "domain_id": "c3c693e7-04ac-4003-aeca-b4c4ce9af54e"
        },
        {
            "created_at": "2020-11-28T02:57:37+00:00",
            "domain": "ps.huylvt.com",
            "slug": "ps",
            "domain_id": "b7f99fae-4c02-494e-bc09-1b64a8d89697"
        },
        {
            "created_at": "2021-03-02T04:10:45+00:00",
            "domain": "testing.cn",
            "slug": "testing",
            "domain_id": "eb0724b6-bd40-493f-b7ce-942eb4a99d07"
        },
        {
            "created_at": "2021-03-02T04:30:02+00:00",
            "domain": "pham.net",
            "slug": "pham",
            "domain_id": "2ffd7b39-160d-47b0-af02-c97d035f1d60"
        }
    ]
}

3. Lấy thông tin của một domain

GET https://api.cdn.bizflycloud.vn/v3/clients/domains/{domain_id}
URI Parameters
Name In Required Type Description
domain_id Path True string Id của domain
Ví dụ

Request

curl -H 'X-Tenant-Name: huyleviet@vccloud.vn' \
-H 'X-Auth-Token: gAAAAABgFicAtTVZ4-2QVUxuowaKLDD7CGBe5fMsG5ISN5r7cvLhQAfB7Z9RaGbGgRvcGfY5qzxPr_aSRtbg2P9t7obroeuhXOOkuGSxpdfbVOYejOITp7A_xk2RJmZO5Js-yZAJmk5cnVUCc1FfP-LRRK6FyVLHx4shiogldyY95pUxWvV8z-jIQBw0_iqZ2GsI' \
https://api.cdn.bizflycloud.vn/v3/clients/domains/ba24a119-e6ee-4666-9490-079aace3be09

Response

{
    "results": {
        "created_at": "2020-09-30T09:54:49+00:00",
        "domain": "hieupn.ss-hn-1.vccloud.vn",
        "slug": "hieupn-ss-hn-1-vccloud",
        "domain_id": "ba24a119-e6ee-4666-9490-079aace3be09"
    }
}

4. Xóa cache

POST https://api.cdn.bizflycloud.vn/v3/clients/domains/{domain_id}/purge
URI Parameters
Name In Required Type Description
domain_id Path True string Id của domain
Request Body
Name Required Type Description
files True List Danh sách các file cần xóa cache
expire False String Xóa cache (Giá trị luôn là 1)
commands False String Xóa cache toàn bộ domain (Giá trị luôn là flush_all)

Ví dụ

4.1 Xóa cache theo danh sách file

Request

curl -X POST -H 'X-Tenant-Name: huyleviet@vccloud.vn' \
-H 'X-Auth-Token: gAAAAABgFicAtTVZ4-2QVUxuowaKLDD7CGBe5fMsG5ISN5r7cvLhQAfB7Z9RaGbGgRvcGfY5qzxPr_aSRtbg2P9t7obroeuhXOOkuGSxpdfbVOYejOITp7A_xk2RJmZO5Js-yZAJmk5cnVUCc1FfP-LRRK6FyVLHx4shiogldyY95pUxWvV8z-jIQBw0_iqZ2GsI' \
-H 'Content-Type: application/json' \
--data '{"files":["/css/style.css","/images/avatar.png"]' \
https://api.cdn.bizflycloud.vn/v3/clients/domains/ba24a119-e6ee-4666-9490-079aace3be09/purge

Response

{
    "message": "Cache has been cleared."
}
4.2 Xóa cache toàn bộ domains

Request

curl -X POST -H 'X-Tenant-Name: huyleviet@vccloud.vn' \
-H 'X-Auth-Token: gAAAAABgFicAtTVZ4-2QVUxuowaKLDD7CGBe5fMsG5ISN5r7cvLhQAfB7Z9RaGbGgRvcGfY5qzxPr_aSRtbg2P9t7obroeuhXOOkuGSxpdfbVOYejOITp7A_xk2RJmZO5Js-yZAJmk5cnVUCc1FfP-LRRK6FyVLHx4shiogldyY95pUxWvV8z-jIQBw0_iqZ2GsI' \
-H 'Content-Type: application/json' \
--data '{"files":["*"]' \
https://api.cdn.bizflycloud.vn/v3/clients/domains/ba24a119-e6ee-4666-9490-079aace3be09/purge

Response

{
    "message": "Cache has been cleared."
}

5. Lấy thông tin metrics

GET https://api.cdn.bizflycloud.vn/v3/clients/domains/{domain_id}/metrics
URI Parameters
Name In Required Type Description
domain_id Path True string Id của domain
Request Body
Name In Required Type Description
from Path True string Ngày bắt đầu lấy metrics
to Path True string Ngày kết thúc lấy metrics

Request

curl --location --request GET 'https://api.cdn.bizflycloud.vn/v3/clients/domains/969c841f-8e64-4d4c-8f62-6ee9d50abad6/metrics?from=2024-01-01&to=2024-01-15' \
--header 'X-Auth-Token: gAAAAABlpe5REjBV-aIdtQ8BZ85Q6_VxdUaPTNYOliDlvsR1_aG-DQMqd9JG73_6sSXwOYmj7lCaD7M6RqgolVsoHKBwNg8LPfxL4rKmhw_bNedWQ-DTKC1qf36rCuo-kAIt0-uRmR6oYGUxXzbiJZxzs320NqV7r3cRq0ZEKOTlg-18fs2ijtk' \
--header 'X-Tenant-Name: huyleviet@vccloud.vn'

Response

{
   "total_usage": 1227848137,
   "results": [
       {
           "value": 588298,
           "created_at": "2024-01-01T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3332487
       },
       {
           "value": 312604,
           "created_at": "2024-01-02T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3333560
       },
       {
           "value": 9060700,
           "created_at": "2024-01-03T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3335062
       },
       {
           "value": 252858,
           "created_at": "2024-01-04T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3336319
       },
       {
           "value": 1625091,
           "created_at": "2024-01-05T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3337201
       },
       {
           "value": 879642,
           "created_at": "2024-01-06T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3338107
       },
       {
           "value": 2107050,
           "created_at": "2024-01-07T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3339566
       },
       {
           "value": 430761,
           "created_at": "2024-01-08T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3340792
       },
       {
           "value": 5596232,
           "created_at": "2024-01-09T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3341858
       },
       {
           "value": 419504,
           "created_at": "2024-01-10T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3342820
       },
       {
           "value": 10109695,
           "created_at": "2024-01-11T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3344422
       },
       {
           "value": 1175375556,
           "created_at": "2024-01-12T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3345421
       },
       {
           "value": 13972879,
           "created_at": "2024-01-13T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3347007
       },
       {
           "value": 5017056,
           "created_at": "2024-01-14T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3347846
       },
       {
           "value": 2100211,
           "created_at": "2024-01-15T00:00:00+00:00",
           "user": 7353,
           "domain": "www.huylvt.com",
           "id": 3348724
       }
   ],
   "pages": 1,
   "prev": "/clients/domains/969c841f-8e64-4d4c-8f62-6ee9d50abad6/metrics?limit=50&page=1",
   "total": 15,
   "next": "/clients/domains/969c841f-8e64-4d4c-8f62-6ee9d50abad6/metrics?limit=50&page=1"
}