接口地址
接入須知
Telegarm Premium 用戶名查詢 和 會員開通 接口均提供兩個 URL,支援 USDT 或 TRX 付款。
子網域 gift 為 USDT 計價,請前往 https://t.me/GiftAPIBot 取得 ApiKey(推薦)
子網域 web 為即時匯率的 TRX 計價,請前往 https://t.me/XXTrxBot 取得 ApiKey
請依照自身需求選擇其中一種方式對接,並提前在對應的機器人預存餘額。
POST https://gift.apitrx.com/query USDT 計價,此接口查詢使用者名稱是否符合開通條件。
POST https://web.apitrx.com/query TRX 計價,此接口查詢使用者名稱是否符合開通條件。
請求參數
參數名稱 | 類型 | 說明 | 範例 |
---|---|---|---|
apikey | string | 對應機器人取得的 apikey | 83928AFB-14A5-4878-A63D-128467830293 |
username | string | 待開通的使用者名稱 | @premium |
回傳參數
{
"code": 200,
"data": {
"username": "@preminum",
"nickname" : "暱稱",
"photo": "https://cdn4.telesco.pe/file/...."
},
"message": "SUCCESS"
}
參數名稱 | 類型 | 說明 | 範例 |
---|---|---|---|
code | int | 200 表示符合條件,其餘均不符合開通條件 | 200/500 |
message | string | 提示訊息 | SUCCESS/ERROR/已經是會員了/使用者不存在 |
data.username | string | 使用者名稱 | premium |
data.nickname | string | 暱稱 | jack |
data.photo | string | 使用者頭像 | https://cdn4.telesco.pe... |
程式碼範例
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
public class PostRequestExample {
public static void main(String[] args) throws Exception {
URL url = new URL("https://gift.apitrx.com/query");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JSONObject jsonInput = new JSONObject();
jsonInput.put("apikey", "83928AFB-14A5-4878-A63D-128467830293");
jsonInput.put("username", "premium");
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInput.toString().getBytes("utf-8");
os.write(input, 0, input.length);
}
InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is, "utf-8"));
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line.trim());
}
JSONObject jsonResponse = new JSONObject(response.toString());
System.out.println("Code: " + jsonResponse.getInt("code"));
System.out.println("Message: " + jsonResponse.getString("message"));
JSONObject data = jsonResponse.getJSONObject("data");
System.out.println("Username: " + data.getString("username"));
System.out.println("Photo: " + data.getString("photo"));
System.out.println("Nickname: " + data.getString("nickname"));
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://gift.apitrx.com/query"
payload := map[string]string{
"apikey": "83928AFB-14A5-4878-A63D-128467830293",
"username": "premium",
}
jsonData, _ := json.Marshal(payload)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Username string `json:"username"`
Photo string `json:"photo"`
Nickname string `json:"nickname"`
} `json:"data"`
}
json.Unmarshal(body, &result)
fmt.Println("Code:", result.Code)
fmt.Println("Message:", result.Message)
fmt.Println("Username:", result.Data.Username)
fmt.Println("Photo:", result.Data.Photo)
fmt.Println("Nickname:", result.Data.Nickname)
}
import requests
url = "https://gift.apitrx.com/query"
payload = {
"apikey": "83928AFB-14A5-4878-A63D-128467830293",
"username": "premium"
}
response = requests.post(url, json=payload)
data = response.json()
print("Code:", data['code'])
print("Message:", data['message'])
print("Username:", data['data']['username'])
print("Photo:", data['data']['photo'])
print("Nickname:", data['data']['nickname'])
<?php
<?php
$url = "https://gift.apitrx.com/query";
$data = [
"apikey" => "83928AFB-14A5-4878-A63D-128467830293",
"username" => "premium"
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Code: " . $result['code'] . "\n";
echo "Message: " . $result['message'] . "\n";
echo "Username: " . $result['data']['username'] . "\n";
echo "Photo: " . $result['data']['photo'] . "\n";
echo "Nickname: " . $result['data']['nickname'] . "\n";
?>
curl -X POST https://gift.apitrx.com/query \
-H "Content-Type: application/json" \
-d '{"apikey":"83928AFB-14A5-4878-A63D-128467830293","username":"premium"}'