### Perform GET Request with PowerShell Source: https://rmm.datto.com/help/en/Content/2SETUP/APIv2 Provides an example of how to make a GET request using PowerShell. GET requests are used for data retrieval. The request method is generically referred to as [API Method], and any [API Request Body] not needed should be NULL or blank. ```powershell /* * Performing a GET request with PowerShell can be achieved by using the following code. * This is included as **powershell_request.ps1** in the Downloadable example code. */ // Placeholder for PowerShell GET request example. ``` -------------------------------- ### Batch Script with Attached File Installation Source: https://rmm.datto.com/help/en/Content/3NEWUI/Automation/Components/Scripting This Batch script demonstrates how to install a Windows Installer package ('install.msi') that is attached to the component. It uses 'msiexec' for silent installation and 'exit' to end the script. ```batch @echo off msiexec /i install.msi /qn echo Product Installed Successfully exit ``` -------------------------------- ### Example: Fetching All Devices with Pagination Source: https://rmm.datto.com/help/en/Content/2SETUP/APIv2 This example demonstrates how to retrieve a list of all devices associated with an account, using query parameters for pagination. ```APIDOC ## GET /v2/account/devices ### Description Fetches a list of all devices in the account, with support for pagination. ### Method GET ### Endpoint `/v2/account/devices` ### Parameters #### Query Parameters - **max** (integer) - Optional - The maximum number of results to return per page (default is 250). - **page** (integer) - Optional - The page number to retrieve. ### Request Example To retrieve the fifth page of devices with a maximum of 5 devices per page: `/v2/account/devices?max=5&page=5` ### Response #### Success Response (200) - **devices** (array) - A list of device objects. - **uid** (string) - The unique identifier of the device. - **hostname** (string) - The hostname of the device. #### Response Example ```json { "devices": [ { "uid": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "hostname": "Device-01" }, { "uid": "b2c3d4e5-f6a7-8901-2345-678901bcdef0", "hostname": "Device-02" } ] } ``` ``` -------------------------------- ### Microsoft Teams Webhook Configuration and Payload Example Source: https://rmm.datto.com/help/en/Content/3NEWUI/Monitors/Webhooks Guides users through configuring Microsoft Teams connectors and creating JSON payloads for Datto RMM webhook alerts. Includes an example of an alert-triggered payload for Microsoft Teams. ```JSON { "type": "AdaptiveCard", "attachments": [ { "content": { "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "kind": "TeamsWebhook", "type": "AdaptiveCard", "version": "1.4", "body": [ { "type": "TextBlock", "size": "medium", "weight": "bolder", "text": "RMM Alert - Designed to be used with Microsoft Teams Workflows", "wrap": true }, { "type": "ColumnSet", "columns": [ { "type": "Column", "items": [ { "type": "Image", "url": "https://i.imgur.com/YJhsAgQ.png", "altText": "RMM Alert", "size": "small" } ], "width": "auto" }, { "type": "Column", "items": [ { "type": "TextBlock", "weight": "bolder", "text": "[alert_type] Alert", "wrap": true }, { "type": "TextBlock", "spacing": "none", "text": "[alert_priority]", "isSubtle": true, "wrap": true } ], "width": "stretch" } ] } , { "type": "TextBlock", "text": "[alert_message_en]", "wrap": true }, { "type": "FactSet", "facts": [ { "title": "Site:", "value": "[site_name]" }, { "title": "Device:", "value": "[device_hostname] / [device_ip]" }, { "title": "Last User:", "value": "[last_user]" }, { "title": "Description:", "value": "[device_description]" }, { "title": "OS:", "value": "[device_os]" } ] } ], "actions": [ { "type": "Action.OpenUrl", "title": "Device", "url": "https://[platform].rmm.datto.com/device/[device_id]" }, { "type": "Action.OpenUrl", "title": "Site", "url": "https://[platform].rmm.datto.com/site/[site_id]" }, { "type": "Action.OpenUrl", "title": "View Alert", ``` -------------------------------- ### POST Request Examples Source: https://rmm.datto.com/help/en/Content/2SETUP/APIv2 Instructions and examples for performing POST requests with cURL, PowerShell, and C#. ```APIDOC ## POST Request ### Description POST requests are used for creating or submitting data to the API. The structure for performing a POST request is similar to a GET request, with the method type changed to POST. ### Method POST ### Endpoint [Varies based on the specific resource] ### Parameters Refer to individual resource documentation for specific parameters. ### Request Example (Conceptual) ```json { "key": "value" } ``` ### Response Refer to individual resource documentation for specific response details. ``` -------------------------------- ### Example: Fetching Device Data Source: https://rmm.datto.com/help/en/Content/2SETUP/APIv2 This example illustrates how to retrieve data for a specific device using its unique identifier. ```APIDOC ## GET /v2/device/{deviceUid} ### Description Fetches data of the device identified by the given device Uid. ### Method GET ### Endpoint `/v2/device/{deviceUid}` ### Parameters #### Path Parameters - **deviceUid** (string) - Required - The unique identifier of the device. ### Request Example No request body is required for this GET request. ### Response #### Success Response (200) - **uid** (string) - The unique identifier of the device. - **hostname** (string) - The hostname of the device. - **os** (string) - The operating system of the device. #### Response Example ```json { "uid": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "hostname": "Example-PC", "os": "Windows 10 Pro" } ``` ``` -------------------------------- ### PowerShell: Get Windows Installation Path Source: https://rmm.datto.com/help/en/Content/4WEBPORTAL/Components/Scripting A PowerShell command to retrieve the installation path and directory of Windows. This demonstrates the more extensive capabilities of PowerShell compared to Batch for system information retrieval. ```powershell Get-Command SystemRoot ```