Skip to content

Transactions Query Language

Royalynx edited this page Jul 24, 2019 · 53 revisions

To expand opportunities of interaction with transactions you may use available parametres (separately or all together at once) below.

This parameters and filters are available for such endponts as:

  • /api/transactions
  • /api/blocks
  • /api/chat/get
  • /api/chatrooms

Filter variations

Filter by one parameter

If you need get list of transactions from list of transactions filtered by only one parameter you can send GET request to endpoint with determining ? and parameter at end. The parameter must have valid form and should not be empty.

Syntax:

GET http://[node address][endpoint]?parameter={parameter value}

Example

http://endless.adamant.im/api/transactions?fromHeight=10336065

Answer example

{
    "success": true,
    "nodeTimestamp": 59010663,
    "transactions": [{
        "id": "11412430180785882609",
        "height": 10336066,
        "blockId": "14278911529166118529",
        "type": 8,
        "timestamp": 59009692,
        "senderPublicKey": "aa8c981b599ac3a25500090cfac0422bc7577188d55d2dc6ca46705ca7e16601",
        "senderId": "U16909039249616710117",
        "recipientId": "U4849441878609670165",
        "recipientPublicKey": "300e2ccd4bff6304cd5bc94824c0f0d8e8693592f8deaa2b2b599ebb15f0232a",
        "amount": 0,
        "fee": 100000,
        "signature": "091e0b1cd2693ff7a87b4b80a4328a8ba16ad628705c4f652cec5ef0ec167c51e0c78bc4a4a8d2163c4972f201fccc971c87e7231e7f3bb895fd974cf135b000",
        "signatures": [],
        "confirmations": 193,
        "asset": {}
    }, {
        "id": "3410236652915779193",
        "height": 10336084,
        "blockId": "13281718967217294073",
        "type": 8,
        "timestamp": 59009780,
        "senderPublicKey": "300e2ccd4bff6304cd5bc94824c0f0d8e8693592f8deaa2b2b599ebb15f0232a",
        "senderId": "U4849441878609670165",
        "recipientId": "U16909039249616710117",
        "recipientPublicKey": "aa8c981b599ac3a25500090cfac0422bc7577188d55d2dc6ca46705ca7e16601",
        "amount": 0,
        "fee": 100000,
        "signature": "95a2af76e6c9b2c53c374d4c7f8a34e91ad25088a2e2c28b2ebad68cd4a54de4b92c25cd1e5db44879210249ee4f6724bd107befe5e969a08b5ca38b4f0e1105",
        "signatures": [],
        "confirmations": 175,
        "asset": {}
    }],
    "count": "2"
}

Filter by several parameters

If you need to get list of transactions filtered by any parameter from several you can use such case: send GET request to endpoint with determining ? and parameters joind by &. Parameters should not be empty and must have valid form.


NOTE

  • for endpoints /api/transactions and /api/blocks parameters joined by & will be combinated by logical or
  • for endpoints /api/chat/get and /api/chatrooms parameters joined by & will be combinated by logical and

Syntax:

GET http://[node address][endpoint]?parameter1={parameter1 value}&parameter2={parameter2 value}&parameter3={parameter3 value}...

Example

http://endless.adamant.im/api/transactions?fromHeight=10336065&blockId=7917597195203393333

Answer example

{
    "success": true,
    "nodeTimestamp": 59011159,
    "transactions": [{
        "id": "3410236652915779193",
        "height": 10336084,
        "blockId": "13281718967217294073",
        "type": 8,
        "timestamp": 59009780,
        "senderPublicKey": "300e2ccd4bff6304cd5bc94824c0f0d8e8693592f8deaa2b2b599ebb15f0232a",
        "senderId": "U4849441878609670165",
        "recipientId": "U16909039249616710117",
        "recipientPublicKey": "aa8c981b599ac3a25500090cfac0422bc7577188d55d2dc6ca46705ca7e16601",
        "amount": 0,
        "fee": 100000,
        "signature": "95a2af76e6c9b2c53c374d4c7f8a34e91ad25088a2e2c28b2ebad68cd4a54de4b92c25cd1e5db44879210249ee4f6724bd107befe5e969a08b5ca38b4f0e1105",
        "signatures": [],
        "confirmations": 273,
        "asset": {}
    }, {
        "id": "12810335978558620573",
        "height": 6091604,
        "blockId": "7917597195203393333",
        "type": 0,
        "timestamp": 37656340,
        "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
        "senderId": "U15423595369615486571",
        "recipientId": "U18322695495053155871",
        "recipientPublicKey": "51a0ade2c0184d0049130c06911bbf30dc79de715ba29b7496ab443cf49ea5d7",
        "amount": 10000000,
        "fee": 50000000,
        "signature": "1f615528f133cfaeb865b50954b5dcaaaf66d6a2746c0945d506dedb4e9b7de01317c205f832002efe5b50a7e6d5503c5b83b0eb5279caa90aea4c0cd499a00f",
        "signatures": [],
        "confirmations": 4244753,
        "asset": {}
    }, {
        "id": "11412430180785882609",
        "height": 10336066,
        "blockId": "14278911529166118529",
        "type": 8,
        "timestamp": 59009692,
        "senderPublicKey": "aa8c981b599ac3a25500090cfac0422bc7577188d55d2dc6ca46705ca7e16601",
        "senderId": "U16909039249616710117",
        "recipientId": "U4849441878609670165",
        "recipientPublicKey": "300e2ccd4bff6304cd5bc94824c0f0d8e8693592f8deaa2b2b599ebb15f0232a",
        "amount": 0,
        "fee": 100000,
        "signature": "091e0b1cd2693ff7a87b4b80a4328a8ba16ad628705c4f652cec5ef0ec167c51e0c78bc4a4a8d2163c4972f201fccc971c87e7231e7f3bb895fd974cf135b000",
        "signatures": [],
        "confirmations": 291,
        "asset": {}
    }],
    "count": "3"
}

