Untitled

 avatar
unknown
plain_text
a year ago
1.5 kB
2
Indexable
import requests
from tkinter import Tk, Label, Button, Entry

class App:
    def __init__(self, master):
        self.master = master
        master.title("ManageEngine MDM API Integration")

        self.label = Label(master, text="Enter user's email")
        self.label.pack()

        self.entry = Entry(master)
        self.entry.pack()

        self.button = Button(master, text="Search Devices", command=self.search_devices)
        self.button.pack()

        self.lock_button = Button(master, text="Lock All Devices", command=self.lock_all_devices)
        self.lock_button.pack()

    def search_devices(self):
        email = self.entry.get()
        headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
        params = {'email': email}
        response = requests.get('https://api.manageengine.com/mdm/devices', headers=headers, params=params)
        if response.status_code == 200:
            devices = response.json()
            # Display devices

    def lock_all_devices(self):
        headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
        # Assume device_ids stores all the device ids associated with the user
        for device_id in device_ids:
            params = {'device_id': device_id}
            response = requests.post('https://api.manageengine.com/mdm/devices/lock', headers=headers, params=params)
            if response.status_code == 200:
                print(f"Locked device {device_id}")

root = Tk()
app = App(root)
root.mainloop()