Creating Profiles via API through PowerShell

Hello!


I have been trying to create a profile through PowerShell and the MobiControl API.

The end goal is to have a package assigned to it as well.

Have been trying the following:

Using Content-Type text/xml


$xmltest = '<?xml version="1.0" encoding="UTF-8"?>
<Profile>
    <Name>APITest_NewProfile</Name>
    <Description>Test</Description>
    <DeviceFamily>AndroidPlus</DeviceFamily>
    <DeviceFamilyQualification>AndroidWork</DeviceFamilyQualification>
</Profile>'

$response = Invoke-RestMethod -Uri "https://$MCFQDN/mobicontrol/api/profiles" -ContentType "text/xml" -Method POST -Headers $Header -Body $xmltest -Verbose


I have also tried with a hashtable too, but either way I get the same error:
"profileRequest: Error parsing value Contract validation failed"

I have looked at the api list, and it appears to me that these is the minimal required fields when not attaching a package.

Thanks in advance

Mikael

2 years ago
Android
ANSWERS