Transaction history API does not work (api/v1/transaction, api/txs/histories) [solved, wrong parameters 🙂]


#1

I am building a tiny service that watch transactions and insert new transactions into the digital asset exchange system.

please anyone can give me a sample usage of those APIs?

I have tried below…

wallet_id: data.id from /api/v1/wallets

curl -k https://127.0.0.1:8090/api/v1/transactions \
-H "Accept: application/json; charset=utf-8" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{"wallet_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}'
curl -k https://127.0.0.1:8090/api/v1/transactions \
-H "Accept: application/json; charset=utf-8" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{"address": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}'

#2

Hi! You are sending GET request, but passing parameters in the request body with the -d parameter, like for a PUT or POST request. Try calling it like this:

curl -k 'https://127.0.0.1:8090/api/v1/transactions?wallet_id=XXXXX' \
-H "Accept: application/json; charset=utf-8" \
-H "Content-Type: application/json; charset=utf-8"

Also, note that wallet_id is always required. So even if you are trying to pass a specific address - you also need to pass the wallet.


#3

U R my hero! Thank you! Problem solved!


#4

Please teach me how to sort list

// working but not sorted
$ curl -k https://127.0.0.1:8090/api/v1/transactions?wallet_id=xxx&sort_by=created_at
$ curl -k https://127.0.0.1:8090/api/v1/transactions?wallet_id=xxx&sort_by=DES[created_at]

// not working
// {"status":"error","diagnostic":{"params":[["wallet_id","WalletId"]]},"message":"MissingRequiredParams"}
$ curl -k https://127.0.0.1:8090/api/v1/transactions?sort_by=created_at&wallet_id=xxx

#5

You need to enclose the URL with parameters in quotes, like this:

$ curl -k "https://127.0.0.1:8090/api/v1/transactions?wallet_id=xxx&sort_by=created_at"
$ curl -k "https://127.0.0.1:8090/api/v1/transactions?sort_by=created_at&wallet_id=xxx"

Then these two lines should work. I don’t know what’s the DES[created_at] - I think there’s no allowed value like this for this parameter.

Note: that sorting is descending by default: