I wanted to retrieve the different prices given by then kraken API but i'm not very familiar with the construction of POST requests.
I retrieve a code which could make the request but without any parameters:
Sub retrieve_price()
Const sUrl As String = "https://api.kraken.com/0/public/Ticker"
Dim oRequest As WinHttp.WinHttpRequest
Dim sResult As String
Set oRequest = New WinHttp.WinHttpRequest
With oRequest
.Open "POST", sUrl, True
.Send
.WaitForResponse
sResult = .ResponseText
End With
Range("A1") = sResult
End Sub
From the kraken API information they write:
Get ticker information
URL: https://api.kraken.com/0/public/Ticker
Input:
pair = comma delimited list of asset pairs to get info on
(same as enclosed picture or on https://www.kraken.com/help/api#public-market-data)
However to add this parameter i tried both:
In my with add:
.SetRequestHeader "pair", "ETHEUR"
and also:
.SetRequestHeader "Content-Type", "pair=ETHEUR"
or instead write for my send:
.Send ("pair=ETHEUR")
but both ways didn't work and i don't know how i should proceed then. I read How are parameters sent in an HTTP POST request? But i didn't understand how to apply what was written on the post Could someone give me a piece of advice about it? Many thanks!