Filter by several parameters at the same time

If you need to get list of transactions filtered by all parameters from several at simultaneously you may use send previous request case but instead & point &and: construction to join parameters. Parameters should not be empty and must have valid form.


NOTE

  • for endpoints /api/transactions and /api/blocks construction &and: works like logical and
  • for endpoints /api/chat/get and /api/chatrooms construction &and: works like logical or

Syntax:

GET http://[node address][api/transactions]?parameter1={parameter1 value}&and:parameter2={parameter2 value}&and:parameter3={parameter3 value}...

Example

http://endless.adamant.im/api/transactions?fromHeight=1336065&and:blockId=7917597195203393333

Answer example

{
    "success": true,
    "nodeTimestamp": 59011592,
    "transactions": [{
        "id": "12810335978558620573",
        "height": 6091604,
        "blockId": "7917597195203393333",
        "type": 0,
        "timestamp": 37656340,
        "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
        "senderId": "U15423595369615486571",
        "recipientId": "U18322695495053155871",
        "recipientPublicKey": "51a0ade2c0184d0049130c06911bbf30dc79de715ba29b7496ab443cf49ea5d7",
        "amount": 10000000,
        "fee": 50000000,
        "signature": "1f615528f133cfaeb865b50954b5dcaaaf66d6a2746c0945d506dedb4e9b7de01317c205f832002efe5b50a7e6d5503c5b83b0eb5279caa90aea4c0cd499a00f",
        "signatures": [],
        "confirmations": 4244841,
        "asset": {}
    }],
    "count": "1"
}

Available parameters for Transaction Filter

blockId

Purpose: show all transactions in block

Type: String

Example:http://endless.adamant.im/api/transactions?blockId=7917597195203393333

fromHeight

Purpose: show transactions starting from block with height

Type: Integer

Example:http://endless.adamant.im/api/transactions?fromHeight=10336065

toHeight

Purpose: show transactions ending at block with height

Type: Integer

Example:http://endless.adamant.im/api/transactions?toHeight=11

minAmount

Purpose: show transactions with amount not less than specified

Type: Integer value of 1/10^8 tokens (1 ADM = 100000000).

Example:http://endless.adamant.im/api/transactions?minAmount=1000000000000001

maxAmount

Purpose: show transactions with amount not more than specified.

Type: Integer value of 1/10^8 tokens (1 ADM = 100000000).

Example:http://endless.adamant.im/api/transactions?maxAmount=50000000

senderId

Purpose: show transactions sent from specified address

Type: String.

Example:http://endless.adamant.im/api/transactions?senderId=U15423595369615486571

recipientId

Purpose: show transactions sent to specified address

Type: String.

Example:http://endless.adamant.im/api/transactions?recipientId=U15423595369615486571

inId

Purpose: show transactions sent to or from specified address

Type: String.

Example:http://endless.adamant.im/api/transactions?inId=U100739400829575109

type

Purpose: show transactions with specified type or

Type: Number.


NOTE If type is not set, query will choose all types of transactions. You can learn more about ADAMANT transaction types in API-10.


Example:http://endless.adamant.im/api/transactions?type=8

Available parameters for Blocks Filter

blockId for block

Purpose: show all transactions in block

Type: String

Example:http://endless.adamant.im/api/transactions?blockId=7917597195203393333

generatorPublicKey

Purpose: returns blocks forged by delegate with pointed publicKey

Type: PublicKey of block generator

Example:http://endless.adamant.im/api/blocks?generatorPublicKey=150d638714f65845b50f1ff58f3da2c2baa3a1dc8bf59a9884c10da5a8e951c6

height

Purpose: show block with pointed height

Type: Integer

Example:http://endless.adamant.im/api/blocks?height=100

Available parameters for Chat Filter

fromHeight

Purpose: show chats starting from block with height

Type: Integer

Example:http://endless.adamant.im/api/chats/get?fromHeight=10336065

toHeight

Purpose: show chats ending at block with height

Type: Integer

Example:http://endless.adamant.im/api/chats/get?toHeight=11

senderId

Purpose: show chats sent from specified address

Type: String.

Example:http://endless.adamant.im/api/chats/get?senderId=U15423595369615486571

recipientId

Purpose: show chats sent to specified address

Type: String.

Example:http://endless.adamant.im/api/chats/get?recipientId=U15423595369615486571

type

Purpose: show chats with specified type of message

Type: Number.


NOTE If type is not set, query will choose all types of messages. Learn more about ADAMANT messages types.


Example #1: http://endless.adamant.im/api/chats/get?type=2

Example #2: https://endless.adamant.im/api/chatrooms/U17362714543155685887/U17819800352812315500?type=2

Available options

Additionall request options

limit

Purpose: Limit of transactions count returned in response. Default is 25.

Type: Number

Example:http://endless.adamant.im/api/transactions?limit=2

offset

Purpose: Offset to returned transactions list. Default is 0.

Type: Number

Example:http://endless.adamant.im/api/blocks?Offset=1

orderBy

Purpose: ordering transactions by specified parameter by desc or asc. Default is timestamp:desc

Type: String


NOTE Between parameters type and orderBy need to set ":" sign


Example:http://endless.adamant.im/api/transactions?orderBy=timestamp:desc

withoutDirectTransfers


NOTE Available for /api/chatrooms and /api/chats/get endponts only


Purpose: returns transactions with type=8 if set withoutDirectTransfers=true. Default false

Type: String

Example:https://endless.adamant.im/api/chatrooms/U2707535059340134112?withoutDirectTransfers=true

Clone this wiki locally