• 0
Sign in to follow this  

pull list of services under a group



Is there a method to pull all the services [websites] from a group ?

I have created a group "TEST" under services, and added 50 websites for monitoring, I need to pull a list of services from TEST group. thanks

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi Rahamath,

You can accomplish this by using the REST API endpoint "/service/services" along with filtering on the "serviceFolderId" property.

See "Example 1" on this page and notice how its JSON output contains "serviceFolderId".

  "status" : 200,
  "errmsg" : "OK",
  "data" : {
    "total" : 5,
    "items" : [ {
      "type" : "webservice",
      "id" : 58,
      "name" : "Form-based auth",
      "description" : "",
      "serviceFolderId" : 1,
      "stopMonitoring" : false,
      "stopMonitoringByFolder" : false,
      "disableAlerting" : false,
      "individualSmAlertEnable" : false,
      "individualAlertLevel" : "warn",
      "overallAlertLevel" : "warn",
      "alertStatus" : "none",
      "sdtStatus" : "none-none-none",
      "alertDisableStatus" : "none-none-none",
      "pollingInterval" : 10,
      "transition" : 1,
      "testLocation" : "{\"smgIds\":[3],\"all\":false}",
      "globalSmAlertCond" : 0,
      "useDefaultLocationSetting" : false,
      "useDefaultAlertSetting" : false,
      "userPermission" : "write",
      "checkpoints" : [ {
        "id" : 292,
        "geoInfo" : "Overall",
        "smgId" : 0

You'll want to execute the same REST API query as Example 1 (with your own credentials) and check the output to find at least one service in your desired service group. Note your output's numeric value for "serviceFolderId" because you'll need to execute the query again filtering on that ID.

Now look at "Example 2" on the same page for an example of using query parameters. In this example, the query parameter is "fields" but you need to use the query parameter of "filter". You can use the code in Example 2 but change the credentials and the query parameters. To change the query parameters find this line code:

queryParams = '?fields=id,name,host,alertStatus&sort=-alertStatus'

Change that line of code to:

queryParams = '?filter=serviceFolderId:1'

You will need to replace the number 1 with whatever serviceFolderId you found by running first query from "Example 1".

If you're still having trouble, don't hesitate to use our 24/7 chat support! You can also post your code here for better help troubleshooting.

Edited by Jeoffri Davis
Deleted an unnecessary sentence.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this