Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

AGGREGATE HTTP INTERFACE

The Learning Locker Aggregate HTTP interface utilises the Mongo aggregation API and is only available for allowed collections. The Aggregate HTTP Interface is more advanced than the xAPI HTTP interface and allows you to access MongoDB’s powerful Aggregation API for more custom filtration of documents.

ALLOWED COLLECTIONS

This interface can be used to aggregate on multiple allowed only collections. To check whether a collection is allowed for aggregation or not, we use a regular expression. You can specify your own rule using AGGREGATE_API_ALLOWED_COLLECTIONS environment variable with ^rollup default value that means that by default you can aggregate on collections that prefixed with “rollup” word.

REQUEST SETUP

When using this interface, you must additionally supply your Basic Auth details with each request in the Authorization header. Your Basic Auth details can be found under Settings > Clients. The interface can be passed options via a JSON object in the request body (described in the table below). The collection property is required. The collection is a string that determines the collection name used to execute the aggregation on. The other properties are optional.

...

Code Block
{
    "result": [
        {
          "_id" : "111aaa1111a111111aa11111",
          "organisationId" : "111aaa1111a111111aa11111",
          "organisationName" : [
            "My amazing org"
          ],
          "lrsId" : "111aaa1111a111111aa11111",
          "lrsName" : [
            "My awesome store"
          ],
          "clientId" : "111aaa1111a111111aa11111",
          "clientName" : [
            "My incredible client"
          ],
          "platform" : "Some Cool Platform",
          "verb" : "http://adlnet.gov/expapi/verbs/scored",
          "count" : 200,
          "date" : "2017-08-01T00:00:00Z",
          "storedDate" : "2017-08-01T00:00:00Z"
        }
    ],
    "startedAt": "2020-04-03 14:17:30.924+03:00",
    "completedAt": "2020-04-03 14:17:30.943+03:00"
}

PIPELINE STAGES

So far we’ve only seen the limit and project stages, however, there are many other stages available in Mongo. The common stages are listed in the table below.

...