PUT Tag
PUT Tag
Request used to update an existing Tag for a given account
URL
https://REGION.rest.logs.insight.rapid7.com/management/tags/:tag_id
REGION is the data center for your account - e.g. "us" or "eu"
Method
POST
Authentication
Owner or Read Write key is required.
URL Params
tag_id=1037ce75-b8e1-4d48-acd4-961831c216e9
Data Params
json
1{2"tag": {3"actions": [4{5"enabled": true,6"min_matches_count": 0,7"min_matches_period": "Hour",8"min_report_count": 1,9"min_report_period": "Hour",10"targets": [11{12"alert_content_set": {13"le_context": "true"14},15"params_set": {16"direct": "test@test.com",17"teams": "",18"users": ""19},20"type": "mailto"21}22],23"type": "Alert"24}25],26"labels": [27{28"color": "3498db",29"id": "a6b486c1-306f-4575-95cc-0eee40f8f7e6",30"name": "Test Label",31"reserved": false,32"sn": 102533}34],35"name": "Foo Bar Tag",36"patterns": [37"/Foo Bar/"38],39"sources": [40{41"id": "3358b7ee-9238-4181-ab80-afb026f38081"42}43],44"type": "Alert"45}46}
Success Response
Code 200Content:
json
1{2"tag": {3"type": "Alert",4"id": "d3132c7a-f9d1-4485-9898-3a2bd2959a05",5"name": "Foo Bar Tag",6"sources": [7{8"id": "3358b7ee-9238-4181-ab80-afb026f38081",9"retention_period": "default",10"token": "993fcb68-2775-4f44-94b3-b8612d9213ef",11"name": "My Web Log",12"stored_days": []13}14],15"actions": [16{17"id": "139b4be1-3069-425e-afa4-66a66d8196dc",18"min_matches_count": 0,19"min_report_count": 1,20"min_matches_period": "Hour",21"min_report_period": "Hour",22"targets": [23{24"id": null,25"type": "Mailto",26"params_set": {27"direct": "test@test.com",28"teams": "",29"users": ""30},31"alert_content_set": {32"le_context": "true"33}34}35],36"enabled": true,37"type": "Alert"38}39],40"patterns": [41"TEST"42],43"labels": [44{45"id": "a6b486c1-306f-4575-95cc-0eee40f8f7e6",46"sn": 1025,47"name": "Test Label",48"color": "3498db",49"reserved": false50}51]52}53}
Error Response
Sample Call
python
1import requests2import json34API_KEY = '00112233-4455-6677-8899-aabbccddeeff'5'678data ={"tag":{"actions":[{"enabled":True,"min_matches_count":0,"min_matches_period":"Hour","min_report_count":1,"min_report_period":"Hour","targets":[{"alert_content_set":{"le_context":"true"},"params_set":{"direct":"test@test.com","teams":"","users":""},"type":"mailto"}],"type":"Alert"}],"labels":[{"color":"3498db","id":"a6b486c1-306f-4575-95cc-0eee40f8f7e6","name":"Test Label","reserved":False,"sn":1025}],"name":"Foo Bar Tag","patterns":["/Foo Bar/"],"sources":[{"id":"3358b7ee-9238-4181-ab80-afb026f38081"}],"type":"Alert"}}910def handle_response(resp):11response = resp12if response.status_code >= 200:13print response.status_code14print response.text15return1617def make_request():18headers = {'Content-type': 'application/json', 'x-api-key': API_KEY}19body = json.dumps(data, separators=(',', ':'))20url = "https://us.rest.logs.insight.rapid7.com/management/tags/1037ce75-b8e1-4d48-acd4-961831c216e9"21req = requests.put(url, data=body, headers=headers)22return req2324def start():25req = make_request()26handle_response(req)2728if __name__ == '__main__':29start()
Notes
Did this page help you?