I would like to convert the following postman js script to julia http requests.
We will then translate to a vendor supplied programming language.
The Julia code would be used to validate the vendor supplied results
Thanks for any help
The following is a postman prerequest script (values changed)
var isoTime = new Date().toISOString();
var entitySecret = “ff26516ecb32b123456dd0f42aa5106f237a69c806”;
var partnerSecret = “77eb0f2ad699c123456cb8677452212fed9b61a3c231”;
var patientId = “1006”;
Also, it appears that you have actual secret keys in your example code - is that an accident? With var entitySecret?
Particularly, with HTTP.jl, check out the get and post functions as well as the generic request command. That should help get you started if you are unsure where to start.
some progress
I can connect to site and get 401 return.
Now I need to create the Hmacsha256 and base 64 encode the hash and add it to the headers as authorization
Hopefully verify the hmacsha256 and encode vs the postman example that works.
For this you want to use Base64 from the standard library. First use hex2bytes to convert your string to a byte array, then base64encode to convert it back to a string:
using Base64
function base16to64(st::AbstractString)
bytes = hex2bytes(st)
return base64encode(bytes)
end
Congrats @bww00 ! For posterity, may I suggest wrapping your code blocks on your comments in backticks (these things: ``) to make your code nicely formatted? This can help others who come after who might have the same question as you. Also, since you have found your solution, I’d suggest also marking your solution