Hello,
I would like to use the HTTPGet function with the CIMIS Web API (CIMIS Web API - [REST Services] (ca.gov)). I need to enter multiple header parameters for the CIMIS Web API to work (app key, station ID, start date, end date, etc.). Is there a way to format the HTTPHeader (the 3rd input in the HTTPGet function) to understand a list of multiple header parameters?
Thanks in advance,
Kelley
Try putting your parameters in the URI
https://et.water.ca.gov/Rest/Index
Public Handle As Long
Public URI As String * 255
Public HTTPResponse As String
Public HTTPHeader As String
Const CRLF = CHR(13) & CHR(10)
BeginProg
Scan (60,Sec,0,0)
URI = "http://et.water.ca.gov/api/data?appKey=YOUR-APP-KEY&targets=2,8,127&startDate=2010-01-01&endDate=2010-01-05"
HTTPResponse = ""
HTTPHeader = "Accept: application/xml" & CRLF
Handle = HTTPGet (URI,HTTPResponse,HTTPHeader,3000)
NextScan
Or try putting the parameters in the HTTPHeader parameter
Public Handle As Long
Public URI As String * 255
Public HTTPResponse As String
Public HTTPHeader As String * 255
Const CRLF = CHR(13) & CHR(10)
BeginProg
Scan (60,Sec,0,0)
URI = "http://et.water.ca.gov/api/data"
HTTPResponse = ""
HTTPHeader &= "appKey: YOUR-APP-KEY" & CRLF
HTTPHeader &= "targets: 2,8,127" & CRLF
HTTPHeader &= "startDate: 2010-01-01" & CRLF
HTTPHeader &= "endDate: 2010-01-05" & CRLF
HTTPHeader &= "Accept: application/xml" & CRLF
Handle = HTTPGet (URI,HTTPResponse,HTTPHeader,3000)
NextScan
EndProg