To avoid this, use CAML query and post it in the request body. Use a CAML query builder to build the query. This doesn't have restrictions on the length. This might become long and repetitive. But AFAIK, there is no other way to post huge request bodies in the request URL.
CAML query:
<Query>
<Where>
<Or>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Group 1</Value>
</Eq>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Group 2</Value>
</Eq>
</Or>
</Where>
</Query>
Sample in JS:
function getDataWithCaml(siteurl, caml) {
var endpoint = siteurl+"/_api/Web/SiteUserInfoList/getitems";
var requestData = { "query" :
{"__metadata":
{"type": "SP.CamlQuery" }
, "ViewXml": caml
}
};
return $.ajax({
url: endpoint,
method: "POST",
data: JSON.stringify(requestData),
headers: {
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"Accept": "application/json; odata=verbose",
"Content-Type": "application/json; odata=verbose"
}
});}
Usage:
$(document).ready(function(){
var caml = "<View><Query>"+
"<Where>"+
"<Eq>"+
"<FieldRef Name='LinkTitle' />"+
"<Value Type='Computed'>GroupName</Value>"+
"</Eq>"+
"</Where>"+
"</Query></View>";
console.log(caml);
getDataWithCaml("http://siteurl", caml).done(function(data)
{
var resultSet= data.d.results;
console.log(resultSet);
var title = [];
var id=[];
for(var i=0;i<resultSet.length;i++){
title.push(resultSet[i].Title);
id.push(resultSet[i].ID);
}
console.log(title);
console.log(id);
}).fail(
function(error){
console.log(JSON.stringify(error));
});
});