martindstone / pagerduty-cli

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

feat(service-directory): make `service` queries faster #12

Closed georgettica closed 3 years ago

georgettica commented 3 years ago

in the UI, when searching for

https://${BASEURL}/service-directory?direction=desc&query=${SERVICENAME}&sort_by=score&team_ids=all

a result comes back fairly quickly

in contrast to

pd service:list --filter "name=${SERVICENAME}"

can the API for service-directory be added to the core api?

martindstone commented 3 years ago

Hi @georgettica , thanks for reporting this. I too would like the /service-directory endpoint to be publicly available, but I don't have any insight into when that might happen. I try to constrain PD CLI to only use publicly available documented endpoints for the named commands. That said, if you wanted to speed up that specific search that you're doing, I recommend you use the -n flag to service:list, which populates the query= parameter when doing a GET to /services. You can then optionally still use the --filter flag to get down to just the results you want (query= is a substring search, but filter= can take regexes like '^full name only exact match$'.)

Hope this helps, and thanks!

georgettica commented 3 years ago

I'll try and use these flags, thanks!

martindstone commented 3 years ago

Thanks... please let me know how that goes, I am always looking to improve the cli...

georgettica commented 3 years ago

I found the -n to improve the cli and will create another issue to track a possible change that is required in the --filter command (which is not under your direct control but should be noted)

martindstone commented 3 years ago

OK... I am going to close this for now and hope that --filter gets better soon haha