This type is used to create RDE report generators that can generate reports either one time, periodically, or on invoice issue event.
In this document:
The considered APS type (download
) looks as follows:
{
"name": "RDEReportTemplate",
"id": "http://www.odin.com/rde/report-template/1.2",
"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.2",
"collection": true
},
"tenant": {
"type": "http://www.odin.com/rde/tenant/2.0"
},
"customization": {
"type": "http://www.odin.com/rde/report-customization/1.0"
}
},
"properties": {
"commonName": {
"type": "string"
},
"parameters": {
"type": "ReportTemplateParameters"
},
"format": {
"type": "string",
"enum": [
"CSV",
"XML",
"XLSX",
"JSON"
]
},
"notifyByEmail": {
"type": "boolean"
},
"eventType": {
"type": "string",
"enum": [
"PERIODIC",
"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>
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
commonName |
String |
Not Required |
Human readable description of report template type, such as “Daily report template”, “Monthly report template” or “On invoice report template”. |
|
parameters |
Not Required |
Parameters for report creation specific to report type. |
||
format |
Enum |
Not Required |
Report file format that can be either JSON, XML, XLSX, CSV. |
|
notifyByEmail |
Boolean |
Not Required |
If it’s true an email with a short-lived link to a report file will be sent. |
|
eventType |
Enum |
Not Required |
Report event type that can be either PERIODIC, ONETIME, or ON_INVOICE. |
|
periodicTask |
String |
Not Required |
36-character internal UUID of a periodic task used to generate RDE reports. |
|
lastReportDate |
String |
Not Required |
Last date of report creation, only for periodical report or report by invoice. |
|
nextReportDate |
String |
Not Required |
Intended next date of report creation, only for periodical report. |
|
reportApsActorId |
String |
Not Required |
36-character APS ID of the user that created the report generator. |
|
reportApsIdentityId |
String |
Not Required |
APS ID of an APS resource representing a report generator. |
NAME |
TYPE |
REQUIRED |
DESCRIPTION |
---|---|---|---|
reportFiles |
Collection of RDEReportFile |
No |
Collection of links to APS resources presenting the RDE reports generated by this report generator. |
tenant |
No |
Link to an internal tenant APS resource bound with an account. |
|
customization |
No |
Link to report customization APS resource. |
OPERATION |
VERB |
PATH |
RETURNS |
Description |
---|---|---|---|---|
GET |
/run-scheduled-task |
HTTP Request
GET /aps/2/resources/{aps-id}/run-scheduled-task
Description
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
id |
String |
Returns
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
period |
Enum |
Not Required |
Periodical report type that can be either P1D or P1M (daily or monthly). |
|
startDay |
Integer |
Not Required |
Day of Month for monthly periodical report. |
|
startDate |
String |
Not Required |
One time report “date from” limitation. |
|
endDate |
String |
Not Required |
Onetime report “date to” limitation. |
This section illustrates examples on managing report engines and reports using the considered APS type.
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"
}
}
}
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"
}
]
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"
}
}
]