Get Website Groups
Last updated on 20 January, 2020You can use LogicMonitor’s REST API to programmatically get a list of website groups or to get information about a particular website group.
Get a list of website groups
Returns a list of website groups
HTTP Method:GET
URI: /service/groups
Request Parameters:
By default, 50 website groups will be returned. You can include sort, filter, fields, size, and offset parameters to control what data is included in the response and how it is formatted. Note that query parameters are not considered part of the resource path, and should not be included the calculation of the LMv1 authentication signature.
Property |
Syntax |
Description |
Example URI |
sort | sort={+ or -}property | Sorts the response by the property specified in either increasing (+) or decreasing (-) order | /service/groups?sort=-id |
filter | filter=property{operator}value | Filters the response according to the operator and value specified. Note that you can use * to match on more than one character.You can use the ‘.’ character to filter values within an object (e.g. custom properties), and multiple filters can be separated by a comma.
Operators include:
|
/service/groups?filter=name:QAservice |
fields | fields={list of properties separated by commas} | Filters the response to only include the following fields for each object | /service/groups?fields=name,id |
size | size=integer | The number of results to display. Max is 1000. | /service/groups?size=5 |
offset | offset=integer | The number of results to offset the displayed results by | /service/groups?offset=2 |
Example 1: Get a list of website groups
The following request returns a list of all website groups that exist in the api.logicmonitor.com account
Request:
curl --user 'apiUser:example' -X GET "https://api.logicmonitor.com/santaba/rest/service/groups"
Response:
{ "status" : 200, "errmsg" : "OK", "data" : { "total" : 5, "items" : [ { "id" : 1, "name" : "sarah", "description" : "", "disableAlerting" : false, "stopMonitoring" : false, "parentId" : 0, "alertStatus" : "unconfirmed-critical", "sdtStatus" : "none-none-none", "alertDisableStatus" : "none-none-disable", "hasServicesDisabled" : false, "numOfServices" : 13, "userPermission" : "write", "serviceProperties" : [ { "name" : "billing", "value" : "website" }, { "name" : "team", "value" : "TechOps" } ], "numOfDirectServices" : 3, "testLocation" : "{\"smgIds\":[2,3,4,5],\"all\":false}", "fullPath" : "", "subGroups" : [ { "id" : 12, "name" : "Production", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 4, "numOfDirectServices" : 4, "alertDisableStatus" : "none-none-none", "alertStatus" : "none", "sdtStatus" : "none-none-none", "fullPath" : "Production", "description" : "" }, { "id" : 14, "name" : "QA", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 4, "numOfDirectServices" : 4, "alertDisableStatus" : "none-none-none", "alertStatus" : "none", "sdtStatus" : "none-none-none", "fullPath" : "QA", "description" : "" } ] }, { "id" : 12, "name" : "Production", "description" : "", "disableAlerting" : false, "stopMonitoring" : false, "parentId" : 1, "alertStatus" : "none", "sdtStatus" : "none-none-none", "alertDisableStatus" : "none-none-none", "hasServicesDisabled" : false, "numOfServices" : 4, "userPermission" : "write", "serviceProperties" : [ { "name" : "username", "value" : "Bob" }, { "name" : "password", "value" : "password" } ], "numOfDirectServices" : 4, "testLocation" : "{\"all\":false,\"smgIds\":[1,2,3,4,5]}", "fullPath" : "Production", "subGroups" : [ ] }, { "id" : 14, "name" : "QA", "description" : "", "disableAlerting" : false, "stopMonitoring" : false, "parentId" : 1, "alertStatus" : "none", "sdtStatus" : "none-none-none", "alertDisableStatus" : "none-none-none", "hasServicesDisabled" : false, "numOfServices" : 4, "userPermission" : "write", "serviceProperties" : [ ], "numOfDirectServices" : 4, "testLocation" : "{\"all\":true}", "fullPath" : "QA", "subGroups" : [ { "id" : 15, "name" : "Tests", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 0, "numOfDirectServices" : 0, "alertDisableStatus" : "none-none-none", "alertStatus" : "none", "sdtStatus" : "none-none-none", "fullPath" : "QA/Tests", "description" : "" } ] }, { "id" : 15, "name" : "Tests", "description" : "", "disableAlerting" : false, "stopMonitoring" : false, "parentId" : 14, "alertStatus" : "none", "sdtStatus" : "none-none-none", "alertDisableStatus" : "none-none-none", "hasServicesDisabled" : false, "numOfServices" : 0, "userPermission" : "write", "serviceProperties" : [ ], "numOfDirectServices" : 0, "testLocation" : "{\"all\":true}", "fullPath" : "QA/Tests", "subGroups" : [ ] } ], "searchId" : null }
Example 2: Get a list of website groups
The following request returns the id, name, and stopMonitoring values for each of the website groups in api.logicmonitor.com, sorted in ascending order by the id,
Request:
curl --user 'apiUser:example' -X GET "https://api.logicmonitor.com/santaba/rest/service/services?fields=id,name,stopMonitoring&sort=+id"
Response:
{ "status" : 200, "errmsg" : "OK", "data" : { "total" : 8, "items" : [ { "id" : 22, "name" : "A_Record_Kittens_LB", "stopMonitoring" : false }, { "id" : 21, "name" : "CName_check", "stopMonitoring" : false },{ "id" : 31, "name" : "newsWebService", "stopMonitoring" : false }, { "id" : 34, "name" : "newWebService", "stopMonitoring" : false }, { "id" : 32, "name" : "pingService", "stopMonitoring" : false } ] }
Get information about a particular website group
Returns details for a particular website group
HTTP Method:GET
URI: /service/groups/{id}
Example 1: Get information about a particular website group
The following request returns the details for the website group with id of 1 (the root group).
Request:
curl --user 'apiUser:example' -X GET "https://api.logicmonitor.com/santaba/rest/service/groups/1"
Response:
{ "status" : 200, "errmsg" : "OK", "data" : { "id" : 1, "name" : "sarah", "description" : "", "disableAlerting" : false, "stopMonitoring" : false, "parentId" : 0, "alertStatus" : "unconfirmed-critical", "sdtStatus" : "none-none-none", "alertDisableStatus" : "none-none-disable", "hasServicesDisabled" : false, "numOfServices" : 13, "userPermission" : "write", "serviceProperties" : [ { "name" : "billing", "value" : "website" }, { "name" : "team", "value" : "TechOps" } ], "numOfDirectServices" : 3, "testLocation" : "{\"smgIds\":[2,3,4,5],\"all\":false}", "fullPath" : "", "subGroups" : [ { "id" : 11, "name" : "Internal Services", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 2, "numOfDirectServices" : 2, "alertDisableStatus" : "none-none-none", "alertStatus" : "unconfirmed-critical", "sdtStatus" : "none-none-none", "fullPath" : "Internal Services", "description" : "" }, { "id" : 12, "name" : "Production", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 4, "numOfDirectServices" : 4, "alertDisableStatus" : "none-none-none", "alertStatus" : "none", "sdtStatus" : "none-none-none", "fullPath" : "Production", "description" : "" }, { "id" : 14, "name" : "QA", "userPermission" : "write", "disableAlerting" : false, "stopMonitoring" : false, "hasServicesDisabled" : false, "numOfServices" : 4, "numOfDirectServices" : 4, "alertDisableStatus" : "none-none-none", "alertStatus" : "none", "sdtStatus" : "none-none-none", "fullPath" : "QA", "description" : "" } ] }
Example 2: Get information about a particular website group
The following request returns the id, name of, and number of websites within the group with id 1.
Request:
curl --user 'apiUser:example' -X GET "https://api.logicmonitor.com/santaba/rest/service/services/1?fields=id,name,numOfServices"
Response:
{ "status" : 200, "errmsg" : "OK", "data" : { "id" : 1, "name" : "sarah", "numOfServices" : 13 }