Skip to main content

Aggregation Example: Counts by date

This example counts texts modified by day.

Query

We ask the system to return the number of text modifications (actual text, flags, custom fields, labels, etc) in a Codyt job.

We show this per day and for the French target language only. We are not interested in the dates of changes in the source language.

CODE
POST /resources/statistics/aggregations
BODY (application/json):
{
	"scope": { "type": "Job", "jobid": "c9922" },
	"aggregations": [ { "id": "textModified", "perLocale": false, "interval": "day" } ],
	"query": { "languages": [ { "locs": [ "fr-FR" ]  } ] }
}

Result

This is what we get back:

CODE
{
    "aggregations": {
        "textModified": {
            "buckets": [
                {
                    "key": "2020-05-12T00:00:00Z",
                    "count": 2
                },
                {
                    "key": "2020-05-13T00:00:00Z",
                    "count": 25
                },
                {
                    "key": "2020-05-15T00:00:00Z",
                    "count": 30
                },
                {
                    "key": "2020-05-18T00:00:00Z",
                    "count": 1
                },
            ],
            "total": 57,
            "scanned": 120,
            "scannedErrors": 0
        }
    }
}

Note:

  • Only dates that have a non-zero count will be listed.

  • Dates are ordered by most recent on top.

  • Only the first buckets will be listed. Generally the first 30. Note that the total tells the total amount of modified segments even though only the first 30 buckets may be listed.

  • Out of 120 texts, 57 were modified.

JavaScript errors detected

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

If this problem persists, please contact our support.