获取订单详情
使用订单的 orderId 获取特定订单的详细信息和当前状态。
Last updated
{
"error": false,
"message": "Success",
"data": {
"id": string, // id of order
"requester": string, // the address represents the order owner
"receiver": string, // the address of the resource that is received
"resourceAmount": number, // the amount of resource
"resourceType": string, // the resource type is "ENERGY" or "BANDWIDTH"
"remainAmount": number, // the remaining amount can be matched by the system,
"price": number, // price unit is equal to SUN
"durationSec": number, // rent duration, duration unit is equal to seconds
"orderType": string, // type of order is "NORMAL" or "EXTEND"
"allowPartialFill": boolean, //Allow the order to be filled partially or not
"payoutAmount": number, // Total payout of this order
"fulfilledPercent": number, //The percent that shows filling processing. 0-100
"delegates": [ //All matched delegates for this order
{
"delegator": string, // The address that delegates the resource for the target address
"amount": number, //The amount of resource was delegated
"txid": number // The transaction ID in on-chain
}
]
}
}{
"error": false,
"message": "Success",
"data": {
"id": "6819c7578729a45600f740d1",
"requester": "TFwUFWr3QV376677Z8VWXxGUAMFSSSSSS",
"receiver": "TFwUFWr3QV376677Z8VWXxGUAMFSSSSSSS",
"resourceAmount": 32000,
"resourceType": "ENERGY",
"remainAmount": 0,
"price": 90,
"durationSec": 300,
"orderType": "NORMAL",
"allowPartialFill": false,
"payoutAmount": 2880000,
"fulfilledPercent": 100,
"delegates": [
{
"delegator": "THnnMCe67VMDXoivepiA7ZQSB888888",
"amount": 32000,
"txid": "19d3fa76a722d6d6e671e6141eb8057760d38d42b353153a3825f19a7d34326f"
}
]
}
}{
"error": true,
"message": "TSAS:106 API_KEY_REQUIRED",
"data": null
}{
"error": true,
"message": "TSAS:107 INVALID_API_KEY",
"data": null
}{
"message": "Route GET:/v2/order/ not found",
"error": "Not Found",
"statusCode": 404
}curl -X GET "https://api.tronsave.io/v2/order/YOUR_ORDER_ID" \
-H "apikey: YOUR_API_KEY"const TRONSAVE_API_URL = "https://api.tronsave.io";
const getOrderDetails = async (apiKey, orderId) => {
const url = `${TRONSAVE_API_URL}/v2/order/${orderId}`;
const res = await fetch(url, {
headers: {
apikey: apiKey,
},
});
return res.json();
};
getOrderDetails("YOUR_API_KEY", "YOUR_ORDER_ID").then(console.log);import requests
TRONSAVE_API_URL = "https://api.tronsave.io"
API_KEY = "YOUR_API_KEY"
def get_order_details(order_id: str) -> dict:
"""Get order details by orderId."""
url = f"{TRONSAVE_API_URL}/v2/order/{order_id}"
headers = {"apikey": API_KEY}
response = requests.get(url, headers=headers)
return response.json()
print(get_order_details("YOUR_ORDER_ID"))import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class GetOrderDetails {
static final String TRONSAVE_API_URL = "https://api.tronsave.io";
static final String API_KEY = "YOUR_API_KEY";
public static void main(String[] args) throws Exception {
String orderId = "YOUR_ORDER_ID";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(TRONSAVE_API_URL + "/v2/order/" + orderId))
.header("apikey", API_KEY)
.GET()
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}package main
import (
"fmt"
"io"
"net/http"
)
const (
tronsaveAPIURL = "https://api.tronsave.io"
apiKey = "YOUR_API_KEY"
)
func main() {
orderID := "YOUR_ORDER_ID"
req, err := http.NewRequest(http.MethodGet, tronsaveAPIURL+"/v2/order/"+orderID, nil)
if err != nil {
panic(err)
}
req.Header.Set("apikey", apiKey)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}use serde_json::Value;
const TRONSAVE_API_URL: &str = "https://api.tronsave.io";
const API_KEY: &str = "YOUR_API_KEY";
fn main() -> Result<(), Box<dyn std::error::Error>> {
let order_id = "YOUR_ORDER_ID";
let client = reqwest::blocking::Client::new();
let resp: Value = client
.get(format!("{TRONSAVE_API_URL}/v2/order/{order_id}"))
.header("apikey", API_KEY)
.send()?
.json()?;
println!("{resp:#?}");
Ok(())
}