...
Code Block |
---|
title | Reading (GET request) |
---|
|
urlObj = OBJ_NEW('IDLnetUrl')
urlObj->SetProperty, URL_SCHEME = 'http'
urlObj->SetProperty, URL_HOST = 'localhost'
urlObj->SetProperty, URL_PORT = '8001'
urlObj->SetProperty, URL_PATH = 'HMI/sharp_cea_720s_nrt'
urlObj->SetProperty, URL_QUERY = 'start=2016-01-19T00:00:00Z&end=2016-01-19T00:00:00Z&meta=false'
urlObj->SetProperty, HEADERS = 'Content-Type: application/json'
res = urlObj->Get(/string_array, /BUFFER)
resJson = JSON_PARSE(strjoin(res), /TOARRAY, /TOSTRUCT) |
Code Block |
---|
title | Writing (POST request) |
---|
|
data = {time_start: ''2012-01-01T01:01:01Z",data: mydata}
json_data = json_serialize(data,/LOWERCASE)
urlObj = OBJ_NEW('IDLnetUrl')
urlObj->SetProperty, URL_SCHEME = 'http'
urlObj->SetProperty, URL_HOST = 'localhost'
urlObj->SetProperty, URL_PORT = '8002'
urlObj->SetProperty, URL_PATH = '/region/myProvenance'
urlObj->SetProperty, URL_QUERY = ''
urlObj->SetProperty, HEADERS = 'Content-Type: application/json'
result = urlObj->Put(json_data, /BUFFER, /post)
resJson = JSON_PARSE(strjoin(res), /TOARRAY, /TOSTRUCT) |
The properties of the IDLnetUrl object are according to the URLs which you get on the http://localhost:8001/ui and http://localhost:8002/uisites.