Hi, I have got an query as to why when i ask for local rates (without having to pass the username) I can 'parser the data but when I have to add the extra code to pass the username (API_Key) it gets the data but does enter my parser routine.
Sub Download
Dim Job As HttpJob
Dim httpText As String
httpText="
https://api.octopus.energy/v1/produ...fs/E-1R-AGILE-18-02-21-E/standard-unit-rates/"
Job.Initialize("job1", Me)
Job.Download(httpText)
End Sub
Sub JobDone(job As HttpJob)
If job.Success = True Then
Select job.JobName
Case "job1"
Dim parser As JSONParser
parser.Initialize(job.GetString)
Dim from As String
Dim tim0 As String
Dim tim1 As String
Dim exV As String
Dim inV As String
Dim root As Map = parser.NextObject
Dim results As List = root.Get("results")
The above works and I can put the data in my table okay, whereas the following gets the data but doesn't enter the Sub routine Sub JoneDone(job as HttpJob)
Sub Download
Dim basicAuth As String = "sk_live_xxxxxxxxxxxxxxxxxxxx:" '
Dim su As StringUtils
Dim authInfo = su.EncodeBase64(basicAuth.GetBytes("UTF8"))
Dim job As HttpJob
job.Initialize("", Me)
job.Download("
https://api.octopus.energy/v1/electricity-meter-points/1411105400005/meters/16P0547786/consumption/")
job.GetRequest.SetHeader("Authorization", $"Basic ${authInfo}"$)
Wait For (job) JobDone(job As HttpJob)
If job.Success = True Then
Log(job.GetString)
Else
Log(job.ErrorMessage)
End If
'job.Release
End Sub
Sub JobDone(job As HttpJob)
If job.Success = True Then
Select job.JobName
Case "job1"
Dim parser As JSONParser
parser.Initialize(job.GetString)
Dim from As String
Dim tim0 As String
Dim tim1 As String
Dim cons As String
Dim root As Map = parser.NextObject
Dim results As List = root.Get("results")
'