Q:

F# webpage Authentication

I've been trying to authenticate the bitstamp api however, I keep on getting the following error:

"{\"error\": \"Missing key, signature and nonce parameters\"}"

The code I have written to do this is below:
let nounce = System.DateTime.Today.Ticks
let hexdigest (bytes : byte[]) =
    let sb = System.Text.StringBuilder()
    bytes |> Array.iter (fun b -> b.ToString("X2") |> sb.Append |> ignore)
    string sb
let signature =
    use hmac = new HMACSHA256(System.Text.Encoding.ASCII.GetBytes(stampsecret))
    hmac.ComputeHash(mes) 
    |> hexdigest

I am calling the website with the following:
let ordersBTCbuy()=
    Http.Request("https://www.bitstamp.net/api/buy", meth="Post", query=["key", stampkey; "signature", signature.ToLower(); "nonce", string(nounce); "amount", "1"; "price", string(convertB)])

A reference to the API can be found here: https://www.bitstamp.net/api/
Update I've changed the web address to:
let ordersBTCbuy()=
        Http.Request("https://www.bitstamp.net/api/buy/", meth="Post", query=["key", stampkey; "signature", signature.ToLower(); "nonce", string(nounce); "amount", "1"; "price", string(convertB)])
My new issue is now the signature my representation is 64 characters long and upper case however I still seem to have an error.

A:

When creating a POST request. Your key-value pairs need to go in the body.
To do that using FSharp data do the following:
let postBody = FormValues([ "key", stampkey; "signature", signature.ToLower(); "nonce", string(nounce); "amount", "1"; "price", string(convertB)])

let ordersBTCbuy()=
    Http.Request("https://www.bitstamp.net/api/buy", httpMethod="Post", body=postBody)

