1

These Crypto API's are going to be the death of me. Finally have Binance API sorted and the Signature working. But now when all the variable are passed I get the error -1104 below.

{"code":-1104,"msg":"Not all sent parameters were read; read '4' parameter(s) but was sent '5'."}

I am certain it is the Signature Variable.

BINANCE API NOTES : SIGNED (TRADE and USER_DATA) Endpoint security

SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body.

Endpoints use HMAC SHA256 signatures.

The HMAC SHA256 signature is a keyed HMAC SHA256 operation.

Use your secretKey as the key and totalParams as the value for the HMAC operation.

The signature is not case sensitive. totalParams is defined as the query string concatenated with the request body.

This is the cfhttp send that works. This is the body being sent.

symbol=SHIBUSDT&side=sell&type=market&timestamp=1645629335613&signature=1071B5C8BF8727FD465483543BC93A7FF5EBD35AC63A8219E166238E552A7867

5 parameters (symbol, side, sell, type, timestamp, signature)

<cfhttp url="#base_api##req_path#" method="POST" result="result" charset="utf-8">
  <cfhttpparam type="header" name="X-MBX-APIKEY" value="#bn_key#"> 
  <cfhttpparam type="body" value="#thebody#">
</cfhttp> 

Below : This cfhttp send also works. Fore giggles I added the signature into URL Call. This is the body being sent.

symbol=SHIBUSDT&side=sell&type=market&timestamp=1645629335613

5 parameters (symbol, side, sell, type, timestamp, URL ? = signature)

<cfhttp url="#base_api##req_path#?signature=XXXXXSIGSTUFFXXX" method="POST" result="result" charset="utf-8">
  <cfhttpparam type="header" name="X-MBX-APIKEY" value="#bn_key#"> 
  <cfhttpparam type="body" value="#thebody#">
</cfhttp> 

Looking for fix, I seem to find that it usually a spelling error on the parameter. But these are correct parameters. Thoughts? Or is there a different way to send signature? If sent as Header it errors.

rrk
  • 15,677
  • 4
  • 29
  • 45
Merle_the_Pearl
  • 1,391
  • 3
  • 18
  • 25
  • That change to the & for timestamp works with things. The timestamp works fine now. So that is resolved. Maybe I need to look at this : totalParams is defined as the query string concatenated with the request body. Do I need to send totalParams as a header? – Merle_the_Pearl Feb 23 '22 at 16:09
  • Arrgh. I moved Timestamp to the front and it works now. Didn't before. And then it required a quantity parameter (API Doc says optional lol). Now got this... Filter failure: MIN_NOTIONAL - likely order size stuff. Next puzzle! – Merle_the_Pearl Feb 23 '22 at 16:27
  • 1
    (Edit) Well if it works with timstamp at the front, then it probably didn't work with the `&` :-) The reason is `&time` only switches to `x` when you *output* the string. Nothing happens when you use the variable in the `body`, so using `&` actually ends up changing the parameter name, breaking the cfhttp call. Anyway, glad you got it working. – SOS Feb 23 '22 at 16:55
  • Voting to close as dupe of your other thread since that was the real cause, and the other thread explains the details of why. [Coldfusion : Odd Output of Timestamp : Replaces with an x](https://stackoverflow.com/questions/71226188/coldfusion-odd-output-of-timestamp-replaces-with-an-x) – SOS Feb 28 '22 at 14:58
  • I have all 3 of the API's sorted finally. KuCoin, Binance, Coinbase. They all use different encyption methods. So wasn't fun. – Merle_the_Pearl Mar 01 '22 at 16:37
  • Heh, I can only imagine! Great that you got them all working though. Hope you still have some hair left after all this... – SOS Mar 01 '22 at 16:41

1 Answers1

0

Please add quantity to as another parameter, the order cannot be accepted without knowing the quantity.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 22 '23 at 14:04