Versions Compared

Key

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

...

All methods or endpoints described in this API have a base URL (typically http://<host>:11015 or https://<host>:10443) that precedes the resource identifier, as described in the RESTful API Conventions. These methods return a status code, as listed in the RESTful API Status Codes.

Generating Reports

Code Block
POST /v3/namespaces/system/apps/ReportGenerationApp/spark/ReportGenerationSpark/methods/reports

With Request Json provided as part of the request body.

Request JSON with explanation of JSON fields:

Code Block
{
  "name":<Name of the report>,
  "start":<start-time-in-seconds>,
  "end":<end-time-in-seconds>,

  "fields":[
     <include-this-field-1-in-report>,
      <...>,
     <include-this-field-N-in-report>
  ],

  "filters":[
     {
        // value filter
        "fieldName":<name-of-the-field-to-filter-on>,
        "whitelist":[
           <acceptable-value-1>,
           <..>
           <acceptable-value-N>
        ]
     },
     {
        // value filter
        "fieldName":<name-of-the-field-to-filter-on>,
        "blacklist":[
           <non-acceptable-value-1>,
           <...>
           <non-acceptable-value-N>
        ]
     },
     {
        // range filter
        "fieldName":"<name-of-the-field-to-filter-on>",
        "range":{
           "min":<minimum-allowed-value>
           "max":<maximum-allowed-value>
        }
     }
  ],
  "sort":[
     {
        "order":"ASCENDING (or) DESCENDING",
        "fieldName":"<name-of-the-field-to-sort-by>"
     }
  ]
}

Example request JSON:

Code Block
{
  "name":"Failed, Stopped, Running, Succeeded runs - Jul 23, 2018 00:00am to Jul 24, 2018 21:00pm",
  "start":1532329200,
  "end":1532491200,
  "fields":[
     "artifactName",
     "applicationName",
     "program",
     "programType",
     "namespace",
     "status",
     "start",
     "end"
  ],
  "filters":[
     {
        "fieldName":"status",
        "whitelist":[
           "FAILED",
           "STOPPED",
           "RUNNING",
           "COMPLETED",
           "KILLED"
        ]
     },
     {
        "fieldName":"namespace",
        "whitelist":[
           "default"
        ]
     }
  ]
}

...

Note: Currently sort cannot be performed on more than one field.

Listing Reports

Code Block
GET /v3/namespaces/system/apps/ReportGenerationApp/spark/ReportGenerationSpark/methods/reports

Query Param

Description

offset

offset to read reports from

limit

limit on the number of reports to return

Response JSON with explanation for fields:

Code Block
{
  "offset":<offset>,
  "limit":<limit>,
  "total":<total-reports-size-returned>,
  "reports":[
     {
        "id":<report-id>,
        "name":<report-name>,
        "created":<creation-time-seconds>,
        "expiry":<report-expiry-time-seconds>,
        "status":<report-status>
     },
     ...
  ]
}

Example Response JSON:

Code Block
{
  "offset":0,
  "limit":20,
  "total":7,
  "reports":[
     {
        "id":"18a782b5-8fd4-11e8-ae71-acde48001122",
        "name":"Failed, Succeeded, Running, Stopped runs - Jul 24, 2018 22:29pm to Jul 24, 2018 23:29pm",
        "created":1532500174,
        "expiry":1532672986,
        "status":"COMPLETED"
     },
     ...
     {
        "id":"09ec25f4-8fd4-11e8-9d5d-acde48001122",
        "name":"Failed, Succeeded, Running, Stopped runs - Jul 24, 2018 22:29pm to Jul 24, 2018 23:29pm",
        "created":1532500149,
        "expiry":1532672965,
        "status":"COMPLETED"
     }
  ]
}

Sharing Reports

On Authentication enabled clusters, reports are isolated by logged-in users who generated the reports, If you wish, you can generate an encrypted share-id for your report, that can be used by others to access the report.

...

Code Block
{
   "shareId":<share-id>
}

Viewing Report Status

The info endpoint can be used to get the report status and summary for a report. It can be queried either by providing the report-id or by providing a share-id through query param.

...

Code Block
{
  "request":{
     <report-generation-request>
  },
  "error" : <error-message>,
  "name":<name-of-the-report>,
  "created":<creation-time>,
  "status":"FAILED"
}

Downloading Report Contents

The download endpoint can be used to download the report contents. You can either provide a report id or a share id through a query parameter.

Code Block
GET using report-id : /v3/namespaces/system/apps/ReportGenerationApp/spark/ReportGenerationSpark/methods/reports/download?report-id=<report-id>
GET using share-id : /v3/namespaces/system/apps/ReportGenerationApp/spark/ReportGenerationSpark/methods/reports/download?share-id=<share-id>

{
  "offset":<offset>,
  "limit":<limit-of-records-to-return>,
  "total":<total-number-of-records-in-report>,
  "details":[
     {
        "field1":<value>,
        ...
        "fieldN":<value>
     },
   ...
  ]
}

Example JSON response:

Code Block
{
  "offset":0,
  "limit":20,
  "total":25,
  "details":[
     {
        "duration":21,
        "program":"DataPipelineWorkflow",
        "programType":"Workflow",
        "applicationName":"testPipeline",
        "artifactName":"cdap-data-pipeline",
        "status":"COMPLETED",
        "end":1532499023,
        "start":1532499002,
        "namespace":"default"
     },
     ...
  ]
}

Saving Reports

By default reports expire after 2 weeks, however they can be saved by using the following REST endpoint:

...

Code Block
{
  "name" : <report-name>,
  "description" : <description-for-report>
}

Deleting Reports

Unneeded reports (whether generated or failed) can be deleted by making a call to the following endpoint:

...