Skip to main content

Aggregation Example: Counts by users

This example counts segments with texts in gray, green and red status.

All project languages

We submit the following query on all segments in project with ID 3528. Note that you need to have manager level credentials for this to work.

CODE
POST /resources/statistics/aggregations
BODY (application/json):
{
	"scope": { "type": "Project", "projectid": 3528 },
	"aggregations": [ { "id": "textModifiedByUser" } ]
}

The textStatus aggregation returns counts of each status per each project language. In our project the source language is English and the single target language is French.

Note that in English there are 2237 source texts, all in default status. Of these only 174 are translated into French. 2 are flagged in red status and all others are in green status.

CODE
{
    "aggregations": {
        "textStatus": {
            "de": {
                "buckets": [
                    {
                        "key": 507,
                        "count": 7
                    },
                    {
                        "key": 343,
                        "count": 2
                    }
                ],
                "total": 9,
                "scanned": 12,
                "scannedErrors": 0
            },
            "en": {
                "buckets": [
                    {
                        "key": 507,
                        "count": 12
                    }
                ],
                "total": 12,
                "scanned": 12,
                "scannedErrors": 0
            },
            "fr": {
                "buckets": [],
                "total": 0,
                "scanned": 12,
                "scannedErrors": 0
            }
        }
    },
    "users": {
        "343": {
            "uid": 343,
            "uname": "Dabe Christophe",
            "cid": 200,
            "cname": "team"
        },
        "507": {
            "uid": 507,
            "uname": "Neumann John",
            "cid": 537,
            "cname": "Translation Company"
        }
    }
}

Content:

  • We have the source language English and two target languages

  • In English we can see that all 12 segments were marked online by John Neumann (user 507)

  • In German we see that 2 segments were edited by John and 7 by Christophe. The remaining 3 were apparently not touched yet.

  • No editing by any user did happen in French

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.