网淘吧来吧,欢迎您!

Go2.gg技能使用说明

2026-04-01 新闻来源:网淘吧 围观:14
电脑广告
手机广告

Go2.gg —— 原生边缘网络URL缩短器

提供链接缩短、数据分析、二维码生成、网络钩子、图库(个人主页链接整合)功能。基于Cloudflare边缘网络构建,全球重定向延迟低于10毫秒。

设置

获取API密钥:https://go2.gg/dashboard/api-keys(免费,无需信用卡)

Go2.gg

export GO2GG_API_KEY="go2_your_key_here"

API基础地址: https://api.go2.gg/api/v1 认证方式: Authorization: Bearer $GO2GG_API_KEY 文档: https://go2.gg/docs/api/links


短链接

支持创建、管理和追踪短链接,可自定义短链代码、添加标签、设置过期时间、密码保护,并实现地理定位/设备定向功能。

创建链接

curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationUrl": "https://example.com/landing-page",
    "slug": "my-link",
    "title": "My Campaign Link",
    "tags": ["marketing", "q1-2025"]
  }'

重要提示:字段名应为destinationUrl(而非url)。短链代码为可选参数(若留空将自动生成)。

响应

{
  "success": true,
  "data": {
    "id": "lnk_abc123",
    "shortUrl": "https://go2.gg/my-link",
    "destinationUrl": "https://example.com/landing-page",
    "slug": "my-link",
    "domain": "go2.gg",
    "title": "My Campaign Link",
    "tags": ["marketing", "q1-2025"],
    "clickCount": 0,
    "createdAt": "2025-01-01T10:30:00Z"
  }
}

列出链接

# List all links (paginated)
curl "https://api.go2.gg/api/v1/links?perPage=20&sort=clicks" \
  -H "Authorization: Bearer $GO2GG_API_KEY"

# Search links
curl "https://api.go2.gg/api/v1/links?search=marketing&tag=q1-2025" \
  -H "Authorization: Bearer $GO2GG_API_KEY"

查询参数: 页码每页数量(最多100条),搜索域名标签已归档排序方式(创建时间/点击次数/更新时间)

更新链接

curl -X PATCH "https://api.go2.gg/api/v1/links/lnk_abc123" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl": "https://example.com/updated-page", "tags": ["updated"]}'

删除链接

curl -X DELETE "https://api.go2.gg/api/v1/links/lnk_abc123" \
  -H "Authorization: Bearer $GO2GG_API_KEY"
# Returns 204 No Content

链接分析

curl "https://api.go2.gg/api/v1/links/lnk_abc123/stats" \
  -H "Authorization: Bearer $GO2GG_API_KEY"

返回:总点击次数按国家统计按设备统计按浏览器统计,byReferrer,overTime

高级链接选项

# Password-protected link
curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl": "https://example.com/secret", "slug": "exclusive", "password": "secure123"}'

# Link with expiration + click limit
curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl": "https://example.com/flash", "expiresAt": "2025-12-31T23:59:59Z", "clickLimit": 1000}'

# Geo-targeted link (different URLs per country)
curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationUrl": "https://example.com/default",
    "geoTargets": {"US": "https://example.com/us", "GB": "https://example.com/uk", "IN": "https://example.com/in"}
  }'

# Device-targeted link + app deep links
curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationUrl": "https://example.com/default",
    "deviceTargets": {"mobile": "https://m.example.com"},
    "iosUrl": "https://apps.apple.com/app/myapp",
    "androidUrl": "https://play.google.com/store/apps/details?id=com.myapp"
  }'

# Link with UTM parameters
curl -X POST "https://api.go2.gg/api/v1/links" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationUrl": "https://example.com/product",
    "slug": "summer-sale",
    "utmSource": "email",
    "utmMedium": "newsletter",
    "utmCampaign": "summer-sale"
  }'

创建链接参数

字段类型必填描述
destinationUrl字符串重定向的目标URL
slug字符串自定义短链标识(如省略则自动生成)
domain字符串自定义域名(默认:go2.gg)
title字符串链接标题
description字符串链接描述
标签字符串数组用于筛选的标签
密码字符串密码保护
过期时间字符串ISO 8601 过期日期
点击限制数字允许的最大点击次数
地理目标对象国家 → URL 映射
设备目标对象设备 → URL 映射
iOS 链接字符串iOS应用深度链接
安卓链接字符串Android应用深度链接
utm来源/媒介/活动/关键词/内容字符串UTM参数

二维码

生成可自定义的二维码。二维码生成免费且无需认证。

生成二维码(无需认证)

# Generate SVG QR code (free, no API key needed)
curl -X POST "https://api.go2.gg/api/v1/qr/generate" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://go2.gg/my-link",
    "size": 512,
    "foregroundColor": "#1a365d",
    "backgroundColor": "#FFFFFF",
    "cornerRadius": 10,
    "errorCorrection": "H",
    "format": "svg"
  }' -o qr-code.svg

# PNG format
curl -X POST "https://api.go2.gg/api/v1/qr/generate" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "png", "size": 1024}' -o qr-code.png

二维码参数

