JAMF Pro API - Wallpaper base64 encoded giving an error (Problem sending command, prior command may)

robp2175
New Contributor

I have the following code to update wallpaper with custom base64 encoded image. I am confident this is correct, but I keep getting the error "Problem sending command, prior command may be pending, or device may not be capable."

I can't seem to find any indication what would cause this. Any thoughts or ideas would be appreciated.  

 

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://myserver.jamfcloud.com/JSSResource/mobiledevicecommands/command',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'<mobile_device_command>
    <general>
        <command>Wallpaper</command>
        <wallpaper_settings>1</wallpaper_settings>
        <wallpaper_content>'.$base64_encoded_wp.'</wallpaper_content>
    </general>
    <mobile_devices>
        <mobile_device>
            <id>414</id>
        </mobile_device>
    </mobile_devices>
</mobile_device_command>',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/xml',
    'Content-Type: application/xml',
    'Authorization: Basic redacted='

  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

 

 

 

<?xml version="1.0" encoding="UTF-8"?><mobile_device_command><uuid>f545b3503827</uuid><command>Wallpaper</command><mobile_devices><mobile_device><id>414</id><management_id>2eba7ddfe94</management_id><status>Problem sending command, prior command may be pending, or device may not be capable.</status></mobile_device></mobile_devices></mobile_device_command>

 

1 REPLY 1

robp2175
New Contributor

Have I stumped everyone?