Tips on using API with Automox
Recently active
I am trying to get powerBi to pull data from:https://api.wifisensorcloud.com/I have been going over all the api documentation and reviewing powerbi support forums and I cannot get powerbi to pull the JSONThe supplier have given me the API Key, but I get the following error: “A web API key can only be specified when a web API key name is provided”BELOW ARE THE INFORMATION FROM SUPPLIERConnecting to the API The 5 services are hosted at:https://api.wifisensorcloud.com/Users.svchttps://api.wifisensorcloud.com/Locations.svchttps://api.wifisensorcloud.com/Devices.svchttps://api.wifisensorcloud.com/Sessions.svchttps://api.wifisensorcloud.com/Lookups.svcConnections using any protocol other than https (such as http) will be rejected. Requests for data should use the GET method with parameters supplied in a query string whereas data submissions/updates should use the POST method with parameters supplied in a JSON object. Examples of each of these methods are on the next pages.
I think I have found an error in the PowerShell request sample from the documentation for Automox’s "List All Devices" API call. The request sample has:$url = "https://console.automox.com/api/servers?o=:orgID&page=0&limit=500"This did not run until I changed :orgID to $orgID in order to reference my Organization ID.Actually, I now see that the sample does not include a definition of $orgID either. So, altogether IMO the sample should read,$apiKey = 'your_automox_api_key'$orgID = ‘your organization ID’$headers = @{ "Authorization" = "Bearer $apiKey" }$url = "https://console.automox.com/api/servers?o=$orgID&page=0&limit=500"$response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).ContentI raise this issue because the PowerShell error resulting from the sample isn’t very specific. Due to that, and because I am only beginning to use this API, it took me quite awhile to discover that the sample was incorrect as opposed to my having made a mistake. Therefor
If this doesn’t belong in the “Labs” portion, I apologize in advance. I’m migrating devices from one Zone to new Zones. I think I’ve got that process mostly down, but am now looking for the best way to use the API to read in a csv file with the new devices and join them to a new group in the new Zone. Do we have something like that, that I can use?
I am trying to get powerBi to pull data from: https://console.automox.com/api/servers I have been going over all the api documentation and reviewing powerbi support forums and I cannot get powerbi to pull the JSON I get the following error: A web API key can only be specified when a web API key name is provided I have tried using the API key as a username, doesn’t appear to work there either. Has anyone gotten PowerBi to successfully pull data from the Automox web api, and how did you do it?
Hi,Is there any endpoint or anyway that we can pull the data of Activity Log and Overview Report using the API yet?Thank you.
I’ve taken @jarod.smilkstein’s code from here. There’s 3 things to change in this code to make it work: put in your API key put in your orgID set the $limit variable to the size you want, with a maximum of 500 This code will pull down all your device info via the https://console.automox.com/api/serversAPI call, but you can sub that out for whatever info you’re wanting to pull. The data is saved to a csv, but you can also do manipulation to the $data object in the script first before outputting any data. You can use this example code to update any of your existing scripts that were created prior to the API limits. $apiKey = 'YOUR_API_KEY'$orgID = 'YOUR_ORG_ID'$page = 0$limit = 5$data = @()while($true) { $uri = "https://console.automox.com/api/servers?o=$orgID&api_key=$apiKey&l=$limit&p=$page" $resp = (Invoke-WebRequest -Method GET -Uri $uri -UseBasicParsing).Content | ConvertFrom-Json | Select-Object results $data += $resp.results if($resp.results.count -
I created a fun and friendly API script to run multiple policies on a device by using device name and policy names. You can customize it so that $Policylist is a parameter if you like and execute different policies as needed. Even though I am only executing on one device, I scripted it to pull all device names and ID’s so that I can customize it to run on a list of devices if we need to. Pieces of this script were used from many different posts here as well as the KB. Thanks to all that posted and shared with the group. I think this brings a lot of it together and gives some flexibility to automate just about whatever needs automating. Enjoy. ####Process Params #### Example .\baseimage.ps1 -DeviceName "tec006" -apiKey "xxxxx-xxxxx-xxxxxxx" param ([String]$DeviceName, [String]$apiKey) #### List of software to install as base image $Policylist = "Apply Dell Driver Updates","Install Sophos", "Install Mozilla Firefox", "Install Google Chrome", "Install Adobe Reader", "Install EgnyteWebE
Initiating a policy programmatically can be a power tool to help you automate your patching program with Automox APIs. If this is something that you’re currently doing or would like to start, please see our updated documentation in our developer portal below: https://developer.automox.com/openapi/axconsole/operation/executePolicy/ Please take special care to ensure that you are using the request body schema to identify the required action parameter of “remediateAll” “remediateServer”. These commands will make use of all the configurations made by the administrator that created the policy including patching notifications, reboot notifications and deferrals. As always, let us know if you have any questions!
Introduction How is the Documentation Organized? How do I use the API Documentation? Can I Submit a Call from the Developer Portal? Conclusion Introduction A feature or set of features is only useful if you know how to use it. That’s why we place so much emphasis on our Support documentation at Automox, from User Guides to Knowledge Base, to our Developer Portal. Within the Developer Portal lives our API documentation. To help you harness the full power of the documentation and our API, we’ll review how to get the most out of the Developer Portal. How is the Documentation Organized?First thing’s first, you need to know how to get to the Developer Portal. If you’re planning to use the API frequently, just bookmark this page.At a high level, our API documentation is laid out like this: What’s New: this is where we meticulously document anything/everything new with the API and our API documentation Errors: this page provides a high level overview of errors you may run into throughout
Introduction What is an API, anyways? Where do I Start? What are the Security Considerations? Does Automox have a Software Development Kit (SDK)? ConclusionIntroductionThe Automox API gives your organization a framework to leverage the powerful data within Automox, and take action without interacting with the console. In this article, we’ll discuss the API at a high level, and what resources are available for you to get started. What is an API, anyways?An Application Programming Interface (API) is a set of protocols and definitions that allow an application to communicate with other applications. Essentially, it’s a way for you to make Automox execute an action (e.g. create a policy), integrate Automox with another application your organization uses, or automate a process, all without using the console. Automox is a cloud-native application, and we built our console on top of the RESTful (or REST) API. Since our user interface, or console, is built on top of the API, you can do anyth
This API script will delete multiple users from an organization based on the users’ email address. It will then log the successes and failures in a location you specify. Just set the following: $apiKey = 'YOUR_API_KEY' - in your console, click on the three dots in the upper right, select KEYS, then copy your API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $orgID = 'YOUR_ORG_ID' - put your Org ID which can be found by looking at the URL from any Automox page and selecting the value after the “?o=”: [https://console.automox.com/device-detail?s=99999&o=1234 ]. In this example the Org ID is 1234. $logPath - set where you want the logs saved $toDelete - set your list of users you want deleted by their email addresses ### Replace the variables in this block with your Org ID & API key ### $orgID = 'YOUR_ORG_ID' $apiKey = 'YOUR_API_KEY' # Modify log path as desired $logPath = 'C:\Temp\' # List of users identifi
This script will set the tag(s) for all computers in a group. It will override any tags that are currently assigned to any of those systems. There are some areas in the code you’ll need to update to get the script to function: $orgID = 'YOUR_ORG_ID' - put your Org ID, which can be found by looking at the URL of your console and selecting the value after the “?o=”: https://console.automox.com/dashboard?o=999999 . In this example URL the Org ID is the 999999 portion. $apiKey = 'YOUR_API_KEY' - in your console, go to Settings->API and select the API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $grpID = 'GROUP_ID_OF_SYSTEMS_TO_TAG' - put your Group ID of the systems you want to set the tags on. It can be found by viewing the group page that lists devices in that particular group and grabbing the value after “gid=” in the URL. One way to get to that page is to go to the System Mgmt page then find the group
Hi all, I’m the API Tech Docs Writer here at Automox, and I wanted to introduce myself and let you know I’m here for any API-related questions you might have. To kick things off, here’s a quick Bash script I created. This script will allow you to invite a list of users and assign roles from a CSV to a given Automox organization. This is particularly useful in cases where you might have a number of users that need to be added, like when onboarding new employees. This script is org specific, so if you have multiple orgs, you will need to create a separate CSV for each org, containing the users to be added to that org and their roles. You would then need to run the script against each org, using the specific org id and api key. Copy the script, and save it as adduser_csv.sh in the directory of your choice. Use chmod u+x adduser_csv.sh to change the permissions of the file to make it executable. Create a CSV file containing 2 columns. The headers for these columns should be Email and R
I’m creating various scripts to automate remediation and collection of service logs. I want to leverage the API to duplicate my worklets across our clients. It seems most of the info I need is in the API docs (Although if there is a more robust reference guide I would appreciate a link =) ), however, the files I need to upload to the worklet don’t seem to have a field in the JSON object. Is there a way to upload files to a worklet through the API? Thank you for any help.
This API script will get a list of all of your policies in your organization and put them in an Excel spreadsheet. NOTE: Due to the way Excel auto-formats, the “schedule months” column may show in scientific notation due to the length. To fix the display of them, highlight the column, right-click on the column, click Format Column, choose Custom, then set the Type to 0. Just set the following: $apiKey = 'YOUR_API_KEY' - in your console, click on the three dots in the upper right, select KEYS, then copy your API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $orgID = 'YOUR_ORG_ID' - put your Org ID which can be found by looking at the URL on the device page and selecting the value after the “?o=”: [https://console.automox.com/device-detail?s=99999&o=1234 ]. In this example the Org ID is 1234. Example days per week : For scheduling days of the week, there will be 7 digits with a trailing zero to mark the end. Th
This API script will move multiple computers - regardless of what group they’re currently in - to a group you specify. You’ll need to set the following before running the script: $apiKey = 'YOUR_API_KEY' - in your console, go to Settings->API and select the API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $orgID = 'YOUR_ORG_ID' - put in your Org ID which can be found by looking at the URL on the dashboard and selecting the value after the “?o=”: [https://console.automox.com/dashboard?o=1234]. In this example the Org ID is 1234. $targetGID = 'GROUP_ID#_TO_MOVE_TO' - put your Group ID you want the devices moved to, which can be found by viewing the group page that lists devices in that particular group and grabbing the value after “gid=” in the URL. $toMove - Put your list of device names you want to be moved in quotes separated by a comma. You can also modify $logpath if you want to change the location where the
Original script written by @AX-Jon in May 2021, this will check compliance against any system the policy is running against. It can check for a policy, worklet, or required software policy. Just set the following: $apiKey = 'YOUR_API_KEY' - in your console, click on the three dots in the upper right, select KEYS, then copy your API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $orgID = 'YOUR_ORG_ID' - put your Org ID which can be found by looking at the URL on the device page and selecting the value after the “?o=”: [https://console.automox.com/device-detail?s=99999&o=1234 ]. In this example the Org ID is 1234. $policyID - put your PolicyID for the policy, worklet, or required software policy here. The easiest way to find the policy ID is to go to the page of the policy and grab the value in the URL after the “&pid=” : [https://console.automox.com/policy-custom-editor?frompage=system-management&pid=99
If you’ve never used an API before and want Automox to be your first (you always remember your first API) then this is the guide for you. By the end of this document you’ll have made your first API call and can see the results from your environment. Step 1: Download Postman Postman is a handy tool for testing out API calls to make sure they work before putting them in a script. They have a freemium version for individuals and small teams that you can download:https://www.getpostman.com/They’ve got versions for Windows, Mac and Linux so it doesn’t matter what OS you are working on. Install Postman and create yourself a login and you’re ready for the next step. Step 2: Find your API key in the console In your Automox console, click on Settings and then API: You’ll want the API key (the one on the bottom). There’s a handy copy icon to the right of the API key to get it into your clipboard. Step 3: Create your first API call For this exercise, we’re going to use the “Retrieve deta
Here is an API PowerShell script to export your Device Name, Model, Vendor, and Serial Number into a csv. If you have tried this, you may have found it can be tricky, as the model, vendor, and serial number are stored in a nested field named detail. This script provides the expanded “detail” column data for each device by name. Example Code: #Update these variables with your API Key and orgID. This script expects the $expDir path to already exist.# $apiKey = 'YOUR_API_KEY' $orgID = 'YOUR_ORG' $expDir = 'C:\Temp' ############################################################################################################# #Pull server detail from API and export as csv to defined directory $uri = "https://console.automox.com/api/servers?o=$orgID&api_key=$apiKey" $responseJson = (Invoke-WebRequest -UseBasicParsing -Uri $uri).Content | ConvertFrom-Json $Output = $responseJson | Select-Object NAME -ExpandProperty detail | Select-Object NAME, MODEL, VENDOR, SERIAL | Export-Csv -Path
This report is similar to viewing the software page, but it only reports the number of impacted devices (devices needing the patch) ordered by days exposed. It will look something like this: image2177×879 76 KB You’ll need to set the following before running the script: $apiKey = 'YOUR_API_KEY' - in your console, go to Settings->API and select the API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys. $orgID = 'YOUR_ORG_ID' - put in your Org ID which can be found by looking at the URL on the dashboard and selecting the value after the “?o=”: [https://console.automox.com/dashboard?o=1234]. In this example, the Org ID is 1234. $apiKey = 'YOUR_API_KEY' $orgID = 'YOUR_ORG_ID' $filepath = "C:\Temp\software_not_installed.csv" $page = 0 $limit = 500 $data = @() Write-Output "Page" while($true) { $headers = @{"Authorization" = "Bearer $apiKey" } $url = "https://console.automox.com/api/orgs/$orgID/packages?l=$limi
I am not sure if anyone has this need (or if this has been posted before), but here’s a little Powershell script you can run with a scheduled task to delete hosts that have not reported back to Automox after xxx days. I have this configured on a server and it helps me manage the Automox licenses automatically. #Define API Key and URL to get initial Machine list $apiKey = "<insert your API key here>" $headers = @{"Authorization" = "Bearer $apiKey"} $lengthPerPage = 100 $pageCounter = 0 $maxItems = 0 $maxDays = 30 do { $apiUrl = "https://console.automox.com/api/servers?l=$lengthPerPage&p=$pageCounter" $response = Invoke-RestMethod $apiUrl -Method 'GET' -Headers $headers -Body $body $a = $response | ConvertTo-Json $maxItems = $response.results.count $currentItem = 0 foreach($server in $response.results) { $lastCheckin = Get-Date if ($server.last_disconnect_time) { $lastCheckin = [datetime]$server.last_disconnect_time }
This API call will generate a list of all software in your organization and a count of how many are installed of each. Just update your API key, org ID, and where you want the file saved. It will overwrite an existing file if it exists. It also shows how you can use pagination to account for more than 500 results. $apiKey = 'YOUR_API_KEY' $orgID = 'YOUR_ORG_ID' $filepath = "C:\Temp\packages.csv" $page = 0 $limit = 500 $data = @() Write-Output "Page" while($true) { $headers = @{"Authorization" = "Bearer $apiKey" } $url = "https://console.automox.com/api/orgs/$orgID/packages?l=$limit&p=$page" $response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json Write-Output $page $data += $response $page += 1 if($response.count -lt $limit) { break } } $data | Group-Object display_name | Sort-Object name | Select-Object Count,name ` | Export-Csv -Path $filepath -NoTypeInformation
Hi Guys, Looking for a powershell script that utilizies the API to make a report based on a software title and its versioning… for example: Show me all machines who have VMWare Workstation installed, and what version they are running. I could find a bit of this info in software tab on the AX UI, but no way to export into a nice report for executives… Thoughts? Thanks!
Hi, has anyone had any issues with the API from today? I had a script that pulled down all machines and was working fine for the last few weeks however stopped this morning with an ‘Invoke-WebRequest : The remote server returned an error: (500) Internal Server Error’. Script is (XXXX added for privacy): $apiKey = "XXXXX" $orgID = "XXXXX" $expDir = 'XXXXX' ############################################################################################################# #Pull server detail by group from API and export as csv to defined directory $uri = "https://console.automox.com/api/servers?o=$orgID&api_key=$apiKey&l=1100" (Invoke-WebRequest -Method -Uri $uri).Content | ConvertFrom-Json | Select-Object results -ExpandProperty results| Select-Object name, serial_number | Export-Csv -Path $expDir\AutomoxAPI_Export.csv -NoTypeInformation -Force If I remove the ‘&l=1100’ from the uri variable it works without issue, however only pulls 500 devices. This only started happening from
So you want to audit your devices that haven’t been connected for a long time, but you’re not prepared to delete them yet and just want to move them to their own group? Currently you can do this on the devices page by sorting by Last Disconnected Date and selecting devices to Assign to Group. However, this can become unwieldy if you have pages and pages of devices to move. This script automates the move using an API call to check the last disconnected date and move any devices older than the number of days you specify in the code. There are five areas in the code you’ll need to update to get the script to function: $orgID = 'YOUR_ORG_ID' - put your Org ID, which can be found by looking at the URL of your console and selecting the value after the “?o=”: https://console.automox.com/dashboard?o=999999 . In this example URL the Org ID is the 999999 portion. $apiKey = 'YOUR_API_KEY' - in your console, go to Settings->API and select the API key. Note that the API key is per admin u
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.