Closed VojtechDrda closed 2 years ago
Hello Vojtech,
if there aren't parameters in request then you can use json representation of empty array [] or empty object {}.
Thank you for the quick response.
I created a simple PHP scipt to give me a signature value for a GET request:
<?php $apiSecret = 'apiSecretGoesHere'; $data = []; $json = json_encode($data); echo urlencode(base64_encode(hash_hmac('sha512',$json,$apiSecret,$raw = TRUE))); ?>
But even using this signature, I still keep getting 400 error saying Signature mismatch.
The entire URL would look like this:
https://api.billdu.com/documents?apiKey=apiKey×tamp=1656495094&signature=signatureGeneratedByTheScript
Would you or anyone else know what may be wrong?
Thank you!
My bad, sorry. It shouldn't be completely empty. You should include timestamp and apiKey in $data array as it is in documentation
timestamp = unix_timestamp() //current unix timestamp in seconds
data = [] //empty for GET request, otherwise an array of required request data
toSign = data
toSign['timestamp'] = timestamp
toSign['apiKey'] = your api key
ksort(toSign) //sort the array by keys
json = JSON.encode(toSign)
signature = base64_encode(hash_hmac('sha512', json, apiSecret, raw = TRUE))
first create a raw hmac hash of the json then base64 encode it - this will give you the signaturedon't forget to url encode the signature
signature = urlencode(signature)
and then url should looks like this:
https://api.billdu.com/documents?apiKey=apiKey&signature=signature&timestamp=timestamp
Got it working, thank you!
For anyone connecting to Billdu API through Make (formerly Integromat) platform, this is what worked for me (Get Documents endpoint):
https://api.billdu.com/documents?apiKey=yourApiKey×tamp={{timestamp}}&signature={{encodeURL(sha512("{""apiKey"":""yourApiKey"",""timestamp"":" + timestamp + "}"; "base64"; "yourApiSecret"))}}
Just copy and paste the code into request field of an http module.
Hello, I was asked to develop an integration of Billdu using a No-Code platform (Make.com). I'm struggling with generating the signature. For a GET request, is the json part of the signature just an empty array represented by []? Thank you!