开发人员

开发者API参考

系统处理请求需要 API 密钥。用户注册后,系统会自动为该用户生成 API 密钥。

入门指南

请求必须使用API密钥才能被系统处理。一旦用户注册,系统会自动为该用户生成API密钥。API密钥必须随每个请求发送(请参见下面的完整示例)。如果未发送API密钥或其已过期,将会出现错误。请务必保持您的API密钥的秘密以防止滥用。

身份验证

要使用API系统进行身份验证,您需要将您的API密钥作为授权令牌与每个请求一起发送。您可以在下面查看示例代码。

curl --location --request POST 'https://makily.com/api/account' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \ 

速率限制

我们的 API 设置了速率限制器,以防止请求激增并确保服务稳定。目前的限制为每 1 分钟最多 30 次请求。 请注意,速率可能会根据所订阅的计划而变化。

几个标头将与响应一起发送,可以检查这些标头以确定请求的各种信息。

X-RateLimit-Limit: 30X-RateLimit-Remaining: 29X-RateLimit-Reset: TIMESTAMP

响应处理

所有API响应默认以JSON格式返回。要将其转换为可用数据,必须根据语言使用适当的函数。在PHP中,可以使用函数json_decode()将数据转换为对象(默认)或数组(将第二个参数设置为true)。检查错误键非常重要,因为它提供了有关是否存在错误的信息。您还可以检查头部代码。

{
    "error": 1,
    "message": "An error occurred"
}

列出 CTA 覆盖层

GET https://makily.com/api/overlay?limit=2&page=1

可使用此端点通过 API 获取 CTA 覆盖层,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/overlay?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "cta": [
            {
                "id": 1,
                "type": "message",
                "name": "Product 1 Promo",
                "date": "2020-11-10 18:00:00"
            },
            {
                "id": 2,
                "type": "contact",
                "name": "Contact Page",
                "date": "2020-11-10 18:10:00"
            }
        ]
    }
}

列出二维码

GET https://makily.com/api/qr?limit=2&page=1

可使用此端点通过 API 获取您的二维码,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/qr?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "qrs": [
            {
                "id": 2,
                "link": "https:\/\/makily.com\/qr\/a2d5e",
                "scans": 0,
                "name": "Google",
                "date": "2020-11-10 18:01:43"
            },
            {
                "id": 1,
                "link": "https:\/\/makily.com\/qr\/b9edfe",
                "scans": 5,
                "name": "Google Canada",
                "date": "2020-11-10 18:00:25"
            }
        ]
    }
}

获取单个二维码

GET https://makily.com/api/qr/:id

可使用此端点通过 API 获取单个二维码的详细信息。

curl --location --request GET 'https://makily.com/api/qr/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "details": {
        "id": 1,
        "link": "https:\/\/makily.com\/qr\/b9edfe",
        "scans": 5,
        "name": "Google Canada",
        "date": "2020-11-10 18:00:25"
    },
    "data": {
        "clicks": 1,
        "uniqueClicks": 1,
        "topCountries": {
            "Unknown": "1"
        },
        "topReferrers": {
            "Direct, email and other": "1"
        },
        "topBrowsers": {
            "Chrome": "1"
        },
        "topOs": {
            "Windows 10": "1"
        },
        "socialCount": {
            "facebook": 0,
            "twitter": 0,
            "instagram": 0
        }
    }
}

创建二维码

POST https://makily.com/api/qr/add

要创建二维码,需要通过 POST 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
type (必填)text | vcard | link | email | phone | sms | wifi
data (必填)要嵌入二维码的数据。根据类型不同,数据可以是字符串或数组
background (可选)RGB 颜色,例如 rgb(255,255,255)
foreground (可选)RGB 颜色,例如 rgb(0,0,0)
logo (可选)PNG 或 JPG 格式的徽标路径
name (可选)二维码名称
curl --location --request POST 'https://makily.com/api/qr/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png",
    "name": "QR Code API"
}'

服务器响应

{
    "error": 0,
    "id": 3,
    "link": "https:\/\/makily.com\/qr\/a58f79"
}

更新二维码

PUT https://makily.com/api/qr/:id/update

要更新二维码,需要通过 PUT 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
data (必填)要嵌入二维码的数据。根据类型不同,数据可以是字符串或数组
background (可选)RGB 颜色,例如 rgb(255,255,255)
foreground (可选)RGB 颜色,例如 rgb(0,0,0)
logo (可选)PNG 或 JPG 格式的徽标路径
curl --location --request PUT 'https://makily.com/api/qr/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png"
}'

服务器响应

{
    "error": 0,
    "message": "QR has been updated successfully."
}

删除二维码

DELETE https://makily.com/api/qr/:id/delete

要删除二维码,需要发送 DELETE 请求。

curl --location --request DELETE 'https://makily.com/api/qr/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "QR Code has been deleted successfully."
}

列出像素

GET https://makily.com/api/pixels?limit=2&page=1

