BlinkTradeJS icon indicating copy to clipboard operation
BlinkTradeJS copied to clipboard

Ability to get single withdrawal by Id

Open zackulrichAC opened this issue 6 years ago • 6 comments

Is it possible to fetch a single withdrawal using it's id, instead of having to fetch a list? I can't see anyway to do this in the docs currently.

zackulrichAC avatar Apr 18 '18 22:04 zackulrichAC

The way that we do is basically sending a filter parameter when fetching a list, this is already implemented on our next version on the development branch (here), i'm not sure why this isn't implemented before, would you mind to try the development version?

Would be something like this:

blinktrade.requestWithdrawList({
  filter: ['WITHDRAW_ID']
})

There's no much breaking changes on our next version, but if you have more time, i will add those parameters on the current version as soon as possible, until we don't release v0.1.0

cesardeazevedo avatar Apr 18 '18 22:04 cesardeazevedo

Yes that is exactly the functionality I'm looking for. My implementation is being done in java, so I can't unfortunately try out the JS branch, but would be happy to implement and test once it's available through the https://api_testnet.blinktrade.com/tapi/v1/message and https://api.blinktrade.com/tapi/v1/message endpoints. Any timeframe on when the change will be released there?

zackulrichAC avatar Apr 19 '18 01:04 zackulrichAC

Oh, i got it, the Filter is already available, i just didn't put on the JS client, essentially you just have to pass a Filter: ['WITHDRAW_ID'] on the message.

This is a valid message that you can send, 1166 is the withdraw id

{
  "MsgType": "U26",
  "WithdrawListReqID": 1873076,
  "Page": 0,
  "PageSize": 20,
  "StatusList": [],
  "Filter": ["1166"],
}

Let me know if you got it.

cesardeazevedo avatar Apr 19 '18 02:04 cesardeazevedo

I was able to successfully use the filter but the response format I'm getting back does not match the API docs. Is this the actual expected response? I was expecting it to be formatted as described here: https://blinktrade.com/docs/#withdrawals

    "Status": 200,
    "Description": "OK",
    "Responses": [
    {
        "WithdrawListReqID": 1234,
        "PageSize": 20,
        "WithdrawListGrp": [
            [1432, "TestMethod", "USD", 10000000000,
            {
                "Currency": "USD",
                "Memo": "test withdrawal",
                "Nome": "Zack",
                "Instant": "NO",
                "Fees": "$ 1.00"
            }, "2018-04-19 18:59:55", "2", null, null, 1.0, 0, 10100000000, 90804969, "zulrich", 5, null, "2018-04-19 19:01:13"]
        ],
        "MsgType": "U27",
        "Page": 0,
        "Columns": ["WithdrawID", "Method", "Currency", "Amount", "Data", "Created", "Status", "ReasonID", "Reason", "PercentFee", "FixedFee", "PaidAmount", "UserID", "Username", "BrokerID", "ClOrdID", "LastUpdate"]
    }]
}

zackulrichAC avatar Apr 19 '18 19:04 zackulrichAC

Yes, this is the format directly from the API.

The response described on the documentation is formatted by the JS client for better convenient and readability, i put a notice on the docs, but it's indeed doesn't help you if you are not using the JS client.

NOTE We aimed to design a concise API by returning a JSON format that can be slightly different from the > original WebSocket response. These returns aims to increase readability and avoid complexity of the > JSON, some returns such arrays of arrays and a Columns field that describes each array position, > are already formatted for you.

cesardeazevedo avatar Apr 19 '18 19:04 cesardeazevedo

Gotcha. Ok I'll be able to handle the response. I don't think the filter is working on the testnet currently though. I'm getting 2 objects returned instead of just the one. This is my request

{
    "MsgType": "U26",
    "WithdrawListReqID": 1234,
    "Filter": ["1432"],
    "StatusList": []
}

and this is my response

{
    "Status": 200,
    "Description": "OK",
    "Responses": [
    {
        "WithdrawListReqID": 1234,
        "PageSize": 20,
        "WithdrawListGrp": [
            [1434, "TestMethod", "USD", 20000000000,
            {
                "Memo": "asdf",
                "Nome": "asdf",
                "Instant": "NO",
                "Fees": "$ 2.00"
            }, "2018-04-19 19:18:21", "1", null, null, 1.0, 0, 20200000000, 90804969, "zulrich", 5, null, "2018-04-19 19:18:21"],
            [1432, "TestMethod", "USD", 10000000000,
            {
                "Currency": "USD",
                "Memo": "test withdrawal",
                "Nome": "Zack",
                "Instant": "NO",
                "Fees": "$ 1.00"
            }, "2018-04-19 18:59:55", "2", null, null, 1.0, 0, 10100000000, 90804969, "zulrich", 5, null, "2018-04-19 19:01:13"]
        ],
        "MsgType": "U27",
        "Page": 0,
        "Columns": ["WithdrawID", "Method", "Currency", "Amount", "Data", "Created", "Status", "ReasonID", "Reason", "PercentFee", "FixedFee", "PaidAmount", "UserID", "Username", "BrokerID", "ClOrdID", "LastUpdate"]
    }]
}

zackulrichAC avatar Apr 19 '18 23:04 zackulrichAC