in reply to Re^2: Invalid nonce
in thread Invalid nonce

am just having this error confusing me

Error: {"status": "error", "reason": "Content-Type header should not be present", "code": "API0020"}

and API says

Content-Type header should not be present Please make sure you're not sending any body in the request.

and when i remove "Content-Type" => 'application/x-www-form-urlencoded'

am getting this error Error: {"status": "error", "reason": "Invalid signature", "code": "API0005"}

Replies are listed 'Best First'.
Re^4: Invalid nonce
by marto (Cardinal) on Jul 19, 2024 at 16:48 UTC

    Their API documentation is very specific, the code you posted doesn't match their signature definition.

      Content-Type should not be added to the string if request.body is empty.

      but when i remove Content-Type, am getting this error Error: {"status": "error", "reason": "Invalid signature", "code": "API0005"}

        Have you checked that the string you construct for the signature is actually as the documentation says?

        You interpolate %params into the string, but you don't specify the order of the keys.

        My hint is to print out the string before you compute the mac for it, and manually compare the string with what the documentation says.

        "The following have to be combined into a single string:" which you don't.