|
Sagar Patil - 2015-11-24 05:31:19
I am trying to upload image file fot etsy listing,
for this I provide image from remote url
$paramList=array();
$paramList['image'] = file_get_contents("http://thumbs2.sandbox.ebaystatic.com/pict/110159584005404000000001_1.jpg");
and I did api call as
$this->client->ResetAccessToken();
$success = $this->client->CallAPI('https://openapi.etsy.com/v2/listings/256722957/images','POST',$paramList['image'],array('FailOnAccessError'=>true,'Files'=>array('image'=>array('ContentType'=>'image/jpeg'))), $return);
returns blank responce
no image gets uploaded.
Is I am missing somthing?
Manuel Lemos - 2015-11-24 05:44:09 - In reply to message 1 from Sagar Patil
This is not a very good script.
You cannot Reset the token before making an API call. So, do not throw random code when you are not sure what you are doing.
Your API call should be something like this, but you need to have the calls to Initalize and Finalize as in the examples.
$success = $client->CallAPI(
"https://openapi.etsy.com/v2/listings/256722957/images",
'POST', array(
'image' => 'http://thumbs2.sandbox.ebaystatic.com/pict/110159584005404000000001_1.jpg'
),array(
'FailOnAccessError'=>true,
'Files'=>array(
'image'=>array(
)
)
), $upload);
Sagar Patil - 2015-11-25 08:22:56 - In reply to message 2 from Manuel Lemos
Thanks for the example code ,
this works when I give local file path but not with remote image url.
ex-
$imageSource = 'E:\testimage.jpg';
client->CallAPI("https://openapi.etsy.com/v2/listings/".$listingId."/images",'POST', array('image' =>$imageSource),array('FailOnAccessError'=>true,'Files'=>array('image'=>array())), $uploadResult);
works
$imageSource = 'https://img1.etsystatic.com/131/0/11919855/il_170x135.874878141_6l9n.jpg';
client->CallAPI("https://openapi.etsy.com/v2/listings/".$listingId."/images",'POST', array('image' =>$imageSource),array('FailOnAccessError'=>true,'Files'=>array('image'=>array())), $uploadResult);
does not.
why it is so?
Manuel Lemos - 2015-11-25 17:23:33 - In reply to message 3 from Sagar Patil
It should give you an error message. Check the class $error variable.
|