How to get only count(xx) in REST

lock
push_pin
done
Besvarat
1

I tried many things but I am unable to get only the count of documents that is belonging to a given contactId.

This is my REST: /v1/Archive/FindDocument?$select count(documentId):HideDetail:Footer&$filter=contactId=38

But not only do I get all documents on the contactId=38, but I don't get the count as a column, which I expected. Of cause RowCount works but that was not the idea.

Can someone help?

16. feb. 2026 | 02:14 em

Allt Svar (1)

Pretty sure you need a groupby clause here?  'GroupBy(columnName):Footer' (docs)

 

8 h, 7 m sedan | 09:58 fm
Yes, you are right. Thank you. I found the help I needed here: https://docs.superoffice.com/en/api/netserver/archive-providers/aggregate-groupby.html
I used a different approch and used a Post with body, the key is these columns:

"Columns": [
"Count(documentId):HideDetail",
"GroupBy(contactId):Footer,HideDetail"
]
And then the restriction set on contactId = 38

The result is then (and yes the count is 39):
(Just what I needed, at least almost, I would have liked a single column with the count 39, but this is good enough)

[
{
"EntityName": "footer:1",
"PrimaryKey": 1,
"ColumnData": {
"GroupBy(contactId):Footer,HideDetail": {
"DisplayValue": "[I:38]",
"TooltipHint": "{document_id=21891}",
"LinkHint": ""
},
"Count(documentId):HideDetail": {
"DisplayValue": "[I:39]",
"TooltipHint": "",
"LinkHint": ""
}
},
"LinkHint": "DrillDown=contactId|[I:38]§contactId_id|[I:38]",
"StyleHint": "footer",
"TableRight": {
"Mask": "Select, Update, Insert, Delete",
"Reason": ""
},
"FieldProperties": {}
}
]
7 h, 26 m sedan | 10:39 fm

Lägg till svar