Skip to content

Commit

Permalink
Added update_website example
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr2595 committed Feb 8, 2024
1 parent 2c28ec2 commit 0904d42
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Rest API/Python/update_website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/python

import os
from pprint import pprint
import requests
from dotenv import load_dotenv

load_dotenv()

# Account Info
portal = os.getenv("PORTAL")
bearer = os.getenv("BEARER")

resourcePath = '/website/websites/21'
queryParams = ''
data = '{"properties":[{"name":"test_prop","value":"updated by API"}]}'

# Construct URL
url = 'https://' + portal + '.logicmonitor.com/santaba/rest' + \
resourcePath + queryParams

# Construct headers
auth = 'bearer ' + bearer
headers = {'Content-Type': 'application/json',
'X-version': '3', 'Authorization': auth}

# Make request
response = requests.patch(
url, data=data, headers=headers, verify=True, timeout=15)
response_json = response.json()

# Print response
pprint(str(response_json))

0 comments on commit 0904d42

Please sign in to comment.