Skip to content

List Orders

This endpoint retrieves a list of energy orders. You can apply filters to narrow down the results.

Endpoint

POST /orders/list

Headers

Ensure the following headers are included in your request:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer {TOKEN}
  • X-Txc-Signature: {SIGN}

Request Body

The following filters can be applied to the request:

FieldTypeDescription
statusintStatus of the orders.
wallet_tostringTRON address associated with the order.
finished_at_fromdatetimeStart of the finished date range.
finished_at_todatetimeEnd of the finished date range.

Example Request Body

json
{
  "status": 6,
  "wallet_to": "TG5uzYC9uc...",
  "finished_at_from": "2024-09-01T00:00:00Z",
  "finished_at_to": "2024-09-30T23:59:59Z"
}

Example Request

PHP
php
// Replace these with your actual data
$url = "https://dev-site.evelar.energy/api/v1/orders/list";
$token = "YOUR_TOKEN";
$secret = "MYSECRET";
$body = json_encode([
    "status" => 6,
    "wallet_to" => "TG5uzYC9uc...",
    "finished_at_from" => "2024-09-01T00:00:00Z",
    "finished_at_to" => "2024-09-30T23:59:59Z"
]);

// Generate the signature
$sign = hash('sha256', $body . $secret);

// Headers
$headers = [
    "Content-Type: application/json",
    "Accept: application/json",
    "Authorization: Bearer $token",
    "X-Txc-Signature: $sign"
];

// Initialize cURL
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

// Execute request and get the response
$response = curl_exec($ch);
curl_close($ch);

// Output response
echo $response;
Python
python
import requests
import hashlib
import json

url = "https://dev-site.evelar.energy/api/v1/orders/list"
token = "YOUR_TOKEN"
secret = "MYSECRET"
body = json.dumps({
    "status": 6,
    "wallet_to": "TG5uzYC9uc...",
    "finished_at_from": "2024-09-01T00:00:00Z",
    "finished_at_to": "2024-09-30T23:59:59Z"
})

# Generate the signature
sign = hashlib.sha256((body + secret).encode('utf-8')).hexdigest()

# Headers
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": f"Bearer {token}",
    "X-Txc-Signature": sign
}

# Make the request
response = requests.post(url, headers=headers, data=body)
print(response.json())
Node.js
javascript
const axios = require('axios');
const crypto = require('crypto');

const url = "https://dev-site.evelar.energy/api/v1/orders/list";
const token = "YOUR_TOKEN";
const secret = "MYSECRET";
const body = JSON.stringify({
    status: 6,
    wallet_to: "TG5uzYC9uc...",
    finished_at_from: "2024-09-01T00:00:00Z",
    finished_at_to: "2024-09-30T23:59:59Z"
});

// Generate the signature
const sign = crypto.createHash('sha256').update(body + secret).digest('hex');

// Headers
const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": `Bearer ${token}`,
    "X-Txc-Signature": sign
};

// Make the request
axios.post(url, body, { headers })
    .then(response => console.log(response.data))
    .catch(error => console.error(error));
Bash
bash
url="https://dev-site.evelar.energy/api/v1/orders/list"
token="YOUR_TOKEN"
secret="MYSECRET"
body='{"status":6,"wallet_to":"TG5uzYC9uc...","finished_at_from":"2024-09-01T00:00:00Z","finished_at_to":"2024-09-30T23:59:59Z"}'

# Generate the signature
sign=$(echo -n "$body$secret" | openssl dgst -sha256 -hex | awk '{print $2}')

# Make the request
curl -X POST $url \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $token" \
  -H "X-Txc-Signature: $sign" \
  -d "$body"

Example Response

json
{
   "code": 0,
   "result": {
       "count": 4,
       "next": "",
       "previous": "",
       "results": [
           {
               "id": "4694d23c-39da-4c5e-ad3b-9540e6e1d397",
               "created_at": "2024-09-23T08:12:00Z",
               "status": 6,
               "wallet_to": "TG5uzYC9uc...",
               "amount": 7000,
               "delegated": 0,
               "reclaimed": 0,
               "duration": 1,
               "finished_at": "2024-09-24T08:12:00Z",
               "user_id": 3
           }
       ]
   }
}

Response Fields

FieldTypeDescription
countintTotal number of matching orders.
nextstringURL for the next page of results.
previousstringURL for the previous page of results.
resultsarrayList of orders.
idstringUnique ID of the order.
created_atdatetimeDate and time the order was created.
statusintCurrent status of the order.
wallet_tostringTRON address associated with the order.
amountintAmount of energy in the order.
delegatedintAmount of energy delegated.
reclaimedintAmount of energy reclaimed.
durationintDuration of the order in days.
finished_atdatetimeDate and time the order was finished.
user_idintID of the user associated with the order.