0% found this document useful (0 votes)
95 views9 pages

DIAEnergie WebAPI v1.4

The document describes a DIAEnergie web API for retrieving real-time and historical tag data from devices. It defines request methods for getting values of individual tags or all tags in one or multiple devices, and describes classes and parameters for making requests.

Uploaded by

Diego Ramos Lama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views9 pages

DIAEnergie WebAPI v1.4

The document describes a DIAEnergie web API for retrieving real-time and historical tag data from devices. It defines request methods for getting values of individual tags or all tags in one or multiple devices, and describes classes and parameters for making requests.

Uploaded by

Diego Ramos Lama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

DIAEnergie

Web API

V1.4

OMS PLC BU
DIAEnergie Web API
[POST] GetValues(DIAEnergieWS)

• Get one or multiple tags realtime or


historical value

[POST] GetDeivceValues(DIAEnergieWS)

• Get all tag realtime or historical value in one


or multiple devices
Delta Confidential
DIAEnergie Web API
DIAEnergieWS Class

class DIAEnergieWS
{
public string id{ get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public string Type{ get; set; }
}

id: One or multiple tag id, use ‘,’ to separate.


StartTime, EndTime: Datetime format (e.g. 2016-09-01 14:25:00)
Type: realtime, minute, hour, day, month, week, year

Delta Confidential
DIAEnergie Web API
GetValues

using (var client = new HttpClient())


{
client.BaseAddress = new Uri("http://localhost/api/DataExchange/");
client.DefaultRequestHeaders.Accept.Clear(); Or id=“1,2,3,5”
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var input = new DIAEnergieWS() { id = “1”, Type = “realtime“ };
HttpResponseMessage response = await client.PostAsync(“GetValues“, input);
if (response.IsSuccessStatusCode)
{
string strjson = await response.Content.ReadAsStringAsync();
//strjson = “[{ “Key”=“tid”, “Value”=“value” },
{ “Key”=“tid”, “Value”=“value” },…]”;
}
}

Delta Confidential
DIAEnergie Web API
GetValues

using (var client = new HttpClient())


{
client.BaseAddress = new Uri("http://localhost/api/DataExchange/");
client.DefaultRequestHeaders.Accept.Clear(); Or id=“1,2,3,5”
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var input = new DIAEnergieWS() { id = “1”, StartTime = “2016-09-01 00:00:00”,
EndTime = “2016-09-02 00:00:00”, Type = “hour”};
HttpResponseMessage response = await client.PostAsync(“GetValues“, input);
if (response.IsSuccessStatusCode)
{
string strjson = await response.Content.ReadAsStringAsync();
/*strjson = “[ {“Key”=“tid”, “Value”=“value”,”ts”=“1472709600000”},
{“Key”=“tid”, “Value”=“value”,”ts”=“1472727600000”},…]”;*/
}
} timestamp
Delta Confidential
DIAEnergie Web API
GetDeviceValues

using (var client = new HttpClient())


{
client.BaseAddress = new Uri("http://localhost/api/DataExchange/");
client.DefaultRequestHeaders.Accept.Clear(); Or id=“1,2,3,5”
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var input = new DIAEnergieWS() { id = “1”, Type = “realtime”};
HttpResponseMessage response = await client.PostAsync(“GetDeviceValues”, input);
if (response.IsSuccessStatusCode)
{
string strjson = await response.Content.ReadAsStringAsync();
/*strjson = “[ {“Key”=“tid”, “Value”=“value” },
{“Key”=“tid”, “Value”=“value” },…]”;*/
}
}

Delta Confidential
DIAEnergie Web API
GetDeviceValues

using (var client = new HttpClient())


{
client.BaseAddress = new Uri("http://localhost/api/DataExchange/");
client.DefaultRequestHeaders.Accept.Clear(); Or id=“1,2,3,5”
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var input = new DIAEnergieWS() { id = “1”, StartTime = “2016-09-01 00:00:00”,
EndTime = “2016-09-02 00:00:00” , Type = “hour”};
HttpResponseMessage response = await client.PostAsync(“GetDeviceValues“, input);
if (response.IsSuccessStatusCode)
{
string strjson = await response.Content.ReadAsStringAsync();
/*strjson = “[ {“Key”=“tid”, “Value”=“value”,”ts”=“1472709600000”},
{“Key”=“tid”, “Value”=“value”,”ts”=“1472727600000”},…]”;*/ }
} timestamp

Delta Confidential
GetTids
1. Get the name of the power meter and its corresponding (eid), return the name of the
meter and eid
2. Take the tid of the name corresponding to the power meter, such as: (parameter: eid,
PEt_EXP), return the tid

Example:
/api/DataExchange/GetTids?path=device name: tag name 1, device name: tag name 2

Return message:
[
{ "tid": 123, tagName: "tag name", eid: 1, equipName: “device name", "hierarchy":
"Root/2F/AAA" },
{ "tid": 124, tagName: "tag name", eid: 2, equipName: “device name", hierarchy":
"Root/3F/BBB" }
]
8
Delta Confidential
Smarter. Greener. Together.

To learn more about Delta, please visit www.deltaww.com.

You might also like