POST https://api.tronmart.net/v1/Order/Create
Field | Type | Description |
---|---|---|
resource_type | integer | 0 … bandwidth 1 … energy only 1 is allowed now |
receive_address | string | Resource receiving address |
resource_value | integer | The number of resources to rent |
rent_duration | integer | 1 – 23 for 'h' 1 – 30 for 'd' 1200 - etc. for 'T' (20 tron time units equals 1 minute) |
rent_time_unit | char | 'h' … hour 'd' … day 'T' … tron time unit |
{
"resource_type": 1,
"receive_address": "HCjRQtYH..................KHUarM3w",
"resource_value": 32000,
"rent_duration": 1,
"rent_time_unit": "h"
}
Field | Type | Description |
---|---|---|
code | string | The return code of the request call, the list of error codes is here |
msg | string | Detailed information about a possible error |
errors | array | Detailed information on errors |
request_id | string | An internal request identifier that is used to identify the request in case of problems |
data | json | Order details, details is here |
{
"code": "Success",
"msg": "Success",
"errors": [],
"request_id": "e98e15e4-ea49-45e1-a37e-c71ee72775bf",
"data": {
"order_no": "0010a464-b5be-4047-ab53-66fcc2178e62",
"resource_type": 1,
"receivers": [
{
"receive_address": "HCjRQtYH..................KHUarM3w",
"resource_value": 32000,
"price_in_sun": 95,
"fixed_tax": 0.560000,
"price": 3.600000
}
],
"create_time": 1715437599596,
"expire_time": 1715523999596,
"settle_address": "YEg7yUff..................72j78oH4",
"resource_value": 32000,
"resource_split_value": 1000000,
"rent_duration": 1200,
"rent_time_unit": "T",
"frozen_balance": null,
"payment_address": "TThsE7hE..................r1dEF4zH",
"pay_amount": 3.600000,
"pay_time": null,
"refund_tx_id": null,
"refund_time": 0,
"refund_amount": 0,
"refund_status": null,
"status": "New",
"sub_order": null
}
}
POST /v1/Order/Create HTTP/1.1
Host: api.tronmart.net
key: C2CC6C80-B86A-4E08-AE69-E28DA009A50F
Content-Type: application/json
{
"resource_type": 1,
"receive_address": "HCjRQtYH..................KHUarM3w",
"resource_value": 32000,
"rent_duration": 1,
"rent_time_unit": "h"
}
curl -X POST https://api.tronmart.net/v1/Order/Create
-H 'Content-Type: application/json'
-H 'key: C2CC6C80-B86A-4E08-AE69-E28DA009A50F'
-d '{
"resource_type": 1,
"receive_address": "HCjRQtYH..................KHUarM3w",
"resource_value": 32000,
"rent_duration": 1,
"rent_time_unit": "h"
}'
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.tronmart.net/v1/Order/Create");
request.Headers.Add("key", "C2CC6C80-B86A-4E08-AE69-E28DA009A50F");
var content = new StringContent("{\r\n \"resource_type\": 1,\r\n \"receive_address\": \"HCjRQtYH..................KHUarM3w\",\r\n \"resource_value\": 32000,\r\n \"rent_duration\": 1,\r\n \"rent_time_unit\": \"h\"\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"resource_type\": 1,\r\n \"receive_address\": \"HCjRQtYH..................KHUarM3w\",\r\n \"resource_value\": 32000,\r\n \"rent_duration\": 1,\r\n \"rent_time_unit\": \"h\"\r\n}");
Request request = new Request.Builder()
.url("https://api.tronmart.net/v1/Order/Create")
.method("POST", body)
.addHeader("key", "C2CC6C80-B86A-4E08-AE69-E28DA009A50F")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.tronmart.net/v1/Order/Create"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"resource_type": 1,`+"
"+`
"receive_address": "HCjRQtYH..................KHUarM3w",`+"
"+`
"resource_value": 32000,`+"
"+`
"rent_duration": 1,`+"
"+`
"rent_time_unit": "h"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("key", "C2CC6C80-B86A-4E08-AE69-E28DA009A50F")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}