Web API接口

适合迅饶全系列软网关和硬网关产品

1. 概述

1.1介绍

本文定义的协议旨在于第三方平台从通过API形式访问迅饶网关,从而获取数据而开放。
API所有函数的输入参数及其返回均采用XML格式数据。

1.2 API功能和清单

调用格式http://192.168.1.88/soap
函数名称功能说明API版本支持
Browse获取所有的点位名称。1.0
Read读取点位的值1.0
Write控制点位的值1.0

1.3各项功能说明

1.3.1 Browse

函数名称Browse
请求urlhttp://192.168.1.88/soap
请求头headersSOAPAction:http://opcfoundation.org/webservices/XMLDA/1.0/Browse
功能说明获取所有的内部变量名称,以及所有点位名称。逻辑机制:<需要迭代递归实现>第一步,ItemName参数为空,获取所有根节点的名称,通过返回的IsItem参数判断是否有子节点,IsItem为”true”,则为叶子节点,无须继续迭代,取出ItemName。IsItem为”false”,则表示改节点下有子节点,需要继续迭代,直到取出所有叶子节点。第二步,ItemName参数为上一步获取到Elements的name,获取的是子代节点。第三步,继续迭代下去,直到获取所有的节点名称。
参数说明MaxElementsReturned:请求的最大点位个数,默认为2048ItemName参数为空,默认获取所有内部变量名称及驱动名称ItemName参数不为空,应该为驱动名称.通道名称.设备名称可选请求参数,返回内容为详细点位信息ReturnAllProperties="true"ReturnPropertyValues="true" 
请求参数<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Browsexmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"ClientRequestHandle=""ElementNameFilter=""ItemName=""LocaleID="en-US"MaxElementsReturned="2048"ReturnErrorText="true"VendorFilter=""/></soap:Body></soap:Envelope>
响应内容<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><BrowseResponse xmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"><BrowseResult RcvTime="2020-08-10T14:55:07" ReplyTime="2020-08-10T14:55:07" ClientRequestHandle="" RevisedLocaleID="en-us" ServerState="running"/><Elements Name="$.sunfull.范例1.1_2.CommStatus" ItemPath="" ItemName="$.sunfull.范例1.1_2.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.sunfull.范例2.给排水系统_12.CommStatus" ItemPath="" ItemName="$.sunfull.范例2.给排水系统_12.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.sunfull.范例2.冷机系统_1.CommStatus" ItemPath="" ItemName="$.sunfull.范例2.冷机系统_1.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.sunfull.范例3.D1.CommStatus" ItemPath="" ItemName="$.sunfull.范例3.D1.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.sunfull.范例17.Device_1.CommStatus" ItemPath="" ItemName="$.sunfull.范例17.Device_1.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.RTU.IO12682.Device_1.CommStatus" ItemPath="" ItemName="$.RTU.IO12682.Device_1.CommStatus" IsItem="true" HasChildren="false"/><Elements Name="$.Date" ItemPath="" ItemName="$.Date" IsItem="true" HasChildren="false"/><Elements Name="$.Time" ItemPath="" ItemName="$.Time" IsItem="true" HasChildren="false"/><Elements Name="$.Week" ItemPath="" ItemName="$.Week" IsItem="true" HasChildren="false"/><Elements Name="$.IP" ItemPath="" ItemName="$.IP" IsItem="true" HasChildren="false"/><Elements Name="$.Mask" ItemPath="" ItemName="$.Mask" IsItem="true" HasChildren="false"/><Elements Name="$.Gateway" ItemPath="" ItemName="$.Gateway" IsItem="true" HasChildren="false"/><Elements Name="$.Driver" ItemPath="" ItemName="$.Driver" IsItem="true" HasChildren="false"/><Elements Name="$.Channel" ItemPath="" ItemName="$.Channel" IsItem="true" HasChildren="false"/><Elements Name="$.Device" ItemPath="" ItemName="$.Device" IsItem="true" HasChildren="false"/><Elements Name="$.Group" ItemPath="" ItemName="$.Group" IsItem="true" HasChildren="false"/><Elements Name="$.Language" ItemPath="" ItemName="$.Language" IsItem="true" HasChildren="false"/><Elements Name="$.Permission" ItemPath="" ItemName="$.Permission" IsItem="true" HasChildren="false"/><Elements Name="$.AlarmText" ItemPath="" ItemName="$.AlarmText" IsItem="true" HasChildren="false"/><Elements Name="$.BeepMute" ItemPath="" ItemName="$.BeepMute" IsItem="true" HasChildren="false"/><Elements Name="$.AlarmEvent" ItemPath="" ItemName="$.AlarmEvent" IsItem="true" HasChildren="false"/><Elements Name="$.TimeLimit" ItemPath="" ItemName="$.TimeLimit" IsItem="true" HasChildren="false"/><Elements Name="$.AlarmDisable" ItemPath="" ItemName="$.AlarmDisable" IsItem="true" HasChildren="false"/><Elements Name="time" ItemPath="" ItemName="time" IsItem="true" HasChildren="false"/><Elements Name="数据初始化" ItemPath="" ItemName="数据初始化" IsItem="true" HasChildren="false"/><Elements Name="a" ItemPath="" ItemName="a" IsItem="true" HasChildren="false"/><Elements Name="b" ItemPath="" ItemName="b" IsItem="true" HasChildren="false"/><Elements Name="c" ItemPath="" ItemName="c" IsItem="true" HasChildren="false"/><Elements Name="d" ItemPath="" ItemName="d" IsItem="true" HasChildren="false"/><Elements Name="B1" ItemPath="" ItemName="B1" IsItem="true" HasChildren="false"/><Elements Name="C1" ItemPath="" ItemName="C1" IsItem="true" HasChildren="false"/><Elements Name="D1" ItemPath="" ItemName="D1" IsItem="true" HasChildren="false"/><Elements Name="E1" ItemPath="" ItemName="E1" IsItem="true" HasChildren="false"/><Elements Name="sunfull" ItemPath="" ItemName="sunfull" IsItem="false" HasChildren="true"/><Elements Name="RTU" ItemPath="" ItemName="RTU" IsItem="false" HasChildren="true"/></BrowseResponse></soap:Body></soap:Envelope>

