查询单个激活码(按内容)
curl --request GET \
--url https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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"
)
func main() {
url := "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"code": "<string>",
"status": true,
"is_disabled": true,
"is_expired": true,
"expires_at": 123,
"verified_at": 123,
"verified_by": "<string>",
"created_at": 123,
"verification_logs": [
{
"id": "<string>",
"verified_at": 123,
"verified_by": "<string>",
"ip_address": "<string>",
"result": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}项目与激活码
按激活码内容查询
查询单个激活码(按内容)
curl --request GET \
--url https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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"
)
func main() {
url := "https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{project_id}/codes/by-code/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"code": "<string>",
"status": true,
"is_disabled": true,
"is_expired": true,
"expires_at": 123,
"verified_at": 123,
"verified_by": "<string>",
"created_at": 123,
"verification_logs": [
{
"id": "<string>",
"verified_at": 123,
"verified_by": "<string>",
"ip_address": "<string>",
"result": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}根据激活码内容(非 ID)查询单个激活码详情。路径中的
{code} 为激活码原文,需进行 URL 编码。响应格式与 按 ID 查询 一致,包含 verification_logs。授权
API Key + X-Timestamp + X-Signature(HMAC-SHA256)
⌘I