RDEReportTemplate

GraphViz

Schema

The considered APS type (download) looks as follows:

{
  "name": "RDEReportTemplate",
  "id": "http://www.odin.com/rde/report-template/1.5",
  "apsVersion": "2.0",
  "implements": [
    "http://aps-standard.org/abstract/types/unlimited-resource/1.0"
  ],
  "relations": {
    "reportFiles": {
      "type": "http://www.odin.com/rde/report-file/1.6",
      "collection": true
    },
    "tenant": {
      "type": "http://www.odin.com/rde/tenant/2.2"
    },
    "customization": {
      "type": "http://www.odin.com/rde/base-report-customization/1.1"
    },
    "dataSet": {
      "type": "http://www.odin.com/rde/data-set/1.0"
    }
  },
  "properties": {
    "commonName": {
      "type": "string"
    },
    "parameters": {
      "type": "ReportTemplateParameters"
    },
    "format": {
      "type": "string",
      "enum": [
        "CSV",
        "XML",
        "XLSX",
        "JSON"
      ]
    },
    "sourceType": {
      "type": "string",
      "default": "API",
      "enum": [
        "API",
        "UX1"
      ]
    },
    "notifyByEmail": {
      "type": "boolean"
    },
    "eventType": {
      "type": "string",
      "enum": [
        "PERIODIC",
        "DAILY",
        "MONTHLY",
        "ONETIME",
        "ON_INVOICE"
      ]
    },
    "periodicTask": {
      "type": "string"
    },
    "lastReportDate": {
      "type": "string",
      "format": "date-time"
    },
    "nextReportDate": {
      "type": "string",
      "format": "date-time"
    },
    "reportApsActorId": {
      "type": "string"
    },
    "reportApsIdentityId": {
      "type": "string"
    }
  },
  "operations": {
    "runScheduledTask": {
      "path": "run-scheduled-task",
      "verb": "GET",
      "errorResponse": {
        "type": "object"
      },
      "parameters": {
        "id": {
          "kind": "path",
          "type": "string"
        }
      }
    }
  },
  "structures": {
    "ReportTemplateParameters": {
      "type": "object",
      "properties": {
        "period": {
          "type": "string",
          "enum": [
            "P1D",
            "P1M"
          ]
        },
        "startDay": {
          "type": "integer"
        },
        "startDate": {
          "type": "string",
          "format": "date-time"
        },
        "endDate": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}

The APS type is used to manage a collection of APS resources. To get a list of resources from that collection, use the following API call:

GET  /aps/2/collections/rde-report-templates?<RQL-filter>

Properties

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

commonName

String

Not Required

parameters

ReportTemplateParameters

Not Required

format

Enum

Not Required

sourceType

Enum

Not Required

API

notifyByEmail

Boolean

Not Required

eventType

Enum

Not Required

periodicTask

String

Not Required

lastReportDate

String

Not Required

nextReportDate

String

Not Required

reportApsActorId

String

Not Required

reportApsIdentityId

String

Not Required

Relationship

NAME

TYPE

REQUIRED

DESCRIPTION

reportFiles

Collection of RDEReportFile

No

tenant

RDETenant

No

customization

RDEBaseReportCustomization

No

dataSet

RDEDataSet

No

Custom Operations

OPERATION

VERB

PATH

RETURNS

Description

runScheduledTask

GET

/run-scheduled-task

runScheduledTask

HTTP Request

GET /aps/2/resources/{aps-id}/run-scheduled-task

Description

Parameters

PARAMETER

TYPE

DESCRIPTION

id

String

Returns

Structures

ReportTemplateParameters

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

period

Enum

Not Required

startDay

Integer

Not Required

startDate

String

Not Required

endDate

String

Not Required

Examples

This section illustrates examples on managing report engines and reports using the considered APS type.

Schedule Report Generation

Usually, this is the first action in the RDE lifecycle. There are the following options depending on the eventType property:

  • "eventType":"ONETIME" - generate one report immediately.

  • "eventType":"PERIODIC" - generate reports with a period defined in the respective periodic task.

  • "eventType":"ON_INVOICE" - generate a report every time a new invoice appears.

POST /aps/2/resources

{
   "aps":{
      "type":"http://www.odin.com/rde/report-template/1.1"
   },
   "commonName":"NW Finance",
   "parameters":{
      "startDate":"2018-09-09T00:00:00Z",
      "endDate":"2018-10-05T23:59:59Z"
   },
   "format":"JSON",
   "notifyByEmail":false,
   "eventType":"ONETIME"
}

The response will look like this:

HTTP/1.1 202 Accepted

{
   "aps": {
      "type": "http://www.odin.com/rde/report-template/1.1",
      "id": "07cd68e6-eb96-47c4-9936-a89e27ee790d",
      "status": "aps:provisioning",
      "revision": 3,
      "modified": "2018-10-09T09:23:52Z",
      "package": {
         "id": "2a1f2c8e-02a6-48c1-874d-e7617bc247bf",
         "href": "/aps/2/packages/2a1f2c8e-02a6-48c1-874d-e7617bc247bf"
      }
   },
   "commonName": "NW Finance",
   "eventType": "ONETIME",
   "format": "JSON",
   "notifyByEmail": false,
   "parameters": {
      "endDate": "2018-10-10T23:59:59Z",
      "startDate": "2018-10-09T00:00:00Z"
   },
   "reportApsActorId": "2ebda147-e0c6-4649-ab8f-9c14bfb2262e",
   "reportApsIdentityId": "2fd41bc4-7e89-43cd-99bc-cdaa3283a4eb",
   "reportFiles": {
      "aps": {
         "link": "collection",
         "href": "/aps/2/resources/07cd68e6-eb96-47c4-9936-a89e27ee790d/reportFiles"
      }
   },
   "tenant": {
      "aps": {
         "link": "weak",
         "href": "/aps/2/resources/18b57549-da3e-4e16-bd10-254aec5c2118",
         "id": "18b57549-da3e-4e16-bd10-254aec5c2118"
      }
   }
}

Get List of Reports

To get a list of reports generated by a certain generator, send the following request and specify the APS ID of the generator (for example, find it in the previous example):

GET /aps/2/resources/07cd68e6-eb96-47c4-9936-a89e27ee790d/reportFiles

The response will look like this:

HTTP/1.1 200 OK

[
   {
      "aps": {
         "modified": "2018-10-09T09:24:22Z",
         "id": "a7f79686-f6a6-4319-bb8b-4a40ed2ecbb3",
         "type": "http://www.odin.com/rde/report-file/1.1",
         "status": "aps:ready",
         "revision": 6
      },
      "generateDate": "2018-10-09T09:23:54Z",
      "filePath": "https://rde4.blob.core.windows.net/rdecontainer/NW%20Finance.a7f79686-f6a6-4319-bb8b-4a40ed2ecbb3.2018-10-09.09-23-54.912+0000.json.gz?sig=%2BoSd89NgbR%2FOcwSDnhRaOVQ1cjw1yYLY85hqDRW7Y4s%3D&api-version=2016-05-31&st=2018-10-09T09%3A13%3A55Z&se=2019-01-07T09%3A13%3A55Z&sv=2016-05-31&sp=rwd&sr=b",
      "format": "JSON",
      "name": "NW Finance",
      "eventType": "ONETIME",
      "parameters": {
         "endDate": "2018-10-10T23:59:59Z",
         "startDate": "2018-10-09T00:00:00Z"
      },
      "status": "READY",
      "tmpPath": "https://rde4.blob.core.windows.net/rdecontainer/NW%20Finance.a7f79686-f6a6-4319-bb8b-4a40ed2ecbb3.2018-10-09.09-23-54.912+0000.json.gz?sig=r%2FIlLy34mb7CtQhbW49jDoP1hhwgczQQULBDsDXVA0I%3D&api-version=2016-05-31&st=2018-10-09T09%3A23%3A55Z&se=2018-10-11T09%3A23%3A55Z&sv=2016-05-31&sp=r&sr=b"
   }
]

Collection of scheduled Reports (report generators)

To get a list of all report generators created for an account, the latter must send the following request:

GET /aps/2/collections/rde-report-templates

The response must contain the requested array of the reports both periodic and one time, similar to the following:

HTTP/1.1 200 OK

[
   {
      "commonName": "NW Finance",
      "reportApsActorId": "77292881-8ea0-4238-99a2-2ea62080bf1e",
      "reportApsIdentityId": "a0ecae40-c18e-4a40-8847-28263ff89f55",
      "aps": {
         "modified": "2018-10-09T08:00:27Z",
         "id": "60dea8ec-eea5-4ac8-8426-6f6b67bdbb2b",
         "type": "http://www.odin.com/rde/report-template/1.1",
         "status": "aps:ready",
         "revision": 7
      },
      "lastReportDate": "2018-10-09T08:00:29Z",
      "notifyByEmail": false,
      "format": "JSON",
      "eventType": "ONETIME",
      "parameters": {
         "endDate": "2018-10-05T23:59:59Z",
         "startDate": "2018-09-09T00:00:00Z"
      }
   }
]