如何使用rest API基于不同的Id获取记录?

Ani*_*h V 3 api rest sharepoint list

我需要REST API根据多个Id(主键)从列表中获取记录.

是否可以在一次REST API调用中传递多个Id 并在一次获取中获取所有记录?

是否有"IN(1,2,3)"之类的东西REST API

Vad*_*hev 8

根据SharePoint REST中的使用OData查询操作,请求 SharePoint REST服务支持以下OData查询运算符:

在此输入图像描述

如何通过SharePoint REST查询多个项目

由于inSharePoint REST中没有运算符,因此下面提供了一些等价物:

使用链式andor运算符明确指定项:

/_api/web/lists/getByTitle(listTitle)/items?$filter=(ID eq 1) or (ID eq 2) or (ID eq 3)
Run Code Online (Sandbox Code Playgroud)

使用top运算符在查询中指定项目限制:

/_api/web/lists/getByTitle(listTitle)/items?$top=3&$orderby=ID
Run Code Online (Sandbox Code Playgroud)

使用指定范围lt,le,gt,ge操作符:

/_api/web/lists/getByTitle(listTitle)/items?$filter=(ID ge 1) and (ID le 3) 
Run Code Online (Sandbox Code Playgroud)