我想HTTP-PUT
实体/ entitySet列表(我猜它与HTTP-POST
类似)。下面是查询的正文。此查询适用于Postman。
{
"value": [
{
"@odata.type": "Demo.GridPoint",
"x": 2.2,
"y": 1.2
},
{
"@odata.type": "Demo.GridPoint",
"x": 4,
"y": 5
},
{
"@odata.type": "Demo.GridPoint",
"x": 1,
"y": 9
}
]
}
Demo.GridPoint
是ComplexType
我尝试创建ClientEntity
并将不同的值添加为ComplexProperty
:
ClientEntity coordinates = client.getObjectFactory().newEntity(coordinatesFqn);
for(/* all grid Points */){
coordinates.add(client.getObjectFactory().newComplexProperty("", gridPoint));
}
但是,功能newComplexProperty(String name, ClientComplexValue value)
需要ComplexValue
和一个名称。因此,生成的查询不符合预期的格式并失败:
{"@odata.type":"Demo.Coordinates",
"":{"@odata.type":"Demo.GridPoint","x@odata.type":"Double","x":2.2,"y@odata.type":"Double","y":1.2},
"":{"@odata.type":"Demo.GridPoint","x@odata.type":"Double","x":4,"y@odata.type":"Double","y":5}
"":{"@odata.type":"Demo.GridPoint","x@odata.type":"Double","x":1,"y@odata.type":"Double","y":9}
}
如何POST / PUT实体列表/ EntitySet?
答案 0 :(得分:0)
您可以添加对批量请求的支持。它们允许您在一个请求中发送多个请求。
http://www.odata.org/documentation/odata-version-2-0/batch-processing/