Site icon PrestaShop | Magento | CRM Modules

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:


📦 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:


⚠️ Important Notes



Just tell me 👍

Exit mobile version