Skip to main content
POST
/
api
/
v1
/
api
/
order
/
getEnergyMaxCount
获取商户能量最大可租赁笔数
curl --request POST \
  --url https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount \
  --header 'Content-Type: <content-type>' \
  --header 'X-API-KEY: <x-api-key>' \
  --data 'data=U2FsdGVkX1+Jfz0VjXJbZ0tZz8G8v4w3Z2jWkT...'
import requests

url = "https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount"

payload = { "data": "U2FsdGVkX1+Jfz0VjXJbZ0tZz8G8v4w3Z2jWkT..." }
headers = {
"Content-Type": "<content-type>",
"X-API-KEY": "<x-api-key>"
}

response = requests.post(url, data=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', 'X-API-KEY': '<x-api-key>'},
body: new URLSearchParams({data: 'U2FsdGVkX1+Jfz0VjXJbZ0tZz8G8v4w3Z2jWkT...'})
};

fetch('https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount', 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://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "data=U2FsdGVkX1%2BJfz0VjXJbZ0tZz8G8v4w3Z2jWkT...",
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"X-API-KEY: <x-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"
"strings"
"net/http"
"io"
)

func main() {

url := "https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount"

payload := strings.NewReader("data=U2FsdGVkX1%2BJfz0VjXJbZ0tZz8G8v4w3Z2jWkT...")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("X-API-KEY", "<x-api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount")
.header("Content-Type", "<content-type>")
.header("X-API-KEY", "<x-api-key>")
.body("data=U2FsdGVkX1%2BJfz0VjXJbZ0tZz8G8v4w3Z2jWkT...")
.asString();
require 'uri'
require 'net/http'

url = URI("https://waas2-out-api.powersafe-rel.cc/api/v1/api/order/getEnergyMaxCount")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["X-API-KEY"] = '<x-api-key>'
request.body = "data=U2FsdGVkX1%2BJfz0VjXJbZ0tZz8G8v4w3Z2jWkT..."

response = http.request(request)
puts response.read_body
{
  "code": 0,
  "message": "",
  "data": "gwgguizKfpnzkvgotgLZD126qlI69oicjKhaVuyCaa4ZPYYxhDUIu2...."
}

API Description

This interface is designed to query the ​​maximum number of leaseable energy transactions​​ that a merchant can support, based on their current energy holdings. The result is calculated using the merchant’s ​​real-time energy balance​​ and their ​​pre-configured energy cost per transaction​​.

Headers

Content-Type
string
required

必须设置为 application/x-www-form-urlencoded

X-API-KEY
string
required

平台分配的商户身份凭证

Example:

"53af2797-3eca-4412-b0cc-15273afe2d3e"

Body

application/x-www-form-urlencoded
data
string
required

Base64编码的RSA加密数据,由以下原始参数加密生成:

symbol (string): 资源类型标识。当前固定填写 "ENERGY",代表查询波场能量资源。未来若支持带宽(Bandwidth)等资源,可传入其他值。

chainName (string): 区块链网络名称。当前固定填写 "TRON",代表查询波场网络资源。

Pattern: ^[A-Za-z0-9+/]+={0,2}$
Example:

"U2FsdGVkX1+Jfz0VjXJbZ0tZz8G8v4w3Z2jWkT..."

Response

成功响应

code
integer
required

业务状态码(0 = 成功),其他值均表示失败。

Example:

0

message
string
required

正常情况下返回为空,当请求失败时则会返回错误信息。

Example:

""

data
string
required

Base64编码的RSA加密数据,由以下原始参数加密生成:

chainName (string): 区块链网络名称。固定返回"TRON",表示当前查询的资源属于波场网络。

symbol (string): 资源类型标识符。固定返回"ENERGY",表示当前查询的资源类型为能量。

energyMaxCount (integer): 商户当前最大可租赁能量笔数。该数值根据公式计算得出:

可用总能量值 / 商户预设单笔能量成本(向下取整)。

Example:

"G+RlQN2lJ4qQtiXJC7Y6rgHm5UI7GIv+6FNyY/yyN30N7EaBA==...."