可使用此端点通过 API 获取您的像素代码,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/pixels?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "pixels": [
            {
                "id": 1,
                "type": "gtmpixel",
                "name": "GTM Pixel",
                "tag": "GA-123456789",
                "date": "2020-11-10 18:00:00"
            },
            {
                "id": 2,
                "type": "twitterpixel",
                "name": "Twitter Pixel",
                "tag": "1234567",
                "date": "2020-11-10 18:10:00"
            }
        ]
    }
}

创建像素

POST https://makily.com/api/pixel/add

可使用此端点创建像素。您需要发送像素类型和标签。

参数 描述
type (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok
name (必填)像素的自定义名称
tag (必填)像素标签
curl --location --request POST 'https://makily.com/api/pixel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "gtmpixel",
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}'

服务器响应

{
    "error": 0,
    "id": 1
}

更新像素

PUT https://makily.com/api/pixel/:id/update

要更新像素,需要通过 PUT 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
name (可选)像素的自定义名称
tag (必填)像素标签
curl --location --request PUT 'https://makily.com/api/pixel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}'

服务器响应

{
    "error": 0,
    "message": "Pixel has been updated successfully."
}

删除像素

DELETE https://makily.com/api/pixel/:id/delete

要删除像素,需要发送 DELETE 请求。

curl --location --request DELETE 'https://makily.com/api/pixel/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Pixel has been deleted successfully."
}

列出品牌域名

GET https://makily.com/api/domains?limit=2&page=1

可使用此端点通过 API 获取您的品牌域名,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/domains?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "domains": [
            {
                "id": 1,
                "domain": "https:\/\/domain1.com",
                "redirectroot": "https:\/\/rootdomain.com",
                "redirect404": "https:\/\/rootdomain.com\/404"
            },
            {
                "id": 2,
                "domain": "https:\/\/domain2.com",
                "redirectroot": "https:\/\/rootdomain2.com",
                "redirect404": "https:\/\/rootdomain2.com\/404"
            }
        ]
    }
}

创建品牌域名

POST https://makily.com/api/domain/add

可使用此端点添加域名。请确保该域名已正确指向我们的服务器。

参数 描述
domain (必填)品牌域名,需包含 http 或 https
redirectroot (可选)访问您的域名时使用的根目录重定向地址
redirect404 (可选)自定义 404 重定向地址
curl --location --request POST 'https://makily.com/api/domain/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "domain": "https:\/\/domain1.com",
    "redirectroot": "https:\/\/rootdomain.com",
    "redirect404": "https:\/\/rootdomain.com\/404"
}'

服务器响应

{
    "error": 0,
    "id": 1
}

更新域名

PUT https://makily.com/api/domain/:id/update

要更新品牌域名,需要通过 PUT 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
redirectroot (可选)访问您的域名时使用的根目录重定向地址
redirect404 (可选)自定义 404 重定向地址
curl --location --request PUT 'https://makily.com/api/domain/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "redirectroot": "https:\/\/rootdomain-new.com",
    "redirect404": "https:\/\/rootdomain-new.com\/404"
}'

服务器响应

{
    "error": 0,
    "message": "Domain has been updated successfully."
}

删除域名

DELETE https://makily.com/api/domain/:id/delete

要删除域名,需要发送 DELETE 请求。

curl --location --request DELETE 'https://makily.com/api/domain/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Domain has been deleted successfully."
}

列出活动

GET https://makily.com/api/campaigns?limit=2&page=1

可使用此端点通过 API 获取您的活动,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/campaigns?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "campaigns": [
            {
                "id": 1,
                "name": "Sample Campaign",
                "public": false,
                "rotator": false,
                "list": "https:\/\/domain.com\/u\/admin\/list-1"
            },
            {
                "id": 2,
                "domain": "Facebook Campaign",
                "public": true,
                "rotator": "https:\/\/domain.com\/r\/test",
                "list": "https:\/\/domain.com\/u\/admin\/test-2"
            }
        ]
    }
}

创建活动

POST https://makily.com/api/campaign/add

可使用此端点添加活动。

参数 描述
name (可选)活动名称
slug (可选)轮换器别名
public (可选)访问权限
curl --location --request POST 'https://makily.com/api/campaign/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "New Campaign",
    "slug": "new-campaign",
    "public": true
}'

服务器响应

{
    "error": 0,
    "id": 3,
    "domain": "New Campaign",
    "public": true,
    "rotator": "https:\/\/domain.com\/r\/new-campaign",
    "list": "https:\/\/domain.com\/u\/admin\/new-campaign-3"
}

将链接分配给活动

POST https://makily.com/api/campaign/:campaignid/assign/:linkid

可使用此端点将短链接分配给活动。该端点需要活动 ID 和短链接 ID。

curl --location --request POST 'https://makily.com/api/campaign/:campaignid/assign/:linkid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Link successfully added to the campaign."
}

更新活动

PUT https://makily.com/api/campaign/:id/update

要更新活动,需要通过 PUT 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
name (必填)活动名称
slug (可选)轮换器别名
public (可选)访问权限
curl --location --request PUT 'https://makily.com/api/campaign/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Twitter Campaign",
    "slug": "twitter-campaign",
    "public": true
}'

服务器响应

