Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Api ODATA:如何通过id';s_Api_Odata - Fatal编程技术网

Api ODATA:如何通过id';s

Api ODATA:如何通过id';s,api,odata,Api,Odata,我想通过odata加载项目,传递id列表。例如,我应该这样做以加载id为1的项: GEThttp://localhost:9001/DefaultBatch/DefaultBatchCustomer(1) HTTP/1.1 现在我想做类似的事情来加载id为1和2的项目: GEThttp://localhost:9001/DefaultBatch/DefaultBatchCustomer(1,2)HTTP/1.1 有可能吗?我在文档中找不到任何信息要按多个ID进行过滤,必须使用$filter子句:

我想通过odata加载项目,传递id列表。例如,我应该这样做以加载id为1的项:

GEThttp://localhost:9001/DefaultBatch/DefaultBatchCustomer(1) HTTP/1.1

现在我想做类似的事情来加载id为1和2的项目:

GEThttp://localhost:9001/DefaultBatch/DefaultBatchCustomer(1,2)HTTP/1.1


有可能吗?我在文档中找不到任何信息

要按多个ID进行过滤,必须使用
$filter
子句:

GET http://localhost:9001/DefaultBatch/DefaultBatchCustomer?$filter=id eq 1 or id eq 2

/Logical operators段落

要按多个ID进行筛选,必须使用
$filter
子句:

GET http://localhost:9001/DefaultBatch/DefaultBatchCustomer?$filter=id eq 1 or id eq 2

/Logical operators段落

好的,你说得对。要对更多实体进行PUT或修补?@MrScf摘自同一文档:“应用于向实体集以及所有修补、PUT和DELETE请求的POST请求的系统查询选项的语义不在本规范中定义,保留给未来版本。”我想这取决于你的OData实现。我得到的选项404没有找到。我想将ID作为数组传递。[FromODataUri]长[]键。但是请求找不到任何有效的端点。好的,您是对的。要对更多实体进行PUT或修补?@MrScf摘自同一文档:“应用于向实体集以及所有修补、PUT和DELETE请求的POST请求的系统查询选项的语义不在本规范中定义,保留给未来版本。”我想这取决于你的OData实现。我得到的选项404没有找到。我想将ID作为数组传递。[FromODataUri]长[]键。但是请求找不到任何有效的端点。