创建短链接 - cURL
curl -X POST https://short.rakin.cn/api/create \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/long/url","customCode":"mylink"}'
创建短链接 - JavaScript
const response = await fetch('https://short.rakin.cn/api/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/long/url',
customCode: 'mylink'
})
});
const data = await response.json();
console.log('短链接:', data.shortUrl);
创建短链接 - Python
import requests
response = requests.post(
'https://short.rakin.cn/api/create',
headers={'Content-Type': 'application/json'},
json={
'url': 'https://example.com/long/url',
'customCode': 'mylink'
}
)
data = response.json()
print(f"短链接: {data['shortUrl']}")
获取列表 - cURL (需要密码)
curl -X GET https://short.rakin.cn/api/list \
-H "Authorization: Bearer Abc.147258"
删除短链接 - cURL (需要密码)
curl -X DELETE https://short.rakin.cn/api/delete/abc123 \
-H "Authorization: Bearer Abc.147258"