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

cancel
Showing results for 
Search instead for 
Did you mean: 
vinayasree
Member II

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

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
angelborroy
Alfresco Employee

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

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
vinayasree
Member II

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

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?

angelborroy
Alfresco Employee

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

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