cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to fetch the the sum of all files size uploaded by individual user using CMIS API.

vinayasree
Champ in-the-making
Champ in-the-making

I am trying to fetch the sum of all files size uploaded by the individual users of alfresco. I have used CMIS API 

http://localhost:8080/alfresco/api/-default-/public/search/versions/1/search is a post request and the body is 

{
"query": {
"query": "select * from cmis:document WHERE cmis:createdBy LIKE 'vinayasree.u%'",
"language": "cmis"
}
}
and the result is
{
"list": {
"pagination": {
"count": 100,
"hasMoreItems": true,
"totalItems": 101,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"isFile": true,
"createdByUser": {
"id": "System",
"displayName": "System"
},
"modifiedAt": "2021-11-11T07:17:22.932+0000",
"nodeType": "cm:content",
"content": {
"mimeType": "text/html",
"mimeTypeName": "HTML",
"sizeInBytes": 549
},
"parentId": "9d9bfbe0-3cdc-4b9e-922a-38f24605660c",
"createdAt": "2021-11-11T07:17:22.932+0000",
"isFolder": false,
"search": {
"score": 1.0
},
"modifiedByUser": {
"id": "System",
"displayName": "System"
},
"name": "system-overview.html",
"location": "nodes",
"id": "7010998b-e9f6-4238-ac60-21dfb66f3613"
}
},
I want to retrieve Sum of all files size uploaded by individual users and I don't require the other fields. Can anyone help regarding this?
3 REPLIES 3

angelborroy
Community Manager Community Manager
Community Manager

You may try using the stats REST API:

http://127.0.0.1:8080/alfresco/s/api/solrstats

{
    "resultset": [
    ],
    "queryInfo": {
      "numberFound": "190"
      ,"totalRows": "0"
         ,"sum": "14794650"
         ,"max": "3737049"
         ,"mean": "81738"
    },
    "metadata": [
        {
            "colIndex": 0,
            "colType": "String",
            "colName": "name"
        },
        {
            "colIndex": 1,
            "colType": "Numeric",
            "colName": "sum"
        },
        {
            "colIndex": 2,
            "colType": "Numeric",
            "colName": "count"
        },
        {
            "colIndex": 3,
            "colType": "Numeric",
            "colName": "min"
        },
        {
            "colIndex": 4,
            "colType": "Numeric",
            "colName": "max"
        },
        {
            "colIndex": 5,
            "colType": "Numeric",
            "colName": "mean"
        }
    ]
}

If that is not enough, you need to use directly SOLR for the query, since CMIS doesn't support that feature.

Hyland Developer Evangelist

Can you tell me what do those fields indicate? numberFound,sum,max,mean what do they represent.Also the metadata has some fields.What does they indicate?

Hope this helps:

https://angelborroy.wordpress.com/2017/07/18/extrating-simple-stats-from-alfresco-5/

"metadata" is used as a legend for "resultset" when using the "facet" parameter in the URL

Hyland Developer Evangelist