PrestaSharp icon indicating copy to clipboard operation
PrestaSharp copied to clipboard

401 unauthorized

Open DoubleDim opened this issue 8 years ago • 1 comments

Hello, i'm kind of new on Web Services i downloaded Prestashop and PrestaSharp since i'm programming on C#. For some days i get 401 unathorized error (also HttpStatusCode Not Found) when i'm trying to create access to my localhost/prestashop/api and i really cannot understand where is the problem even if i ctrl+click on the url. Can you help me please? Below is the code, thank you

private void btnRead_Click(object sender, EventArgs e) { string BaseUrl = "http://localhost/prestashop/api/"; string Account = "...API KEY here..."; string Password = ""; Bukimedia.PrestaSharp.Entities.product Product = ProductFactory.Get(8); Product.id = 8; Product.active = 1; ProductFactory.Add(Product); ProductFactory.Update(Product); ProductFactory.Delete(Product);

        label1.Text = "";
    }

DoubleDim avatar Nov 16 '16 15:11 DoubleDim

UPDATE: Ok i fixed it by adding at the end -> /manufacturers&ws_key=...API hey here..."

My other question is: Do i need to write something extra except the "List ids = ManufacturerFactory.GetIds();" to return me the xml file because i thought only with this command i could get the xml so do i have to write some extra code or any reference to the library? Thanks

DoubleDim avatar Nov 17 '16 12:11 DoubleDim