API Endpoints
GET https://web.apitrx.com/getenergy
Parameters
Parameters | Type | Description | Example |
---|---|---|---|
apikey | string | Apikey obtained by TG robot | 83928AFB-14A5-4878-A63D-128467830293 |
add | string | Trc20 address receiving energy | TX8BF429hr7qK1Te8UWLxD9xbumtX11111 |
value | int | The energy value must be >= 32000 | 32000/65000/100000 |
hour | int | 1 = 1hour, 24 = 24hour, 72 = 3day, 168 = 7day,336 = 14day,720 = 30day | 1/24/72/168/336/720 |
Response
{
"code": 200,
"data": {
"balance": 99.5
"txid":"cedf46ed366fb89cddc1e892383c6f5abe2f16dbefa97b15c76989c111027880"
"amount": 2.0
},
"message": "SUCCESS"
}
Parameters | Type | Description | Example |
---|---|---|---|
code | int | 200 is success, everything else is failure | 200/Success 500/Failure 501/Account disabled 502/Insufficient balance |
message | string | Prompt message | SUCCESS/ERROR |
data.balance | float | Balance (TRX) | 99.5 |
data.txid | string | Hash | cedf46ed366fb89cddc... |
data.amount | float | Amount of consumption(TRX) | 2.0 |
Code Example
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
public class HttpGetWithParameters {
public static void main(String[] args) {
try {
// 设置要访问的URL
String baseUrl = "https://web.apitrx.com/getenergy";
// 设置参数
String apiKey = "83928AFB-14A5-4878-A63D-128467830293";
String add = "TX8BF429hr7qK1Te8UWLxD9xbumtX11111";
String value = "32000";
String hour = "1";
// 构建带参数的URL
String urlWithParams = baseUrl + "?" +
"apikey=" + URLEncoder.encode(apiKey, "UTF-8") +
"&add=" + URLEncoder.encode(add, "UTF-8") +
"&value=" + URLEncoder.encode(value, "UTF-8") +
"&hour=" + URLEncoder.encode(hour, "UTF-8");
// 创建URL对象
URL obj = new URL(urlWithParams);
// 打开连接
HttpURLConnection connection = (HttpURLConnection) obj.openConnection();
// 设置请求方式为GET
connection.setRequestMethod("GET");
// 获取响应码
int responseCode = connection.getResponseCode();
System.out.println("Response Code: " + responseCode);
// 读取响应内容
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// 关闭连接
in.close();
// 打印响应内容
System.out.println("Response Content: " + response.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
}
package main
import (
"fmt"
"net/http"
"net/url"
)
func sendGetRequest() {
// 设置要访问的URL
baseURL := "https://web.apitrx.com/getenergy"
// 设置参数
params := url.Values{}
params.Add("apikey", "83928AFB-14A5-4878-A63D-128467830293")
params.Add("add", "TX8BF429hr7qK1Te8UWLxD9xbumtX11111")
params.Add("value", "32000")
params.Add("hour", "1")
// 构建带参数的URL
urlWithParams := baseURL + "?" + params.Encode()
// 发送GET请求
response, err := http.Get(urlWithParams)
if err != nil {
fmt.Println("Error:", err)
return
}
defer response.Body.Close()
// 读取响应内容
body, err := io.ReadAll(response.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
// 打印响应内容
fmt.Println("Response Code:", response.Status)
fmt.Println("Response Content:", string(body))
}
func main() {
sendGetRequest()
}
import requests
def send_get_request():
# 设置要访问的URL
url = "https://web.apitrx.com/getenergy"
# 设置参数
params = {
'apikey': '83928AFB-14A5-4878-A63D-128467830293',
'add': 'TX8BF429hr7qK1Te8UWLxD9xbumtX11111',
'value': 32000,
'hour': 1
}
# 发送GET请求
response = requests.get(url, params=params)
# 打印响应信息
print("Response Code:", response.status_code)
print("Response Content:", response.text)
if __name__ == "__main__":
send_get_request()
<?php
// 设置要访问的URL
$url = 'https://web.apitrx.com/getenergy';
// 设置参数
$apiKey = '83928AFB-14A5-4878-A63D-128467830293';
$add = 'TX8BF429hr7qK1Te8UWLxD9xbumtX11111';
$value = 32000;
$hour = 1;
// 构建带参数的URL
$params = [
'apikey' => $apiKey,
'add' => $add,
'value' => $value,
'hour' => $hour
];
$urlWithParams = $url . '?' . http_build_query($params);
// 发送GET请求并获取响应内容
$response = file_get_contents($urlWithParams);
// 打印响应内容
echo $response;
?>
curl --location 'https://web.apitrx.com/getenergy?apikey=83928AFB-14A5-4878-A63D-128467830293&add=TX8BF429hr7qK1Te8UWLxD9xbumtX11111&value=33000&hour=1'