0

I am sending a request like below:

curl --request GET \
  --url 'https://api.pagerduty.com/services?query=my-service-name' \
  --header 'Accept: application/vnd.pagerduty+json;version=2' \
  --header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
  --header 'Content-Type: application/json'

I was expecting that i can use this to filter the list of services JSON to my service only using query=my-service-name. But this just returns a JSON list of first 25 services. API Guide says:

query(string) - Filters the result, showing only the tags whose labels match the query.

Is there any way to get the details of service just with the service name? Currently i can add a huge limit to the query which will essentially bring all service names and i can get my service from that but that is hardly efficient.

I know i can do GET with service ID, Like below:

curl --request GET \
  --url https://api.pagerduty.com/services/SVC_ID \
  --header 'Accept: application/vnd.pagerduty+json;version=2' \
  --header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
  --header 'Content-Type: application/json'

but my requirement is to use the service name.

1 Answers1

0

Your question lines up on the time-frame of when PagerDuty broke the query filter for services. Your query looks accurate from my experience.

See:

https://community.pagerduty.com/forum/t/query-filter-is-not-working/3853

Also, while the description of the API says "filters on tags" you'll find it filters on the name of the service first.

Preocts
  • 76
  • 4