必需权限:VariableCreateDeleteGroup

VariableValueGroup引用一组自定义变量值。可通过一个请求读取这些变量的值。也可使用$deltatoken获取更新变量的值。

必须先创建变量组,才能使用。例如,POST http://my_server:3580/nivariable/VariableValueGroups

POST JSON数据:

  HTTP Header - Content-Type : application/jsonHTTP Body -{
  
   "VariableValues"

  : [{ "__metadata" : {

   "uri"

  : "http://my_server:3580/nivariable/VariableValues('ni.var.psp://localhost/process1/variable1')"} }, { "__metadata" : {

   "uri"

  : "http://my_server:3580/nivariable/VariableValues('ni.var.psp://localhost/process2/variable2')"} }]}

POST XML数据:

  HTTP Header - Content-Type : application/xmlHTTP Body -<?xml version="1.0" encoding="utf-8"?><entry xmlns:d="http://my_server:3580/nivariable/" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text"></title> <updated>2010-02-27T21:36:47Z</updated> <author> <name /> </author> <category term="nivariable.VariableValueGroup" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/VariableValues" href="VariableValues('ni.var.psp://localhost/process1/variable1')"/> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/VariableValues" href="VariableValues('ni.var.psp://localhost/process1/variable2')"/> <content type="application/xml"> <m:properties> <d:Timeout>15000</d:Timeout> </m:properties> </content></entry>
注:VariableValueGroups创建资源时,无需包括属性。VariableValueGroup的ID属性是必须的属性,在OData协议下创建的资源必须包括必须的属性。无法判断哪些是可用的ID。如OData客户端要求Id属性才能发送一个命令,可为ID分配一个随机值。变量Web服务将用户提供的Id属性替换为一个唯一的值。

如创建了VariableValueGroup,服务器返回201响应,并添加Location头信息,表示新创建资源的URI。响应主体包含新建组的ID。

VariableValueGroup未创建,服务器将返回下列响应:

  • 500内部服务器错误 - 服务器端发生错误。
  • 400错误请求 - 请求的POST数据无效。

回复的主体使用标准OData错误对象表示失败的原因。