Webサイトグループを取得する
最終更新日: 20 年 2020 月 XNUMX 日LogicMonitorのRESTAPIを使用して、プログラムでWebサイトグループのリストを取得したり、特定のWebサイトグループに関する情報を取得したりできます。
Webサイトグループのリストを取得する
Webサイトグループのリストを返します
HTTPメソッド:GET
URI:/ service / groups
リクエストパラメータ:
デフォルトでは、50のWebサイトグループが返されます。 並べ替え、フィルター、フィールド、サイズ、オフセットのパラメーターを含めて、応答に含めるデータとそのフォーマット方法を制御できます。 クエリパラメータはリソースパスの一部とは見なされないため、LMv1認証署名の計算に含めるべきではないことに注意してください。
プロパティ |
構文 |
説明 |
URIの例 |
sort | sort = {+または-} property | 昇順(+)または降順(-)のいずれかで指定されたプロパティで応答を並べ替えます | / service / groups?sort = -id |
filter | filter = property {operator} value | 指定された演算子と値に従って応答をフィルタリングします。 *を使用して複数の文字に一致させることができることに注意してください。「。」を使用できます。 オブジェクト内の値(カスタムプロパティなど)をフィルタリングする文字。複数のフィルターはコンマで区切ることができます。
演算子は次のとおりです。
|
/ service / groups?filter = name:QAservice |
フィールド | fields = {コンマで区切られたプロパティのリスト} | 応答をフィルタリングして、各オブジェクトの次のフィールドのみを含めます | / service / groups?fields = name、id |
サイズ | size = integer | 表示する結果の数。 最大は1000です。 | / service / groups?size = 5 |
オフセット | offset = integer | 表示された結果を相殺する結果の数 | / service / groups?offset = 2 |
例1:Webサイトグループのリストを取得する
次のリクエストは、api.logicmonitor.comアカウントに存在するすべてのWebサイトグループのリストを返します
要求:
curl --user'apiUser:example '-X GET "https://api.logicmonitor.com/santaba/rest/service/groups"
応答:
{ "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 }
例2:Webサイトグループのリストを取得する
次のリクエストは、api.logicmonitor.com内の各WebサイトグループのID、名前、およびstopMonitoringの値を、IDの昇順で並べ替えて返します。
要求:
curl --user'apiUser:example '-X GET "https://api.logicmonitor.com/santaba/rest/service/services?fields=id,name,stopMonitoring&sort=+id"
応答:
{"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}]}
特定のWebサイトグループに関する情報を取得する
特定のWebサイトグループの詳細を返します
HTTPメソッド:GET
URI:/ service / groups / {id}
例1:特定のWebサイトグループに関する情報を取得する
次のリクエストは、IDが1のWebサイトグループ(ルートグループ)の詳細を返します。
要求:
curl --user'apiUser:example '-X GET "https://api.logicmonitor.com/santaba/rest/service/groups/1"
応答:
{"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": "内部サービス"、" description ":" "}、{" id ":12、" name ":" Production "、" u serPermission ":" 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": ""}]}
例2:特定のWebサイトグループに関する情報を取得する
次のリクエストは、IDが1のグループ内のWebサイトのID、名前、および数を返します。
要求:
curl --user'apiUser:example '-X GET "https://api.logicmonitor.com/santaba/rest/service/services/1?fields=id,name,numOfServices"
応答:
{"status":200、 "errmsg": "OK"、 "data":{"id":1、 "name": "sarah"、 "numOfServices":13}