API 文档

认证接口

1. 发送注册验证码

POST/register

请求向指定邮箱发送注册验证码。

Body Parameters
名称类型描述
usernameString用户名.
emailString用户邮箱.
passwordString密码 (至少6位).
curl -X POST "https://link.zdck8.com/register" \
     -H "Content-Type: application/json" \
     -d '{
  "username": "your_username",
  "email": "your_email",
  "password": "your_password"
}'
fetch('https://link.zdck8.com/register', {
    method: 'POST',
    headers: {"Content-Type":"application/json"},
    body: JSON.stringify({
    "username": "your_username",
    "email": "your_email",
    "password": "your_password"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/register"
headers = {"Content-Type":"application/json"}
payload = {
    "username": "your_username",
    "email": "your_email",
    "password": "your_password"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/register",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "username" => "your_username",
    "email" => "your_email",
    "password" => "your_password"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/register"
	method := "POST"

	payload := strings.NewReader(`{
  "username": "your_username",
  "email": "your_email",
  "password": "your_password"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"username\":\"your_username\",\"email\":\"your_email\",\"password\":\"your_password\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/register")
            .method("POST", body)
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/register")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "username": "your_username",
  "email": "your_email",
  "password": "your_password"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://link.zdck8.com/register");
        var content = new StringContent("{\"username\":\"your_username\",\"email\":\"your_email\",\"password\":\"your_password\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
错误响应示例:
HTTP/1.1 409 Conflict
{
"status": "error",
"message": "邮箱或用户名已被注册。"
}

2. 验证并完成注册

POST/verify

使用收到的验证码完成用户注册,并返回Token。

Body Parameters
名称类型描述
emailString用户邮箱.
codeString6位验证码.
curl -X POST "https://link.zdck8.com/verify" \
     -H "Content-Type: application/json" \
     -d '{
  "email": "your_email",
  "code": "your_code"
}'
fetch('https://link.zdck8.com/verify', {
    method: 'POST',
    headers: {"Content-Type":"application/json"},
    body: JSON.stringify({
    "email": "your_email",
    "code": "your_code"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/verify"
headers = {"Content-Type":"application/json"}
payload = {
    "email": "your_email",
    "code": "your_code"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/verify",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "email" => "your_email",
    "code" => "your_code"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/verify"
	method := "POST"

	payload := strings.NewReader(`{
  "email": "your_email",
  "code": "your_code"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"email\":\"your_email\",\"code\":\"your_code\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/verify")
            .method("POST", body)
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/verify")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "email": "your_email",
  "code": "your_code"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://link.zdck8.com/verify");
        var content = new StringContent("{\"email\":\"your_email\",\"code\":\"your_code\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 201 Created
{
"status": "success",
"data": {
"username": "testuser",
"token": "a-unique-token-string"
}
}

3. 用户登录

POST/login

使用邮箱和密码登录,获取认证Token及用户信息。

Body Parameters
名称类型描述
emailString用户邮箱.
passwordString密码.
curl -X POST "https://link.zdck8.com/login" \
     -H "Content-Type: application/json" \
     -d '{
  "email": "your_email",
  "password": "your_password"
}'
fetch('https://link.zdck8.com/login', {
    method: 'POST',
    headers: {"Content-Type":"application/json"},
    body: JSON.stringify({
    "email": "your_email",
    "password": "your_password"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/login"
headers = {"Content-Type":"application/json"}
payload = {
    "email": "your_email",
    "password": "your_password"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/login",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "email" => "your_email",
    "password" => "your_password"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/login"
	method := "POST"

	payload := strings.NewReader(`{
  "email": "your_email",
  "password": "your_password"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"email\":\"your_email\",\"password\":\"your_password\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/login")
            .method("POST", body)
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/login")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "email": "your_email",
  "password": "your_password"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://link.zdck8.com/login");
        var content = new StringContent("{\"email\":\"your_email\",\"password\":\"your_password\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"message": "登录成功",
"data": {
"username": "testuser",
"token": "your-unique-token",
"is_admin": false
}
}

4. 修改密码

POST/change-password

修改当前登录用户的密码。需要提供认证Token。

Headers
名称类型描述
AuthorizationString用户的认证Token.
Body Parameters
名称类型描述
oldPasswordString当前密码.
newPasswordString新密码 (至少6位).
curl -X POST "https://link.zdck8.com/change-password" \
     -H "Authorization: YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
  "oldPassword": "your_oldPassword",
  "newPassword": "your_newPassword"
}'
fetch('https://link.zdck8.com/change-password', {
    method: 'POST',
    headers: {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"},
    body: JSON.stringify({
    "oldPassword": "your_oldPassword",
    "newPassword": "your_newPassword"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/change-password"
headers = {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"}
payload = {
    "oldPassword": "your_oldPassword",
    "newPassword": "your_newPassword"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/change-password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "oldPassword" => "your_oldPassword",
    "newPassword" => "your_newPassword"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/change-password"
	method := "POST"

	payload := strings.NewReader(`{
  "oldPassword": "your_oldPassword",
  "newPassword": "your_newPassword"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"oldPassword\":\"your_oldPassword\",\"newPassword\":\"your_newPassword\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/change-password")
            .method("POST", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/change-password")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'YOUR_TOKEN'
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "oldPassword": "your_oldPassword",
  "newPassword": "your_newPassword"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://link.zdck8.com/change-password");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var content = new StringContent("{\"oldPassword\":\"your_oldPassword\",\"newPassword\":\"your_newPassword\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"message": "密码修改成功。"
}

用户接口

GET/my-links

查看当前用户提交的所有友链。

Headers
名称类型描述
AuthorizationString用户的认证Token.
curl -X GET "https://link.zdck8.com/my-links" \
     -H "Authorization: YOUR_TOKEN"
fetch('https://link.zdck8.com/my-links', {
    method: 'GET',
    headers: {"Authorization":"YOUR_TOKEN"},
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/my-links"
headers = {"Authorization":"YOUR_TOKEN"}
response = requests.get(url, headers=headers)
print(response.json())
 "https://link.zdck8.com/my-links",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "https://link.zdck8.com/my-links"
	method := "GET"

	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = null;
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/my-links")
            .method("GET", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/my-links")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'YOUR_TOKEN'

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Get, "https://link.zdck8.com/my-links");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"data": [
{
"id": 1,
"name": "我的机器人",
"pdlink": "...",
"qunlink": "...",
"keywords": "工具, AI",
"visits": 120
}
]
}

1. 提交新友链

POST/links/

提交一个新的友链。

Headers
名称类型描述
AuthorizationString用户的认证Token.
Body Parameters
名称类型描述
nameString机器人名称.
robot_uinString机器人UIN (QQ号).
robot_appidString机器人AppID.
keywordsString[]关键词数组.
descriptionString机器人描述 (最多100字).
curl -X POST "https://link.zdck8.com/links/" \
     -H "Authorization: YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
}'
fetch('https://link.zdck8.com/links/', {
    method: 'POST',
    headers: {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"},
    body: JSON.stringify({
    "name": "your_name",
    "robot_uin": "your_robot_uin",
    "robot_appid": "your_robot_appid",
    "keywords": "your_keywords",
    "description": "your_description"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/links/"
headers = {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"}
payload = {
    "name": "your_name",
    "robot_uin": "your_robot_uin",
    "robot_appid": "your_robot_appid",
    "keywords": "your_keywords",
    "description": "your_description"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/links/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "name" => "your_name",
    "robot_uin" => "your_robot_uin",
    "robot_appid" => "your_robot_appid",
    "keywords" => "your_keywords",
    "description" => "your_description"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/links/"
	method := "POST"

	payload := strings.NewReader(`{
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"name\":\"your_name\",\"robot_uin\":\"your_robot_uin\",\"robot_appid\":\"your_robot_appid\",\"keywords\":\"your_keywords\",\"description\":\"your_description\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/links/")
            .method("POST", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/links/")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'YOUR_TOKEN'
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://link.zdck8.com/links/");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var content = new StringContent("{\"name\":\"your_name\",\"robot_uin\":\"your_robot_uin\",\"robot_appid\":\"your_robot_appid\",\"keywords\":\"your_keywords\",\"description\":\"your_description\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 201 Created
{
"status": "success",
"message": "友链提交成功。",
"data": { "id": 123 }
}

GET/links/links

根据权重算法,获取推荐的友链列表。

Headers
名称类型描述
AuthorizationString用户的认证Token.
Query Parameters
名称类型描述
num=1Number希望获取的友链数量 (默认 1, 最大 10).
curl -X GET "https://link.zdck8.com/links/links" \
     -H "Authorization: YOUR_TOKEN"
fetch('https://link.zdck8.com/links/links', {
    method: 'GET',
    headers: {"Authorization":"YOUR_TOKEN"},
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/links/links"
headers = {"Authorization":"YOUR_TOKEN"}
response = requests.get(url, headers=headers)
print(response.json())
 "https://link.zdck8.com/links/links",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "https://link.zdck8.com/links/links"
	method := "GET"

	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = null;
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/links/links")
            .method("GET", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/links/links")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'YOUR_TOKEN'

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Get, "https://link.zdck8.com/links/links");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"data": [...]
}

DELETE/links/:id

删除指定ID的友链。只能删除自己提交的友链。

Headers
名称类型描述
AuthorizationString用户的认证Token.
URL Parameters
名称类型描述
idNumber链接的唯一ID.
curl -X DELETE "https://link.zdck8.com/links/:id" \
     -H "Authorization: YOUR_TOKEN"
fetch('https://link.zdck8.com/links/:id', {
    method: 'DELETE',
    headers: {"Authorization":"YOUR_TOKEN"},
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/links/:id"
headers = {"Authorization":"YOUR_TOKEN"}
response = requests.delete(url, headers=headers)
print(response.json())
 "https://link.zdck8.com/links/:id",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "https://link.zdck8.com/links/:id"
	method := "DELETE"

	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = null;
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/links/:id")
            .method("DELETE", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/links/:id")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'YOUR_TOKEN'

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Delete, "https://link.zdck8.com/links/:id");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"message": "链接删除成功。"
}

PUT/links/:id

修改指定ID的友链信息。只能修改自己提交的友链。

Headers
名称类型描述
AuthorizationString用户的认证Token.
URL Parameters
名称类型描述
idNumber链接的唯一ID.
Body Parameters
名称类型描述
nameString机器人名称.
robot_uinString机器人UIN (QQ号).
robot_appidString机器人AppID.
keywordsString[]关键词数组.
descriptionString机器人描述 (最多100字).
curl -X PUT "https://link.zdck8.com/links/:id" \
     -H "Authorization: YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
}'
fetch('https://link.zdck8.com/links/:id', {
    method: 'PUT',
    headers: {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"},
    body: JSON.stringify({
    "name": "your_name",
    "robot_uin": "your_robot_uin",
    "robot_appid": "your_robot_appid",
    "keywords": "your_keywords",
    "description": "your_description"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/links/:id"
headers = {"Authorization":"YOUR_TOKEN","Content-Type":"application/json"}
payload = {
    "name": "your_name",
    "robot_uin": "your_robot_uin",
    "robot_appid": "your_robot_appid",
    "keywords": "your_keywords",
    "description": "your_description"
}
response = requests.put(url, headers=headers, data=json.dumps(payload))
print(response.json())
 "https://link.zdck8.com/links/:id",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => [
    "Authorization: YOUR_TOKEN",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "name" => "your_name",
    "robot_uin" => "your_robot_uin",
    "robot_appid" => "your_robot_appid",
    "keywords" => "your_keywords",
    "description" => "your_description"
])
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
	"strings"
)

func main() {
	url := "https://link.zdck8.com/links/:id"
	method := "PUT"

	payload := strings.NewReader(`{
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
}`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "YOUR_TOKEN")
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"name\":\"your_name\",\"robot_uin\":\"your_robot_uin\",\"robot_appid\":\"your_robot_appid\",\"keywords\":\"your_keywords\",\"description\":\"your_description\"}");
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/links/:id")
            .method("PUT", body)
            .addHeader("Authorization", "YOUR_TOKEN")
            .addHeader("Content-Type", "application/json")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/links/:id")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'YOUR_TOKEN'
request["Content-Type"] = 'application/json'
request.body = JSON.dump({
  "name": "your_name",
  "robot_uin": "your_robot_uin",
  "robot_appid": "your_robot_appid",
  "keywords": "your_keywords",
  "description": "your_description"
})

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Put, "https://link.zdck8.com/links/:id");
        request.Headers.Add("Authorization", "YOUR_TOKEN");
        var content = new StringContent("{\"name\":\"your_name\",\"robot_uin\":\"your_robot_uin\",\"robot_appid\":\"your_robot_appid\",\"keywords\":\"your_keywords\",\"description\":\"your_description\"}", Encoding.UTF8, "application/json");
        request.Content = content;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"message": "链接更新成功。"
}

公共接口

1. 获取所有关键词

GET/keywords

公开接口,无需认证。获取所有出现过的关键词列表。

curl -X GET "https://link.zdck8.com/keywords"
fetch('https://link.zdck8.com/keywords', {
    method: 'GET',
    headers: {},
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json

url = "https://link.zdck8.com/keywords"
headers = {}
response = requests.get(url, headers=headers)
print(response.json())
 "https://link.zdck8.com/keywords",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    ""
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "https://link.zdck8.com/keywords"
	method := "GET"

	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = null;
        Request request = new Request.Builder()
            .url("https://link.zdck8.com/keywords")
            .method("GET", body)
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
require 'uri'
require 'net/http'
require 'json'

url = URI("https://link.zdck8.com/keywords")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program {
    static async Task Main(string[] args) {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Get, "https://link.zdck8.com/keywords");
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
成功响应示例:
HTTP/1.1 200 OK
{
"status": "success",
"data": ["工具", "AI", "效率", ...]
}