Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing an array to the querystring #3

Closed
tdmalone opened this issue Sep 28, 2018 · 0 comments
Closed

Passing an array to the querystring #3

tdmalone opened this issue Sep 28, 2018 · 0 comments

Comments

@tdmalone
Copy link
Contributor

tdmalone commented Sep 28, 2018

Hi there,

Thanks for putting this together!

Having a small issue with the incidents.listIncidents endpoint (PD docs), when trying to pass through statuses. PagerDuty needs them passed through as an array, but I can't figure out how to pass them in a format that will be appropriately encoded (statuses[]=triggered) by Node's querystring library, which is being used here.

I'm not sure if I'm missing something obvious... or whether another querystring helper library might be required instead?

What I've tried

pagerDuty.incidents.listIncidents({ statuses: 'triggered' })
  • value of qs after line 34 in pd.js: ?statuses=triggered
  • response from PagerDuty: Invalid Input Provided / error 2001 / Statuses must be a Array.
pagerDuty.incidents.listIncidents({ statuses: ['triggered'] })
  • value of qs after line 34 in pd.js: ?statuses=triggered
  • response from PagerDuty: Invalid Input Provided / error 2001 / Statuses must be a Array.
pagerDuty.incidents.listIncidents({ statuses: "['triggered']" })
  • value of qs after line 34 in pd.js: ?statuses=%5B'triggered'%5D
  • response from PagerDuty: Invalid Input Provided / error 2001 / Statuses must be a Array.
pagerDuty.incidents.listIncidents( "statuses[]=triggered" )
  • value of qs after line 34 in pd.js: ?
  • response from PagerDuty: all of my incidents ;)

What I'm looking for

  • value of qs after line 34 in pd.js: ?statuses[]=triggered
  • response from PagerDuty: hopefully a list of just triggered incidents 😄

Is there something else I haven't thought of... or otherwise something else this library can do to help these through to the querystring sent to PagerDuty?

For instance, it looks like query-string provides an arrayFormat option which might fix this issue: https://www.npmjs.com/package/query-string#arrayformat-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant