Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
154 stars 151 forks source link

Error adding image. 'Method POST is not allowed' #317

Closed juanmaprog closed 6 years ago

juanmaprog commented 6 years ago

I receive this error when I try to add an image

CLS4WEQQ7DRG2WZZ6NFTVTCGI7N77TRH

application / json, application / xml, text / json, text / x-json, text / javascript, text / xml
<? xml version = "1.0" encoding = "UTF-8"?>
<prestashop xmlns: xlink = "http://www.w3.org/1999/xlink">
<errors>
<error>
<code> <! [CDATA [25]]> </ code>
<message> <! [CDATA [Method POST is not allowed for the resource with this authentication key]]> </ message>
</ error>
</ errors>
</ prestashop>
  HttpStatusCode: MethodNotAllowed

Call:

public static void AddImage (product p, string imgPatch)
{
    // test 1 //
    var imgFact = new ImageFactory (BaseUrl, Account, Password);
    var c = RestSharpFactory.ImageToBinary (imgPatch);
     imgFact.AddProductImage (p.id.Value, c);

    // test 2 //
    ImageFactory factory = new ImageFactory (BaseUrl, Account, Password);
    string image = @"C:\temp\MyImage.jpg";
   var result = factory.AddProductImage (p.id.Value, image);

    ////// IN BOTH CASES THE SAME ERROR //////
}

Prestashop 1.7.2.4 hosted on 1&1 RestSharp 106.2.1.0

Any ideas?

Thank you.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.