diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index ea002dba1..7bee3c5f0 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -1271,14 +1271,22 @@
+ Non-core reports can be added, updated and deleted. +
++ Core reports (supplied at installation/upgrade time) can only have their "useReport" updated. + "useReport" is used, for example, in the reference UI report page to 'show'/'not show' reports. + Reports that have useReport set to false can still be run. + Reports only used for workflow purposes are examples of reports that would have their useReport set to false. +
+
+ Placeholders can be put in the reportSql to act as parameters. They have the format ${paramName}.
+ The runreports api will translate the value of any query parameter beginning R_ with the equivalent placeholder.
+ e.g. query parameter R_myName=john will replace ${myName} with john
+
+ There is a special 'automatic' placeholder ${currentUserHierarchy} - if this is included in reportSql
+ it gets replaced by the requesting users' office hierarchy value. This enables data scoping.
+ Usage example "where o.hierarchy like CONCAT('${currentUserHierarchy}', '%')"
+
+ Note:
+ The reports api allows parameters (not just placeholders in reportSql) to be associated with reports.
+ These associated parameters are only required to allow the reference UI reporting functionality implement
+ user-friendly parameter input.
+
+POST https://DomainName/api/v1/reports
+
+
+POST reports
+Content-Type: application/json
+Request Body:
+{
+ reportName: "myReport",
+ reportType: "Table",
+ reportCategory: "My Category",
+ description: "sample non-core report",
+ reportSql: "select 'hello'",
+ useReport: false
+}
+
+
+{
+ "resourceId": 100
+}
+
+ Example Requests:
+
+GET https://DomainName/api/v1/reports/{id}
+
+
+{
+ "id": 1,
+ "reportName": "Client Listing",
+ "reportType": "Table",
+ "reportCategory": "Client",
+ "description": "Individual Client Report\r\n\r\nLists the small number of defined fields on the client table. Would expect to copy this \n\nreport and add any \u0027one to one\u0027 additional data for specific tenant needs.\r\n\r\nCan be run for any size MFI but you\u0027d expect it only to be run within a branch for \n\nlarger ones. Depending on how many columns are displayed, there is probably is a limit of about 20/50k clients returned for html display (export to excel doesn\u0027t \n\nhave that client browser/memory impact).",
+ "reportSql": "select \r\nconcat(repeat(\"..\", \r\n ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, \u0027.\u0027, \u0027\u0027)) - 1))), ounder.`name`) as \"Office/Branch\",\r\n c.account_no as \"Client Account No.\", \r\nc.display_name as \"Name\", \n\nc.joined_date as \"Joined\", c.external_id as \"External Id\"\r\nfrom m_office o \r\njoin m_office ounder on ounder.hierarchy like concat(o.hierarchy, \u0027%\u0027)\r\nand \n\nounder.hierarchy like concat(\u0027${currentUserHierarchy}\u0027, \u0027%\u0027)\r\njoin m_client c on c.office_id \u003d ounder.id\r\nwhere o.id \u003d ${officeId}\r\nand c.is_deleted\u003d0\r\n\n\norder by ounder.hierarchy, c.account_no",
+ "coreReport": true,
+ "useReport": true,
+ "reportParameters": [
+ {
+ "id": 5,
+ "parameterName": "OfficeIdSelectOne"
+ }
+ ]
+}
+
+ + Only the useReport value can be updated for core reports. +
+
+PUT https://DomainName/api/v1/reports/{id}
+
+
+PUT reports/100
+Content-Type: application/json
+Request Body:
+{
+ reportCategory: "My Category updated",
+ useReport: true
+}
+
+
+{
+ "resourceId": 100,
+ "changes": {
+ "reportCategory": "My Category updated",
+ "useReport": true
+ }
+}
+
+ + Only non-core reports can be deleted. +
+
+DELETE https://DomainName/api/v1/reports/{id}
+
+
+DELETE reports/100
+Content-Type: application/json
+Request Body:
+{}
+
+
+{
+ "resourceId": 100
+}
+
+ Example Requests:
-
-GET https://DomainName/api/v1/reports/{reportName}
+GET https://DomainName/api/v1/runreports/{reportName}
{
@@ -13356,23 +13520,31 @@ GET https://DomainName/api/v1/search?query=000000111