# Counted and summed figures over a whole allowed table, computed by the database

`POST /datasources/{id}/aggregate` · Rivier · hosting

Counted and summed figures over a whole allowed table, computed by the database: one to five measures, up to three groupings, a time grain, conditions. A personal column may be counted, not grouped by or shown; a restricted one is used nowhere.

- Scope: hosting:read
- Sdk: hosting.dataSource.aggregate
- Cli: hosting data source aggregate

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "table": {
      "type": "string"
    },
    "measures": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fn": {
            "type": "string"
          },
          "column": {
            "type": "string"
          }
        },
        "required": [
          "fn"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    }
  },
  "required": [
    "table",
    "measures"
  ],
  "additionalProperties": true
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/datasources/{id}/aggregate' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "table": "string",
  "measures": [
    {
      "fn": "string"
    }
  ]
}'
```
