I don't think Group By is supported in REST API. Below are alternatives to achieve this. You need to apply Group By once data is returned from REST service.
Assuming this is your getting list items via SharePoint REST API:
function getListItemsByQuery(url, listname, query, complete, failure) {
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items" + query,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
complete(data.d);
},
error: function (data) {
failure(data);
}
});
}
Below function can be used to get unique values
function FilterValuetoGroupBy(items,propertyName)
{
var result = [];
$.each(items, function(index, item) {
if ($.inArray(item[propertyName], result)==-1) {
result.push(item[propertyName]);
}
});
return result;
}
Use above functions like below
getListItemsByQuery('https://example.com/project','MyList','?select=Title',
function(items){
var ItemsafterGroup = FilterValuetoGroupBy(items,'Title');
console.log(ItemsafterGroup );
},
function(error){
console.log(JSON.stringify(error));
}
);