Add image to item via API

Add image to item via API

Hi,

trying to add image to item via the API....this is not detailed in the Zoho Books api...Here's what I've got:


<?


$url = 'https://books.zoho.com/api/v3/items/{ITEM-ID}/image';

$data = array(
'authtoken'  => '{AUTH-TOKEN}',
'organization_id' => '{ORGANIZATION-ID}',
'item_id' => '{ITEM-ID}',
'image' => new CURLFile(
'https://mysite.co.za/images/blue-shorts.jpg',
'application/octet-string',
'blue-shorts.jpg'
)
);



$ch = curl_init($url);

curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded") );

$response = false;// don't quote booleans

$response = curl_exec($ch);
curl_close($ch);

if($response !== false) {

var_dump($response);
}
else
{
echo "oops error hehehe";
}

?>

The error Zoho is giving me is:

string(81) "{"code":33003,"message":"Looks like the image is not attached. Please try again"}"


Please help.