API 文档

这是可用 API 端点的文档,这些端点围绕 REST 架构构建。 所有 API 端点都将返回带有标准 HTTP 响应代码JSON 响应,并且需要通过 API 密钥进行的承载身份验证.

验证

所有 API 请求都需要由 Bearer Authentication 方法发送的 API 密钥

curl --request GET \
--url 'https://cnzztv.com/api/{endpoint}' \
--header 'Authorization: Bearer {api_key}' \

用户

GET https://cnzztv.com/api/user
curl --request GET \
--url 'https://cnzztv.com/api/user' \
--header 'Authorization: Bearer {api_key}' \
{
    "data": {
        "id":"1",
        "type":"users",
        "email":"example@example.com",
        "billing":{
            "type":"personal",
            "name":"John Doe",
            "address":"Lorem Ipsum",
            "city":"Dolor Sit",
            "county":"Amet",
            "zip":"5000",
            "country":"",
            "phone":"",
            "tax_id":""
        },
        "is_enabled":true,
        "plan_id":"custom",
        "plan_expiration_date":"2025-12-12 00:00:00",
        "plan_settings":{
            ...
        },
        "plan_trial_done":false,
        "language":"english",
        "timezone":"UTC",
        "country":null,
        "date":"2020-01-01 00:00:00",
        "last_activity":"2020-01-01 00:00:00",
        "total_logins":10
    }
}

网站统计

GET https://cnzztv.com/api/statistics/{website_id}
curl --request GET \
--url 'https://cnzztv.com/api/statistics/{website_id}?start_date=2020-01-01&end_date=2021-01-01' \
--header 'Authorization: Bearer {api_key}' \
参数 细节 描述
start_date 必需 开始日期Y-m-d格式 .
end_date 必需 结束日期 Y-m-d format.
type 可选 要返回的数据类型。 允许的值为:overviewpathsreferrersreferrer_pathscountries、< code>城市、operating_systemsdevice_typesbrowser_namesutms_sourceutms_medium_campaignscreen_resolutionsbrowser_languagesgoals。 默认为 overview.
country_code 可选 参数仅适用于 cities 类型.
utm_source 可选 参数仅适用于 utms_medium_campaign 类型.
{
    "data": [
        {
          "path": "/dashboard",
          "pageviews": 500,
          "bounces": 10
        },
        {
          "path": "/websites",
          "pageviews": 250,
          "bounces": 0
        },
        {
          "path": "/",
          "pageviews": 200,
          "bounces": 36
        },
        {
          "path": "/register",
          "pageviews": 100,
          "bounces": 25
        },
        {
          "path": "login",
          "pageviews": 50,
          "bounces": 10
        },
    ]
}

网站

GET https://cnzztv.com/api/websites/
curl --request GET \
--url 'https://cnzztv.com/api/websites/' \
--header 'Authorization: Bearer {api_key}' \
参数 细节 描述
page 可选 您希望从中得出结果的页码,默认为 1.
results_per_page 可选 每页需要多少结果, 允许的值为: 10 , 25 , 50 , 100 , 250. 默认为 25.
{
    "data": [
        {
            "id": 1,
            "pixel_key": "1234567890123456",
            "name": "Localhost",
            "scheme": "https://",
            "host": "example.com",
            "path": "/",
            "tracking_type": "normal",
            "excluded_ips": "",
            "events_children_is_enabled": false,
            "sessions_replays_is_enabled": false,
            "email_reports_is_enabled": false,
            "email_reports_last_date": "2020-06-23 19:01:22",
            "is_enabled": true,
            "date": "2019-11-01 12:00:30"
        },
    ],
    "meta": {
        "page": 1,
        "results_per_page": 25,
        "total": 1,
        "total_pages": 1
    },
    "links": {
        "first": "https://cnzztv.com/api/websites?&page=1",
        "last": "https://cnzztv.com/api/websites?&page=1",
        "next": null,
        "prev": null,
        "self": "https://cnzztv.com/api/websites?&page=1"
    }
}
GET https://cnzztv.com/api/websites/{website_id}
curl --request GET \
--url 'https://cnzztv.com/api/websites/{website_id}' \
--header 'Authorization: Bearer {api_key}' \
{
    "data": {
        "id": 1,
        "pixel_key": "1234567890123456",
        "name": "Localhost",
        "scheme": "https://",
        "host": "example.com",
        "path": "/",
        "tracking_type": "normal",
        "excluded_ips": "",
        "events_children_is_enabled": false,
        "sessions_replays_is_enabled": false,
        "email_reports_is_enabled": false,
        "email_reports_last_date": "2020-06-23 19:01:22",
        "is_enabled": true,
        "date": "2019-11-01 12:00:30"
    }
}
POST https://cnzztv.com/api/websites
参数 细节 描述
name 必需 -
scheme 可选 允许的值为:http://https://.
host 必需 网站主机和路径。 示例:https://example.com/path.
tracking_type 可选 允许的值为:lightweightnormal
excluded_ips 可选 从跟踪中排除 IP, 输入逗号分隔值.
events_children_is_enabled 可选 跟踪访问者事件(鼠标点击、调整大小、滚动、表单提交)。 允许的值为:01。 仅适用于 normal 跟踪类型.
sessions_replays_is_enabled 可选 会话重播, 允许的值为:01。 仅适用于 normal 跟踪类型.
email_reports_is_enabled 可选 电子邮件报告。 允许的值为:01.
curl --request POST \
--url 'https://cnzztv.com/api/websites' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'host=website.com' \
--form 'name=Example' \
{
    "data": {
        "id": 1
    }
}
POST https://cnzztv.com/api/websites/{website_id}
参数 细节 描述
name 可选 -
scheme 可选 允许的值为:http://https://.
host 可选 网站主机和路径。 示例:https://example.com/path.
excluded_ips 可选 从跟踪中排除 IP, 输入逗号分隔值.
events_children_is_enabled 可选 跟踪访问者事件(鼠标点击、调整大小、滚动、表单提交)。 允许的值为:01。 仅适用于 normal 跟踪类型.
sessions_replays_is_enabled 可选 会话重播, 允许的值为:01。 仅适用于 normal 跟踪类型.
email_reports_is_enabled 可选 电子邮件报告。 允许的值为:01.
is_enabled 可选 网站跟踪状态。 允许的值为:01.
curl --request POST \
--url 'https://cnzztv.com/api/websites/{website_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
{
    "data": {
        "id": 1
    }
}
DELETE https://cnzztv.com/api/websites/{website_id}
curl --request DELETE \
--url 'https://cnzztv.com/api/websites/{website_id}' \
--header 'Authorization: Bearer {api_key}' \

