Sample Exchange

 View Only

Execute AirWatch Rest API Call 

May 12, 2016 06:37 PM

.SYNOPSIS This Poweshell script make a REST API call to an AirWatch server. This particular script is used to pull device information based on serial numbers pulled from a file. If you need to build your own script, concentrate on the Get-BasicUserForAuth function. This creates the Base64 authentication string. Also look at the Build-Headers function as this is a requirement for the REST call.

.DESCRIPTION To understand the underlying call check https://


#Rest
#Apache2.0
#api_airwatch_mam_v1
#AirWatch
#PowerShell
#API

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
ps1 file
Execute-AWRestAPI.ps1   10 KB   1 version
Uploaded - Apr 09, 2024

Tags and Keywords

Comments

Apr 17, 2020 02:45 PM

Is there a way to fetch just the changes since the last fetch? We need near-real-time data and it seems like a bad idea to pull in all of the data every 10 minutes.

Mar 28, 2018 07:07 PM

i get this error, any ideas on it??? Invoke-RestMethod : {"errorCode":1005,"message":"User is not active.","activityId":"7f19f466-0e3d-4d7c-91b8-ae9b429c284c"}

Nov 12, 2017 08:00 PM

Ignore me. I think a proxy was getting in my way. Admins - feel free to delete the comments. Apologies for cluttering up this area.

Nov 12, 2017 07:34 PM

Hi there.
Does this code sample still work? I've tried using it - and similar other creations in PowerShell - but it looks like the AirWatch API is expecting the authentication to happen in the initial request, where this is waiting for a challenge prior to submitting the stored credentials. As a consequence, AirWatch returns:
Invoke-RestMethod : {"errorCode":1003,"message":"The authorization header is empty or the scheme is not
basic"
If I try to make similar requests using Postman - which includes credentials in the request header rather than waiting for a challenge - it's successful.
If anyone has this working - please post! I'll try to work through this in the background.
Cheers,
Matt

Related Entries and Links

No Related Resource entered.