API Intergration for TR.ENERGY
What is an API key and why does Tr.energy need it?
An API key is a special authentication mechanism used to ensure the security of the Tr.energy API service and prevent unauthorized access to your data. This is a unique string that the system generates and assigns to each user to confirm their legitimacy when accessing the API. Users are required to include an API key in the header of their requests to prove their identity. This prevents possible malicious attacks and abuses, protecting the integrity and functionality of our system.
How to get API key
1. Log in to the system and go to the Settings page in the API section.
2. Click the "Generate" button to get key. Then, the system will generate a unique API key for you.
3. Copy the generated API key to your application to authenticate your identity when calling the Tr.energy API service.
4. Follow the link to learn how to interact with our API.
Notes
1. Do not share your API key with anyone to prevent unwanted use of it.
2. If your API key is lost or leaked, please contact our customer support - [email protected]
3. If you need further assistance or encounter any problem, please email us - [email protected]
1. AUTHORIZATION
It happens automatically when using API key in the header (Bearer Token).
2. BALANCE CHECK
Use method GET 1.1. Show
3. TOP UP
Use method GET 1.2. Top up
4. CREATING AN ENERGY ORDER
Use method GET 2.2. Create
5. DISPLAYING THE LIST OF ENERGY CONSUMERS
(These are the wallets to which energy is delegated.)
To display 1 address use method GET 2.3. Show
To display all addresses use method GET 2.1. Index
6. UPDATING DATA OF ENERGY CONSUMERS
(You can change consumer name, energy quantity, energy lease period, consumer type: dynamic/static, auto-renewal status)
Use method PATCH 2.7. Update
Auto-renewal function - POST 2.9. Toggle Auto Renewal
7. ACTIVATION OF ENERGY ORDER
Use method POST 2.4. Activate
8. DEACTIVATING AN ENERGY ORDER
Use method POST 2.5. Deactivate
9. REMOVING AN ENERGY CONSUMER
Use method DELETE 2.8. Destroy
How to implement the work of transit wallets with TR.ENERGY
You create a new wallet in your system, accept cryptocurrency from clients there, check the purity" of the transaction. If you are satisfied with the result, you can send these funds to your main wallet. For one transaction, 64k-130k of energy is enough (depending on the load of the TRON network)
To do this, you need to create an energy order on this wallet
We use method POST 2.2. Create. Create a request with the following parameters:
{
"payment_period": 1,
"address": "TY3dRk4eQ75dCrW7tUcCzggU9rnz4V111",
"auto_renewal": 0,
"consumption_type": 1,
"resource_amount": 70000,
"name": "transit-TY3dR"
}
Receive a response to the request
{
"data": {
"id": 1,
"name": "transit-TY3dR",
"address": "TY3dRk4eQ75dCrW7tUcCzggU9rnz4V1111",
"resource_amount": "70000",
"creation_type": 2,
"consumption_type": 1,
"payment_period": 1,
"auto_renewal": false,
"resource_consumptions": null,
"is_active": false,
"order": null,
"created_at": "30-10-2023 06:58:17",
"updated_at": "30-10-2023 06:58:17"
},
"status": true
}
Then activate the order based on the received data
create a request POST 2.4. Activate with the following parameters:
core.tr.energy/api/consumers/{ID_your_consumer}/activate
If the balance is sufficient, wait a few minutes for the energy to fill up and you can make the transfer.