1.3.2 Read

函数名称Read
请求urlhttp://192.168.1.88/soap
请求头headersSOAPAction:http://opcfoundation.org/webservices/XMLDA/1.0/Read
功能说明读取点位的值
参数说明ItemName为需要读取的点位名称
输入参数<soap:Envelope><soap:Body><Read><OptionsReturnErrorText="false"ReturnDiagnosticInfo="false"ReturnItemTime="true"ReturnItemPath="false"ReturnItemName="true"/><ItemListMaxAge="0"ReqType=""><ItemsItemPath=""ReqType=""ItemName="s.C1.D1.Tag_1"ClientItemHandle="0"MaxAge="0"/><ItemsItemPath=""ReqType=""ItemName="sunfull.范例1.1_2.设定温度"ClientItemHandle="0"MaxAge="0"/></ItemList></Read></soap:Body> </soap:Envelope>
响应内容<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ReadResponse xmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"><ReadResult RcvTime="2020-08-10T14:51:22" ReplyTime="2020-08-10T14:51:22" ClientRequestHandle="" RevisedLocaleID="en-us" ServerState="running"/><RItemList><Items ClientItemHandle="85450616" Timestamp="2020-08-10T14:38:52" ValueTypeQualifier="VT_I2" ItemName="sunfull.范例1.1_2.设定温度"><Value xsi:type="xsd:short">25</Value><Quality QualityField="good"/></Items></RItemList></ReadResponse></soap:Body></soap:Envelope>

1.3.3 Write

函数名称Write
请求urlhttp://192.168.1.88/soap
请求头headersSOAPAction:'http://opcfoundation.org/webservices/XMLDA/1.0/Write
功能说明支持单点,多点写值。根据点名,修改当前值。
输入参数<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Writexmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"><OptionsClientRequestHandle=""LocaleID="en-US"ReturnItemName="false"ReturnItemTime="false"/><ItemList><Items ClientItemHandle="" ItemName="xml.Channel_1.Device_8.Tag_9"> <Value> 111 </Value> </Items><Items ClientItemHandle="" ItemName="xml.Channel_1.Device_8.Tag_8"> <Value>222</Value></Items><Items ClientItemHandle="" ItemName="xml.Channel_1.Device_8.Tag_7"> <Value>333</Value></Items></ItemList></Write></soap:Body></soap:Envelope> 
返回内容<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><WriteResponse xmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"><WriteResult RcvTime="2020-08-26T16:48:53" ReplyTime="2020-08-26T16:48:53" ClientRequestHandle="" RevisedLocaleID="en-us" ServerState="running"/><RItemList><Items ValueTypeQualifier="VT_UI2"><Value xsi:type="xsd:unsignedShort">111</Value><Quality QualityField="good"/></Items><Items ValueTypeQualifier="VT_UI2"><Value xsi:type="xsd:unsignedShort">222</Value><Quality QualityField="good"/></Items><Items ValueTypeQualifier="VT_UI2"><Value xsi:type="xsd:unsignedShort">333</Value><Quality QualityField="uncertain"/></Items></RItemList></WriteResponse></soap:Body></soap:Envelope>
2023-08-23
0 0