0

I'm trying to retrieve list items from SharePoint online list using multiple filter conditions (in power automate). Since the number of conditions is too large URL length was exceeding. I'm trying to use batch to sent multiple get requests in a single query. Below is how the entire query looks like in the flow body (send an http request to SharePoint action)

--batch_133
Content-Type: application/http
Content-Transfer-Encoding: binary
GET https://site.sharepoint.com/sites/sitename/_api/web/lists/getbytitle('listName')/items?$select=Id,Title&$filter=(EmployeeEmail eq '[email protected]') HTTP/1.1
Accept: application/json;odata=nometadata

GET https://site.sharepoint.com/sites/sitename/_api/web/lists/getbytitle('listName')/items?$select=Id,Title&$filter=(EmployeeEmail eq '[email protected]') HTTP/1.1
Accept: application/json;odata=nometadata

--batch_133

The action is executed successfully and I received the results. But only the last query is working. Only results from the final get query is returned.

Any insights on what I'm doing wrong?

Thanks

3
  • Arent you missing definition of Content-type and Content-Transfer-Encoding for the second one? based on this MS documentation Make batch requests with the REST APIs
    – Popkornak
    May 15, 2023 at 19:50
  • Hi @Popkornak, Thank you for the suggestion. But when I add Content-type and Content-Transfer-Encoding, I'm receiving below error: The request line 'Content-Type: application/http' is invalid. The request line at the start of each operation must be of the format 'HttpMethod RequestUrl HttpVersion'. clientRequestId: 61529e53-a14b-4c9c-b605-056f4240805a serviceRequestId: cdbeb3a0-6089-3000-971c-e2345a6110bc any suggestions?
    – Robin Roy
    May 17, 2023 at 12:48
  • I referred the guide document you shared and updated the body of the request. It ran successfully but only returned outputs of one query. Is it not supported to batch queries to same list?
    – Robin Roy
    May 18, 2023 at 5:06

1 Answer 1

0

You are missing start of the second request --batch_133 and headers Content-type and Content-Transfer-Encoding

Answer:

--batch_133
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://<<TENANTHERE>>.sharepoint.com/sites/Site123/_api/Web/lists/getbytitle('CustomList')/items?$select=Id,Title&$filter=(EmployeeEmail eq '[email protected]') HTTP/1.1
Accept: application/json;odata=nometadata

--batch_133
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://<<TENANTHERE>>.sharepoint.com/sites/Site123/_api/Web/lists/getbytitle('CustomList')/items?$select=Id,Title&$filter=(EmployeeEmail eq '[email protected]') HTTP/1.1
Accept: application/json;odata=nometadata

--batch_133

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.