字段类型默认值描述
网址字符串必需要编码的URL
尺寸数值256尺寸(像素)(64-2048)
前景色字符串#000000模块的十六进制颜色
背景色字符串#FFFFFF背景的十六进制颜色
圆角半径数字0模块圆角半径(0-50)
纠错等级字符串ML (7%), M (15%), Q (25%), H (30%)
格式字符串svgsvg 或 png

保存与追踪二维码(需要认证)

# Save QR config for tracking
curl -X POST "https://api.go2.gg/api/v1/qr" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Business Card QR", "url": "https://go2.gg/contact", "linkId": "lnk_abc123"}'

# List saved QR codes
curl "https://api.go2.gg/api/v1/qr" -H "Authorization: Bearer $GO2GG_API_KEY"

# Download saved QR
curl "https://api.go2.gg/api/v1/qr/qr_abc123/download?format=svg" \
  -H "Authorization: Bearer $GO2GG_API_KEY" -o qr.svg

# Delete QR
curl -X DELETE "https://api.go2.gg/api/v1/qr/qr_abc123" -H "Authorization: Bearer $GO2GG_API_KEY"

Webhooks

接收链接点击、创建和更新的实时通知。

# Create webhook
curl -X POST "https://api.go2.gg/api/v1/webhooks" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Click Tracker", "url": "https://your-server.com/webhook", "events": ["click", "link.created"]}'

# List webhooks
curl "https://api.go2.gg/api/v1/webhooks" -H "Authorization: Bearer $GO2GG_API_KEY"

# Test webhook
curl -X POST "https://api.go2.gg/api/v1/webhooks/wh_abc123/test" \
  -H "Authorization: Bearer $GO2GG_API_KEY"

# Delete webhook
curl -X DELETE "https://api.go2.gg/api/v1/webhooks/wh_abc123" \
  -H "Authorization: Bearer $GO2GG_API_KEY"

事件: 点击,链接创建,链接更新,链接删除,域名验证,二维码扫描,*(全部)

Webhook 载荷包含X-Webhook-Signature(HMAC SHA256)用于验证。重试间隔:5秒 → 30秒 → 2分钟 → 10分钟。


图库(链接在简介中)

通过编程方式创建链接在简介中的页面。

# Create gallery
curl -X POST "https://api.go2.gg/api/v1/galleries" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "myprofile", "title": "My Name", "bio": "Creator & developer", "theme": "gradient"}'

# Add link item
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/items" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "link", "title": "My Website", "url": "https://example.com"}'

# Add YouTube embed
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/items" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "embed", "title": "Latest Video", "embedType": "youtube", "embedData": {"videoId": "dQw4w9WgXcQ"}}'

# Publish gallery (makes it live at go2.gg/bio/myprofile)
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/publish" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"isPublished": true}'

# Reorder items
curl -X PATCH "https://api.go2.gg/api/v1/galleries/gal_abc123/items/reorder" \
  -H "Authorization: Bearer $GO2GG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"itemIds": ["item_3", "item_1", "item_2"]}'

# List galleries
curl "https://api.go2.gg/api/v1/galleries" -H "Authorization: Bearer $GO2GG_API_KEY"

主题:默认、简约、渐变、深色、霓虹、自定义(使用 customCss)项目类型:链接、标题、分隔线、嵌入(YouTube)、图片


Python 示例

import requests

API_KEY = "go2_your_key_here"  # or os.environ["GO2GG_API_KEY"]
BASE = "https://api.go2.gg/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

# Create short link
resp = requests.post(f"{BASE}/links", headers=headers, json={
    "destinationUrl": "https://example.com/product",
    "slug": "my-product",
    "title": "Product Link",
    "tags": ["product"]
})
link = resp.json()["data"]
print(f"Short URL: {link['shortUrl']}")

# Get analytics
stats = requests.get(f"{BASE}/links/{link['id']}/stats", headers=headers).json()["data"]
print(f"Clicks: {stats['totalClicks']}")

# Generate QR (no auth needed)
qr = requests.post(f"{BASE}/qr/generate", json={"url": link["shortUrl"], "size": 512, "format": "png"})
with open("qr.png", "wb") as f:
    f.write(qr.content)

API端点摘要

服务端点方法认证
链接创建链接/api/v1/linksPOST
链接列表/api/v1/linksGET
获取链接/api/v1/links/:idGET
更新链接/api/v1/links/:idPATCH
删除链接/api/v1/links/:idDELETE
链接统计/api/v1/links/:id/statsGET
二维码生成/api/v1/qr/generatePOST
二维码保存/api/v1/qrPOST
二维码列表/api/v1/qrGET
二维码下载/api/v1/qr/:id/downloadGET
Webhooks/api/v1/webhooksCRUD
Webhook 测试/api/v1/webhooks/:id/testPOST是的
画廊/api/v1/galleries增删改查是的
画廊项目/api/v1/galleries/:id/items增删改查是的
画廊发布/api/v1/galleries/:id/publishPOST是的

速率限制

方案请求数/分钟
免费60
专业版300
商业版1000

错误代码

代码描述
SLUG_RESERVEDSlug 已被保留
SLUG_EXISTS此域名下已存在该短链接
INVALID_URL目标链接无效
LIMIT_REACHED已达到计划链接数量上限
DOMAIN_NOT_VERIFIED自定义域名未通过验证

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏

文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第410263名访客 今日有0篇新文章/评论