Versions Compared

Key

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

...

Expand
titleGET- /report/get/:reportId

This API is associated with viewing and reading out the specific report on the Sunbird Platform. It returns only the metadata information for the report.

Response

Code Block
languagejson
{
  "id": "string",
  "ver": "string",
  "params": {
    "resmsgid": "string",
    "msgid": "string",
    "status": "success",
    "err": "string",
    "errmsg": "string"
  },
  "responseCode": "OK",
  "result": {
    "reports": [
      {
        "reportid": "string",
        "title": "string",
        "description": "string",
        "authorizedroles": [
          "string"
        ],
        "status": "string",
        "type": "string",
        "reportaccessurl": "string",
        "createdon": "string",
        "updatedon": "string",
        "createdby": "string",
        "reportconfig": {
          "id": "string",
          "label": "string",
          "table": [
            {
              "name": "string",
              "valuesExpr": "string",
              "columnsExpr": "string"
            }
          ],
          "title": "string",
          "charts": [
            {
              "colors": [
                {
                  "borderColor": "string",
                  "backgroundColor": "string"
                }
              ],
              "options": {
                "title": {
                  "text": "string",
                  "display": true,
                  "fontSize": 16
                },
                "legend": {
                  "display": false
                },
                "scales": {
                  "xAxes": [
                    {
                      "scaleLabel": {
                        "display": true,
                        "labelString": "string"
                      }
                    }
                  ],
                  "yAxes": [
                    {
                      "scaleLabel": {
                        "display": true,
                        "labelString": "string"
                      }
                    }
                  ]
                },
                "tooltips": {
                  "mode": "string",
                  "intersect": false,
                  "bodySpacing": 5,
                  "titleSpacing": 5
                },
                "responsive": true
              },
              "datasets": [
                {
                  "label": "string",
                  "dataExpr": "string"
                }
              ],
              "chartType": "string",
              "labelsExpr": "string",
              "dataSource": {
                "ids": [
                  "parameterizedPath"
                ],
                "commonDimension": "string"
              }
            }
          ],
          "dataSource": [
            {
              "id": "parameterizedPath",
              "path": "/reports/$state/abc.json"
            },
            {
            "id": "nonParameterizedPath",
            "path": "/reports/tn/abc.json"
            }
          ],
          "description": "string",
          "downloadUrl": "string"
        },
        "slug": "string",
        "reportgenerateddate": "string",
        "reportduration": {
          "enddate": "string",
          "startdate": "string"
        },
        "tags": [
          "string"
        ],
        "updatefrequency": "string",
        "parameters": [
          "string"
        ],
        "report_type": "string"
      }
    ],
    "count": 1
  }
}

Datasource Schema:-

Code Block
languagejson
interface IDatasource {
  id: string
  path: string
}

id -: job Job id responsible for generating the dataset

path -: endpoint which will download : Endpoint for downloading the dataset file(s) - the path can be both parameterized and non parameterized . Portal backend populates the parameters using logged in user context details and downloads the respective file.

...

Expand
titleAPI to get meta data + datasets

Proposed response structure - to get meta + datasets.

Success Scenario - Status Code 200

Code Block
languagejson
{
    "id": "api.report.read",
    "ver": "string",
    "ts": "timestamp",
    "params": {
      "resmsgid": "string",
      "msgid": "string",
      "status": "success",
      "err": "string",
      "errmsg": "string"
    },
    "responseCode": "OK",
    "result": {
        "metadata": {... similar to above API},
        "datasets": {
            "dataset_id_1": {
                "isParameterized": true,
                "parameters": ["$state"],
                "data": {
                    "rj": {
                        "signedUrl": "url"
                    },
                    "tn": {
                        "signedUrl": "url"
                    },
                    "...otherParameters": {
                        "signedUrl": "url"
                    }
                }
            },
            "dataset_id_2": {
                "isParameterized": false,
                "parameters": null,
                "data": {
                    "default": {
                        "signedUrl": "url"
                    }
                }
            }
        }
    }
}

Explaination Explanation -

  • If the report dataset file path is parameterized then

    • isParameterized - true

    • parameters - paramater parameter attribute

    • data object will contain all resolved parameter values along with the signed Url url to download the file

  • Else

    • data object will have default key with the signed Url url to download the file.


Error Response

Unauthorized Access - Status Code 401

Code Block
languagejson
{
    "id": "api.report.read",
    "ver": "v1",
    "ts": "timestamp",
    "params": {
        "resmsgid": null,
        "msgid": "string",
        "err": "UNAUTHORIZED_USER",
        "status": "UNAUTHORIZED_USER",
        "errmsg": "You are not authorized."
    },
    "responseCode": "UNAUTHORIZED",
    "result": {}
}


Internal Server Error - Status Code - 500

Code Block
languagejson
{
  "id": "api.report.read",
  "ver": "v1",
  "ts": "timestamp",
  "params": {
    "resmsgid": null,
    "msgid": "string",
    "err": "string",
    "status": "SERVER_ERROR",
    "errmsg": "string"
  },
  "responseCode": "SERVER_ERROR",
  "result": {}
}


Invalid Report Id - Status Code 404

Code Block
languagejson
{
  "id": "api.report.read",
  "ver": "1.0.0",
  "params": {
    "resmsgid": "string",
    "msgid": null,
    "status": "failed",
    "err": null,
    "errmsg": "no report found"
  },
  "responseCode": "string",
  "result": {}
}

...