Skip to content
Back to Articles

PrestaShop Webservice API: your first real request

External integrations
HTTP
GET /api/products
?display=[id,reference,price]
&output_format=JSON

200 OK
{
  "id": 42,
  "reference": "ABC-001"
}
Webservices & API
Beginner
PrestaHacks 3 min read

Want an external application to read products from PrestaShop without giving it database credentials?

The native PrestaShop Webservice is the first tool to learn.

In this tutorial we make a real read-only request and retrieve Product ID, Reference/SKU and Price from /api/products.

1. Create Webservice access

Enable Webservice in the Back Office and create an access key. For the first test, read access to the products resource is enough.

Tip

Do not enable every permission. Start with the minimum access the integration actually needs.

2. The API endpoint

TEXT
https://shop.example/api/

Products:

TEXT
https://shop.example/api/products

3. Authentication

BASH
curl \
  -u "YOUR_WEBSERVICE_KEY:" \
  "https://shop.example/api/"

Warning

Never expose production API keys in documentation, repositories or public screenshots.

4. Make the first request

BASH
curl \
  -u "YOUR_WEBSERVICE_KEY:" \
  "https://shop.example/api/products"

5. Request only the fields you need

TEXT
/api/products?display=[id,reference,price]
BASH
curl \
  -u "YOUR_WEBSERVICE_KEY:" \
  "https://shop.example/api/products?display=[id,reference,price]"

6. JSON output

TEXT
/api/products?display=[id,reference,price]&output_format=JSON

7. Filter by reference

TEXT
/api/products?filter[reference]=[ABC-001]&display=[id,reference,price]
TEXT
EXTERNAL SKU
     ↓
Find PrestaShop product
     ↓
Get id_product
     ↓
Read / Update

8. Pagination

TEXT
/api/products?display=[id,reference,price]&limit=0,100

Next batch:

TEXT
/api/products?display=[id,reference,price]&limit=100,100

9. Products and stock are different resources

TEXT
/api/stock_availables

A useful mental model is:

TEXT
Product data
    +
StockAvailable
    =
usable stock dataset

10. What about combinations?

TEXT
/api/combinations
TEXT
Products
   ↓
Combinations
   ↓
Stock Available
   ↓
Unified dataset

11. Real integration scenario

ID SKU Price Stock
21 ABC-001 29.90 14
22 ABC-002 18.50 0

12. Do not start with PUT

TEXT
READ
 ↓
MAP
 ↓
VALIDATE
 ↓
TRANSFORM
 ↓
WRITE
 ↓
VERIFY

Troubleshooting

401: check the access key, Basic Auth, Webservice status and Authorization-header forwarding.

403: check the permissions assigned to the key.

Empty or limited response: check display, filter, limit and the shop context.

Official references

  • https://devdocs.prestashop-project.org/9/webservice/
  • https://devdocs.prestashop-project.org/9/webservice/tutorials/testing-access/
  • https://devdocs.prestashop-project.org/9/webservice/tutorials/testing-webservice-postman/
  • https://devdocs.prestashop-project.org/9/webservice/tutorials/advanced-use/additional-list-parameters/

What to do next

Once the first request is stable, add filters, sorting and pagination before scaling extraction. Keep writes separate until you have a safe product-update workflow with read-before-write validation.

STAY TUNED

Get practical PrestaShop hacks in your inbox.

INACTIVE