Skip to content

Abonnement-Verlauf

Gibt den Verlauf aller Benutzer-Abonnements mit Unterstützung für Seitenaufteilung und Status-Filterung zurück.

POST /v1/subscriptions/history

Anfrage

Alle Parameter sind optional. Wenn keine Parameter angegeben werden, wird die erste Seite mit 10 Elementen zurückgegeben.

Anfrage-Parameter

FeldTypErforderlichBeschreibung
pageintegerNeinSeitennummer (Standard: 1, Minimum: 1)
per_pageintegerNeinElemente pro Seite (Standard: 10, Maximum: 50)
statusstringNeinNach Abonnement-Status filtern
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{
  "page": 1,
  "per_page": 10,
  "status": "active"
}'

# Calculate signature
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)

# Execute API request
curl -X POST "https://api.tronzap.com/v1/subscriptions/history" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "X-Signature: ${SIGNATURE}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}"
javascript
const crypto = require('crypto');
const axios = require('axios');

const apiToken = 'your_api_token';
const apiSecret = 'your_api_secret';
const requestBody = JSON.stringify({
  page: 1,
  per_page: 10,
  status: 'active'
});

// Calculate signature
const signature = crypto
  .createHash('sha256')
  .update(requestBody + apiSecret)
  .digest('hex');

// Execute API request
axios({
  method: 'post',
  url: 'https://api.tronzap.com/v1/subscriptions/history',
  headers: {
    'Authorization': `Bearer ${apiToken}`,
    'X-Signature': signature,
    'Content-Type': 'application/json'
  },
  data: requestBody
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
php
<?php
$apiToken = 'your_api_token';
$apiSecret = 'your_api_secret';
$requestBody = json_encode([
  'page' => 1,
  'per_page' => 10,
  'status' => 'active'
]);

// Calculate signature
$signature = hash('sha256', $requestBody . $apiSecret);

// Execute API request
$ch = curl_init('https://api.tronzap.com/v1/subscriptions/history');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer ' . $apiToken,
  'X-Signature: ' . $signature,
  'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
python
import hashlib
import json
import requests

api_token = 'your_api_token'
api_secret = 'your_api_secret'
request_body = json.dumps({
  'page': 1,
  'per_page': 10,
  'status': 'active'
})

# Calculate signature
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()

# Execute API request
headers = {
  'Authorization': f'Bearer {api_token}',
  'X-Signature': signature,
  'Content-Type': 'application/json'
}

response = requests.post(
  'https://api.tronzap.com/v1/subscriptions/history',
  headers=headers,
  data=request_body
)

print(response.json())

Beispiel-Anfrage ohne Parameter

bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{}'

# Calculate signature
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)

# Execute API request
curl -X POST "https://api.tronzap.com/v1/subscriptions/history" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "X-Signature: ${SIGNATURE}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}"

Antwort

Die Antwort enthält eine Liste der Benutzer-Abonnements mit Seitenaufteilungsinformationen.

Antwort-Felder

FeldTypBeschreibung
codeintegerAntwortcode (0 = erfolgreich)
request_idstringEindeutiger Anfrage-Bezeichner
resultobjectAntwortdaten
result.pageintegerAktuelle Seite
result.per_pageintegerElemente pro Seite
result.totalintegerGesamtanzahl der Abonnements
result.itemsarrayListe der Abonnements
result.items[].idstringAbonnement-ID
result.items[].statusstringAbonnement-Status
result.items[].subscription_idstringAbonnement-Typ-ID
result.items[].addressstringTRON-Adresse
result.items[].transactions_limitintegerTransaktionslimit
result.items[].transactions_usedintegerVerwendete Transaktionen
result.items[].energy_usedintegerVerwendete Energie
result.items[].total_pricefloatGesamtkosten
result.items[].started_atstring|nullStartdatum (ISO 8601 Format)
result.items[].renewed_atstring|nullVerlängerungsdatum (ISO 8601 Format)
result.items[].stopped_atstring|nullStoppdatum (ISO 8601 Format)
result.items[].expire_atstring|nullAblaufdatum (ISO 8601 Format)
result.items[].created_atstringErstellungsdatum (ISO 8601 Format)

Antwort-Beispiel

json
{
  "code": 0,
  "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
  "result": {
    "page": 1,
    "per_page": 10,
    "total": 1,
    "items": [
      {
        "id": "01k33rz57drtqgqcedyn9tvk04",
        "status": "active",
        "subscription_id": "unlimited_energy",
        "address": "TPY1Kb8cKAZQfm95gXQQs2Mh8Uygtos21D",
        "transactions_limit": 0,
        "transactions_used": 2,
        "energy_used": 131000,
        "total_price": "8.00",
        "started_at": "2025-08-20T12:58:52+00:00",
        "renewed_at": null,
        "stopped_at": null,
        "expire_at": "2025-08-21T12:58:52+00:00",
        "created_at": "2025-08-20T12:58:52+00:00"
      },
      {
        "id": "01k36gw6cbfx4r8jhvd1qyp697",
        "status": "stopped",
        "subscription_id": "energy_pay_per_use",
        "address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
        "transactions_limit": 100,
        "transactions_used": 45,
        "energy_used": 2991000,
        "total_price": 184.0,
        "started_at": "2024-02-15T10:30:00Z",
        "renewed_at": null,
        "stopped_at": "2024-03-20T14:25:00Z",
        "expire_at": null,
        "created_at": "2024-02-15T10:25:00Z"
      }
    ]
  }
}

Mögliche Abonnement-Status

StatusBeschreibung
newNeues Abonnement
pendingWartendes Abonnement
errorFehlerhaftes Abonnement
activeAktives Abonnement
stoppedGestopptes Abonnement
expiredAbgelaufenes Abonnement

Mögliche Fehler

FehlercodeKeyBeschreibung
1authAuthentifizierungsfehler (ungültiger Token oder Signatur)
2invalid_service_or_paramsUngültiger Service oder Parameter
500internal_server_errorInterner Serverfehler

Tron Energy API Documentation