Closed sshcherbakov closed 9 years ago
Both currencies should be in the URL (they determine which market the order will be created in), the other parameters as POST request body.
Tried to put required tradeOrderType
and walletAccountId
to the payload both as JSON and Form encoding and got the 400 "Missing parameter" error back.
Only when I include the tradeOrderType
and walletAccountId
to the query as following:
https://sandbox.yacuna.com/api/1/order/create/XBT/EUR?tradeOrderType=BuyLimit&walletAccountId=XXXXXXX
I do not get the "Missing parameter" error and get "Authentication error" instead.
I'll try again with everything put into the payload. Should it be Form encoded or is a JSON payload expected?
The parameters for POST requests should be Form encoded, e.g.
POST /api/1/order/create/EUR/XBT
walletAccountId=walletAccountId&tradeOrderType=SellLimit&sellAmount=5&sellCurrency=EUR&buyAmount=&buyCurrency=&priceLimitAmount=250&priceLimitCurrency=XBT&externalReferenceId=
The input that is hashed into the token is the following (given the timestamp 1418973434472):
1418973434472@apiTokenSecret@POST@/api/1/order/create/EUR/XBT@buyAmount=&buyCurrency=&externalReferenceId=&priceLimitAmount=250&priceLimitCurrency=EUR&sellAmount=5&sellCurrency=EUR&tradeOrderType=SellLimit&walletAccountId=walletAccountId
Please note that when generating the authentication-token, the parameters must be sorted by their name, and all provided actual request-parameters (GET/POST) must be included. In the example above, 'currency1' and 'currency2' are included in the path but not as request-parameter, hence they do not appear separately in the input for the token.
All right, succeeded to create an order now. Thanks for the help!
Order create POST request looks to require GET style query parameters.
If I put parameters mentioned in the docs into the POST request body (as Form- or JSON-encoded) I get back a "Missing parameter" error. When I add them to the request query and cover with authentication, I get the authentication error.
Though mixing POST and GET query parameters doesn't contradict the HTTP specs, this is rather unusual for non-idempotent operations (query params do not identify a resource in this case) and generally not browser friendly (when building POST request with HTML forms)
Haven't succeeded to create a new Order yet.
Where are the parameters listed in the docs supposed to be applied as query parameters in the request URL or in the request payload. In the latter case, what is the expected parameters encoding, Form or JSON?