# query purchase order

### &#x20;Endpoint usage

<mark style="color:green;">`POST`</mark> `https://open.tronify.io/api/tronRent/trades`

The fields with \* are required, and the fields without \* are optional

#### Request Body

| Name                                         | Type    | Description                                                                                                                                                                    |
| -------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| sort<mark style="color:red;">\*</mark>       | String  | <p>0：sorted by time in reverse order <br>1：sorted by energy and bandwidth in reverse order <br>2：sorted by amount in reverse order <br>3：sorted by energy in reverse order</p> |
| sourceFlag<mark style="color:red;">\*</mark> | String  | Source channel (Both sides need to agree on a name to represent the channel of the third parties)                                                                              |
| page<mark style="color:red;">\*</mark>       | Integer | page num                                                                                                                                                                       |
| pageSize<mark style="color:red;">\*</mark>   | Integer | record size                                                                                                                                                                    |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "data": [
            {
                "orderId": "2ombu8zk_3jet_0mle_g7id_2mi3gnl6fk4y",
                "fromAddress": "TW7XuicuiQSHCcodUkyjMfdWxnWsbZmiSS",
                "pledgeAddress": "TW7XuicuiQSHCcodUkyjMfdWxnWsbZmiSS",
                "pledgeNum": 555,
                "salePledgeNum": 0,
                "freezePledgeNum": 0,
                "canSaleTrxNum": 0.128205,
                "leftPledgeTrxNum": 30.67,
                "leftPledgeNum": 555,
                "orderPrice": "110",
                "orderType": "ENERGY",
                "pledgeDay": "3",
                "createTime": "2023-04-11 16:29:55",
                "lowSaleTrxNum": 0.11549999999999999,
                "lowTRXCanBuy": 27.63,
                "lowCanBuy": 500,
                "AnnualizedRate": 50
            }
        ],
        "pagination": {
            "page": 1,
            "pageSize": 10,
            "total": 1
        }
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### code example

{% tabs %}
{% tab title="JavaScript" %}

```
// example
const params = {
    sort: '1',
    page: 1,
    pageSize: 10,
    sourceFlag: 'tronLink'
}
 const res = await axios.post('https://open.tronify.io/api/tronRent/trades',params)
 console.log(res)
 if(res.resCode === '100'){
   //...  
 }
```

{% endtab %}
{% endtabs %}

### Postman example

<figure><img src="https://3188465811-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnv0Qbx2yTtH3TKQFd528%2Fuploads%2F5TYUEThaPSGrtDSHCleU%2F7.jpg?alt=media&#x26;token=e6e0eaa2-9080-438a-9089-7da4845adb7e" alt=""><figcaption></figcaption></figure>
