The following example retrieve Kuala Lumpur's datetime and add it as a custom property into file.
Option Explicit
Dim oRequest, res, oJsonParser, oVbsVariant
Set oRequest = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Sub ReadStore(File)
'Tell the file how the string data is formed.
File.Formatter.Delimiters = ";"
File.Formatter.LineFeeds = File.GetLineFeed()
'Create a file accessor
Dim Block : Set Block = File.GetStringBlock()
Dim DirectAccessChannel : Set DirectAccessChannel = Block.Channels.Add("FileData", eString)
'Provide the data to USI
Root.Properties.Add "datetime", Now
Dim ChannelGroup : Set ChannelGroup = Root.ChannelGroups.Add("MyChannelGroup1")
Dim ImplicitChannel : Set ImplicitChannel = ChannelGroup.Channels.AddImplicitChannel("ValueIndex", 1, 1, DirectAccessChannel.Size(), eI32)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
res = sendRequest("get", "http://worldtimeapi.org/api/timezone/Asia/Kuala_Lumpur")
Set oJsonParser = CreateJsonParser()
Call oJsonParser.Deserialize(res, oVbsVariant)
Root.Properties.Add "KL Time", oVbsVariant.Item("datetime")
End Sub
Function sendRequest(ByVal sType, byVal sUrl)
oRequest.open sType, sUrl, false
oRequest.setRequestHeader "Content-Type", "application/json"
oRequest.setRequestHeader "Accept", "application/json"
oRequest.setRequestHeader "User-Agent", "curl/7.50.1"
oRequest.send
sendRequest = oRequest.responseText
End Function
This is the outcome of the execution.