{
    "error": 0,
    "id": 3,
    "domain": "Twitter Campaign",
    "public": true,
    "rotator": "https:\/\/domain.com\/r\/twitter-campaign",
    "list": "https:\/\/domain.com\/u\/admin\/twitter-campaign-3"
}

删除活动

DELETE https://makily.com/api/campaign/:id/delete

要删除活动,需要发送 DELETE 请求。

curl --location --request DELETE 'https://makily.com/api/campaign/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Campaign has been deleted successfully."
}

列出自定义闪屏页

GET https://makily.com/api/splash?limit=2&page=1

To get Splash Pages via the API, you can use this endpoint. You can also filter data (See table for more info).

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/splash?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "splash": [
            {
                "id": 1,
                "name": "Product 1 Promo",
                "date": "2020-11-10 18:00:00"
            },
            {
                "id": 2,
                "name": "Product 2 Promo",
                "date": "2020-11-10 18:10:00"
            }
        ]
    }
}

获取账户信息

GET https://makily.com/api/account

向此端点发送请求即可获取账户信息,端点将返回该账户的相关数据。

curl --location --request GET 'https://makily.com/api/account' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "data": {
        "id": 1,
        "email": "sample@domain.com",
        "username": "sampleuser",
        "avatar": "https:\/\/domain.com\/content\/avatar.png",
        "status": "pro",
        "expires": "2022-11-15 15:00:00",
        "registered": "2020-11-10 18:01:43"
    }
}

更新账户

PUT https://makily.com/api/account/update

向此端点发送请求即可更新账户信息,端点将更新该账户的相关数据。

curl --location --request PUT 'https://makily.com/api/account/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "newemail@google.com",
    "password": "NewPassword1"
}'

服务器响应

{
    "error": 0,
    "message": "Account has been successfully updated."
}

列出频道

GET https://makily.com/api/channels?limit=2&page=1

可使用此端点通过 API 获取您的频道,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/channels?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "channels": [
            {
                "id": 1,
                "name": "Channel 1",
                "description": "Description of channel 1",
                "color": "#000000",
                "starred": true
            },
            {
                "id": 2,
                "name": "Channel 2",
                "description": "Description of channel 2",
                "color": "#FF0000",
                "starred": false
            }
        ]
    }
}

列出频道项目

GET https://makily.com/api/channel/:id?limit=1&page=1

可使用此端点通过 API 获取所选频道中的项目,也可以筛选数据(更多信息请参见表格)。

参数 描述
limit (可选)每页返回的数据条数
page (可选)当前请求的页码
curl --location --request GET 'https://makily.com/api/channel/:id?limit=1&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "items": [
            {
                "type": "links",
                "id": 1,
                "title": "My Sample Link",
                "preview": "https:\/\/google.com",
                "link": "https:\/\/makily.com\/google",
                "date": "2022-05-12"
            },
            {
                "type": "bio",
                "id": 1,
                "title": "My Sample Bio",
                "preview": "https:\/\/makily.com\/mybio",
                "link": "https:\/\/makily.com\/mybio",
                "date": "2022-06-01"
            }
        ]
    }
}

创建频道

POST https://makily.com/api/channel/add

可使用此端点添加频道。

参数 描述
name (必填)频道名称
description (可选)频道描述
color (可选)频道徽章颜色(HEX)
starred (可选)是否将频道标星(true 或 false)
curl --location --request POST 'https://makily.com/api/channel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "New Channel",
    "description": "my new channel",
    "color": "#000000",
    "starred": true
}'

服务器响应

{
    "error": 0,
    "id": 3,
    "name": "New Channel",
    "description": "my new channel",
    "color": "#000000",
    "starred": true
}

将项目分配给频道

POST https://makily.com/api/channel/:channelid/assign/:type/:itemid

发送包含频道 ID、项目类型(links、bio 或 qr)及项目 ID 的请求,即可将项目分配给任意频道。

参数 描述
:channelid (必填)频道 ID
:type (必填)links、bio 或 qr
:itemid (必填)项目 ID
curl --location --request POST 'https://makily.com/api/channel/:channelid/assign/:type/:itemid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Item successfully added to the channel."
}

更新频道

PUT https://makily.com/api/channel/:id/update

要更新频道,需要通过 PUT 请求发送有效的 JSON 数据。数据必须按下方所示作为请求的原始正文发送。下方示例列出了所有可发送的参数,但无需全部提供(更多信息请参见表格)。

参数 描述
name (可选)频道名称
description (可选)频道描述
color (可选)频道徽章颜色(HEX)
starred (可选)是否将频道标星(true 或 false)
curl --location --request PUT 'https://makily.com/api/channel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Acme Corp",
    "description": "channel for items for Acme Corp",
    "color": "#FFFFFF",
    "starred": false
}'

服务器响应

{
    "error": 0,
    "message": "Channel has been updated successfully."
}

删除频道

DELETE https://makily.com/api/channel/:id/delete

要删除频道,需要发送 DELETE 请求。频道内的所有项目也将被取消分配。

curl --location --request DELETE 'https://makily.com/api/channel/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \

服务器响应

{
    "error": 0,
    "message": "Channel has been deleted successfully."
}