PrestaShop Documentation, PrestaShop Tutorials

PrestaShop API Web Service

The PrestaShop Webservice API allows you to interact with your store programmatically—create, read, update, and delete data like products, customers, orders, etc. It’s very useful if you want to connect your store with mobile apps, ERP systems, or automation scripts (like your PHP/Python work).


🔧 1. Enable Webservice API

  1. Go to Back Office → Advanced Parameters → Webservice
  2. Click Enable PrestaShop Webservice
  3. Set to YES
  4. Save

🔑 2. Create API Key

  1. Click “Add new webservice key”
  2. Generate a key (or auto-generate)
  3. Give permissions:
    • GET (read)
    • POST (create)
    • PUT (update)
    • DELETE (remove)
  4. Select resources (products, customers, orders, etc.)

🌐 3. API URL Format

Your API endpoint will be:

https://yourdomain.com/api/

Example:

https://yourdomain.com/api/products

Authentication:

  • Use Basic Auth
  • Username = API KEY
  • Password = empty

📦 4. Example API Requests

🔹 Get Products (PHP)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://yourdomain.com/api/products");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "YOUR_API_KEY:");
$response = curl_exec($ch);
curl_close($ch);

echo $response;

🔹 Create Product (XML)

<prestashop>
  <product>
    <name>
      <language id="1">Test Product</language>
    </name>
    <price>100</price>
    <active>1</active>
  </product>
</prestashop>

🔹 Python Example

import requests

url = "https://yourdomain.com/api/products"
api_key = "YOUR_API_KEY"

response = requests.get(url, auth=(api_key, ""))
print(response.text)

📚 5. Available Resources

Common endpoints:

  • /api/products
  • /api/customers
  • /api/orders
  • /api/categories
  • /api/stock_availables

⚠️ Important Notes

  • Default format is XML (JSON needs extra handling or modules)
  • Make sure mod_rewrite is enabled on server
  • Use HTTPS for security
  • Permissions must be set correctly or you’ll get 401/403 errors

  •  

  •  

Just tell me 👍

About zohaibk

We develop useful addons for #E-Commerce and #CRM software to provide extra features.#PrestaShop,#Magento,#SugarCRM,#Vtiger & #Android #apps
View all posts by zohaibk →