unable to access the prestashop webservice via getJSON

I am trying to use the webservice prestashop (1.6) to get my product by using the jquery function getJSON() but on the console's browser, I get the following error :

  XMLHttpRequest cannot load
 No 'Access-Control-Allow-Origin' header is present on the requested
 resource. Origin 'http://localhost' is therefore not allowed access.

I tried to add " Header set Access-Control-Allow-Origin: * " to the htaccess but without success.

I wonder if there is another way to set a header (except using php with header('Access-Control-Allow-Origin: *'); )

In prestashop 1.6 you can try to add this in


for security reason, instead of asterisk you can type domain name

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Origin: http://example.com');


If you will still have problems or Unauthorized message, try to change your url from




unable to access the prestashop webservice via getJSON, I am trying to use the webservice prestashop (1.6) to get my product by using the jquery function getJSON() but on the console's browser, I get the following error� Activate the PrestaShop WebService API. Firstly, the admin needs to activate Prestashop Webservice API. To do so, go to Advanced Parameters section and then to Webservice tab. 1: After that, enable the PrestaShop Webservice from the configuration page. 2: Then, click on “Add new webservice key” button to add a new key, 3: Finally, add an

I solved the issue by myself, I just add header('Access-Control-Allow-Origin: *'); on the file dispatcher.php in the webservice folder

get JSON data from the PrestaShop-webservice-library , get JSON data from the PrestaShop-webservice-library. By Nikhil.nj , March 27, 2015 in Sviluppatori PrestaShop� I read, i try, i looking informations about how add / update combinations by webservice, in presta 1.5.3 but still i don't know how to do that. Can someone help me? web-services combinations prestashop | this question asked Feb 9 '13 at 13:44 chiken 11 1 5 I read, i try - great, could you show us what you have tried so far? This way we might be

for me i tried with react app i had to made some modification in dispatcher.php and add for option preflight 200 return

i added in the dispatcher.php header

//to access from external browser
header('Access-Control-Allow-Origin: *');
header( 'Access-Control-Allow-Headers: Authorization, Access-Control-Allow-Headers, 
Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access- 
header( 'Access-Control-Allow-Methods: GET, OPTIONS, HEAD, PUT, DELETE');
header( 'Access-Control-Allow-Credentials: true');

then modified like this after in the code

 if ($method === 'OPTIONS') {
if (isset($_SERVER['PHP_AUTH_USER'])) {

Webservice error - Configuring and using PrestaShop, The requested URL /prestashop/webservice/dispatcher.php was not found on Every files/folder in prestashop folder are owned by www-data:www-data. When I enable "Friendly URL" in SEO, I cannot access no more the� Prestashop allows access to shop’s database for external applications through web services in form of a CRUD API. You can access web services of prestashop using webservice key, prestashop allow you to create multiple web service key with different prestashop resource access permission. Generate Prestashop Webservice key Go into your Prestashop Back Office and

If you are working with Angular or Similar Frameworks, modify and add the following code according to your environment on the first line of prestashop_folder/webservice/dispatcher.php file

// Allow from any origin
    // You can decide if the origin in $_SERVER['HTTP_ORIGIN'] is something you want to allow, or as we do here, just allow all
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    //No HTTP_ORIGIN set, so we allow any. You can disallow if needed here
    header("Access-Control-Allow-Origin: *");

header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 600");    // cache for 10 minutes

        header("Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT"); //Make sure you remove those you do not want to support

        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");

    //Just exit with 200 OK with the above headers for OPTIONS method

WebService -can't access - Addons, modules and , Indeed it seems that the api URL above uses Apache authentication initiated through a PHP script, but since our setup is via a CGI gateway, the� a) Enable Prestashop’s web service: Enable the setting to use web service in the Prestashop Store. b) Enable CGI mode for PHP: Enable the setting to use PHP as CGI script instead of Apache module. 5. Click on the Save button to save the configuration. Now, you can use the Web Services in your Prestashop Store.

incapable d'acc�der � la prestashop webservice via getJSON, je r�solu le probl�me par moi-m�me, je viens d'ajouter header('Access-Control- Allow-Origin: *'); sur le fichier Dispatcher.php dans le dossier webservice. Enabling the webservice feature. Go in the PrestaShop back office, open the "Webservice" page under the "Advanced Parameters" menu, and then choose "Yes" for the "Enable PrestaShop's webservice". Save your change: you're done! Creating an access key

jquery ajax get json example Code Example, Get code examples like "jquery ajax get json example" instantly right from your google javascript by Sal-versij on Mar 07 2020 Donate. 0 Source: api.jquery. com autoload_namespaces.php failed to open stream: Permission denied change url prestashop 1.7 database � changing the autoload.php for algolia search� </customer> </prestashop> Here are the descriptions of the expected value types. Generic value types. Format. Description. Expected value, in regexp form. isBool.

Prestashop Web service to return JSON, Now, I am trying to convert XML(returned by Prestashop) to JSON. Webservice Return Json Instead Of Xml, How can I get the web service to return json I extended the PrestaShopWebservice class to return JSON by calling getJson(). 9516 | Cannot access Tomcat server in local network from mobile phone; 8014� Prestashop API can get a JSON response after v1.6.0.9. I extended the PrestaShopWebservice class to return JSON by calling getJson(). The existing get() method still returns SimpleXMLElement.