付款

GET https://cnzztv.com/api/payments/
curl --request GET \
--url 'https://cnzztv.com/api/payments/' \
--header 'Authorization: Bearer {api_key}' \
参数 细节 描述
page 可选 您希望从中得出结果的页码,默认为 1.
results_per_page 可选 每页需要多少结果, 允许的值为: 10 , 25 , 50 , 100 , 250. 默认为 25.
{
    "data": [
        {
            "id": 1,
            "plan_id": 1,
            "processor": "stripe",
            "type": "one_time",
            "frequency": "monthly",
            "email": "example@example.com",
            "name": null,
            "total_amount": "4.99",
            "currency": "USD",
            "status": true,
            "date": "2021-03-25 15:08:58"
        },
    ],
    "meta": {
        "page": 1,
        "results_per_page": 25,
        "total": 1,
        "total_pages": 1
    },
    "links": {
        "first": "https://cnzztv.com/api/payments?&page=1",
        "last": "https://cnzztv.com/api/payments?&page=1",
        "next": null,
        "prev": null,
        "self": "https://cnzztv.com/api/payments?&page=1"
    }
}
GET https://cnzztv.com/api/payments/{payment_id}
curl --request GET \
--url 'https://cnzztv.com/api/payments/{payment_id}' \
--header 'Authorization: Bearer {api_key}' \
{
    "data": {
        "id": 1,
        "plan_id": 1,
        "processor": "stripe",
        "type": "one_time",
        "frequency": "monthly",
        "email": "example@example.com",
        "name": null,
        "total_amount": "4.99",
        "currency": "USD",
        "status": true,
        "date": "2021-03-25 15:08:58"
    }
}

日志

GET https://cnzztv.com/api/logs/
curl --request GET \
--url 'https://cnzztv.com/api/logs/' \
--header 'Authorization: Bearer {api_key}' \
参数 细节 描述
page 可选 您希望从中得出结果的页码,默认为 1.
results_per_page 可选 每页需要多少结果, 允许的值为: 10 , 25 , 50 , 100 , 250. 默认为 25.
{
    "data": [
        {
            "type": "login.success",
            "ip": "127.0.0.1",
            "date": "2021-02-03 12:21:40"
        },
        {
            "type": "login.success",
            "ip": "127.0.0.1",
            "date": "2021-02-03 12:23:26"
        }
    ],
    "meta": {
        "page": 1,
        "results_per_page": 25,
        "total": 1,
        "total_pages": 1
    },
    "links": {
        "first": "https://cnzztv.com/api/payments?&page=1",
        "last": "https://cnzztv.com/api/payments?&page=1",
        "next": null,
        "prev": null,
        "self": "https://cnzztv.com/api/payments?&page=1"
    }
}