Closed bluequasi closed 5 years ago
I've just solved the issue realizing that I was using an only read api key. Anyway this is the code in case someone need to use it
`Function PrivateLocalBTC(Method As String, endpoint As String, Optional params As String) As String
Dim NonceUnique As String NonceUnique = CreateNonce(13) TradeApiSite = "https://localbitcoins.com" apikey = "..............." secretkey = "............"
Message = NonceUnique & apikey & endpoint & params apisign = ComputeHash_C("SHA256", Message, secretkey, "STRHEX") If params <> "" Then urlparams = "?" & params Url = TradeApiSite & endpoint & urlparams
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") objHTTP.Open Method, Url, False objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" objHTTP.setRequestHeader "Apiauth-Key", apikey objHTTP.setRequestHeader "Apiauth-Nonce", NonceUnique objHTTP.setRequestHeader "Apiauth-Signature", apisign objHTTP.Send params
objHTTP.waitForResponse PrivateLocalBTC = objHTTP.ResponseText Set objHTTP = Nothing End Function`
I've adapted the access code for LocalBitcoins API (https://localbitcoins.com/api-docs/), but I have problems for POST request. The GET request is working fine. I've posted a question on stackoverflow along with the code used: https://stackoverflow.com/questions/54117140/localbitcoins-authenticated-http-post-request-error. Maybe someone more experienced can spare the time and maybe give me a hint on this.
Great work here Koen. Road opener. Thanks!