X.gd Developers

我們提供可從外部應用程式呼叫的URL縮短API。使用API需要API金鑰。

URL短連結API

Shorten API v1.0

GET https://xgd.io/V1/shorten

請求

*ParameterTypeFormatDescriptionExample
*urlStringhttp(s)://要縮短的URLhttps://example.com
shortidString[0-9a-zA-Z_]{6,15}自定义短鏈接。省略時將随机分配example
analyticsStringtrue / false啟用访问分析。省略時默認啟用true
filterbotsStringtrue / false啟用分析時的机器人過滤。省略時默認關闭false
*keyString[0-9a-f]{32}已發行的API金鑰0af50e06255c7004f9ad71338f5ad56e
請求範例(URL)
https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}
請求範例(cURL)
curl -X GET 'https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}'

回應(成功)

*ParameterTypeFormatDescriptionExample
*statusNumber200狀態碼200
*shorturlStringhttps://x.gd/[0-9a-zA-Z_]+短連結https://x.gd/example
*analyticsBooleantrue / false存取分析true
*filterbotsBooleantrue / false機器人過濾false
*originalurlStringhttp(s)://原始URLhttps://example.com
回應範例
status: 200
content-type: application/json

{
    "status": 200,
    "shorturl": "https://x.gd/example",
    "analytics": true,
    "filterbots": false,
    "originalurl": "https://example.com/"
}

回應(失敗)

*ParameterTypeFormatDescriptionExample
*statusNumber400 / 401 / 403 / 409 / 429 / 500 / 503狀態碼429
*messageString-錯誤訊息Too many requests.
回應範例
status: 200
content-type: application/json

{
    "status": 429,
    "message": "Too many requests."
}

狀態碼

StatusDescription
200响應正常。
400請求發生错误。消息中包含详细信息。
401權杖無效。請檢查API金鑰。
403暫時或永久不可用。
409無法按請求条件發行短鏈接。消息中包含详细信息。
429已达到API使用限制。請等待限制解除后重试。
500暫時發生系統错误。請稍后再试。
503服務暫時不可用。請稍后再试。

API金鑰

我们会向您输入的邮箱發送用于發行API密钥的URL。
發送后請在24小時内完成手续。