martindstone / pagerduty-cli

A command line interface for PagerDuty
MIT License
91 stars 12 forks source link

paused_incident_reports/counts #42

Closed BillSidney closed 1 year ago

BillSidney commented 1 year ago

Not able to query the paused_incident_reports. Looks like the query succeeds.

 % pd --version
      pagerduty-cli/0.1.6 darwin-x64 node-v16.15.0
 %  pd rest:fetch -e=paused_incident_reports/counts \
      -P "service_id=XXXXXXX"  -k paused_count -t     

Fetching 1/1 👍, 0/1 👎... done
    TypeError: Cannot read properties of undefined (reading 'map')

Output with debug

  %  pd rest:fetch -e=paused_incident_reports/counts \
    -P "service_id=XXXXXX"  -k paused_count -t --debug
[DEBUG] Request: {
... 
[DEBUG] OK Response:
[DEBUG] Response Status: 200
[DEBUG] Response Data: {
  paused_incident_reporting_counts: {
    paused_count: 13,
    resolved_after_pause_count: 11,
    since: '2022-05-11T05:52:36.567964Z',
    triggered_after_pause_count: 2,
    until: '2022-11-09T20:47:12.567993Z'
  }
}
martindstone commented 1 year ago

hi @BillSidney , sorry for the confusion, paused_incident_reports/counts is not a "fetchable" endpoint (it doesnt return a paginated list of things); you'd want to use pd rest get -e paused_incident_reports/counts -P "service_id=XXXXXX" and optionally filter that through a JSON tool like jq or fx, for example pd rest get -e paused_incident_reports/counts -P "service_id=XXXXXX" | fx .paused_incident_reporting_counts.paused_count

Let me know if this resolves the issue for you...

BillSidney commented 1 year ago

Thanks for the quick reply! That solves my problem

martindstone commented 1 year ago

Awesome glad to hear it @BillSidney I will close this issue now, thanks for reaching out