I am currently working on a script to synchronize product data between Dolibarr and Phoca Cart within my Joomla setup. However, I am encountering issues locating the correct API endpoints for Phoca Cart 5.
Dolibarr serves as the primary source for products, pricing, and stock information.
The script I created seems to have issues accessing the right API routes in Phoca Cart.
My Question: Does anyone have detailed documentation or knowledge about the correct API endpoints required to update product information in Phoca Cart? Specifically, I am looking for basic endpoints for product operations such as Create, Read, Update, and Delete (CRUD).
I would greatly appreciate any help or references to the appropriate documentation or examples that could guide me in resolving this.
error I get running the script:
2024-11-09T23:49:53+00:00 CRITICAL 2a03:5180:7:2:dbc7:3c28:b837:1 error Uncaught Throwable of type Joomla\CMS\Router\Exception\RouteNotFoundException thrown with message "Unable to handle request for route `products/`.". Stack trace: #0 [ROOT]/libraries/src/Application/ApiApplication.php(246): Joomla\CMS\Router\ApiRouter->parseApiRoute()
#1 [ROOT]/libraries/src/Application/ApiApplication.php(110): Joomla\CMS\Application\ApiApplication->route()
#2 [ROOT]/libraries/src/Application/CMSApplication.php(306): Joomla\CMS\Application\ApiApplication->doExecute()
#3 [ROOT]/api/includes/app.php(50): Joomla\CMS\Application\CMSApplication->execute()
#4 [ROOT]/api/index.php(31): require_once('...')
#5 {main}
API endpoints
-
- Phoca Member
- Posts: 10
- Joined: 24 Mar 2011, 15:51
Re: API endpoints
Hi,
first you need to install the webservices plugin
https://github.com/PhocaCz/PhocaCartWebservicesPlugin
Use the dev version, as it contains more defined routes.
Then the API is acccesible at
GET /api/v1/phocacart/products
PATCH /api/v1/phocacart/products
GET /api/v1/phocacart/products/{id}
PATCH /api/v1/phocacart/products/{id}
GET /api/v1/phocacart/variants
GET /api/v1/phocacart/status
GET /api/v1/phocacart/orders
GET /api/v1/phocacart/orders/{id}
PATCH /api/v1/phocacart/orders/{id}
GET /api/v1/phocacart/products/stock
POST /api/v1/phocacart/products/stock
Note, that this is still under development, and some endpoints could change in future.
Pavel
first you need to install the webservices plugin
https://github.com/PhocaCz/PhocaCartWebservicesPlugin
Use the dev version, as it contains more defined routes.
Then the API is acccesible at
GET /api/v1/phocacart/products
PATCH /api/v1/phocacart/products
GET /api/v1/phocacart/products/{id}
PATCH /api/v1/phocacart/products/{id}
GET /api/v1/phocacart/variants
GET /api/v1/phocacart/status
GET /api/v1/phocacart/orders
GET /api/v1/phocacart/orders/{id}
PATCH /api/v1/phocacart/orders/{id}
GET /api/v1/phocacart/products/stock
POST /api/v1/phocacart/products/stock
Note, that this is still under development, and some endpoints could change in future.
Pavel
- Jan
- Phoca Hero
- Posts: 48386
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: API endpoints
The newest version 5.0.0 can be found here:
https://www.phoca.cz/download/99-phoca- ... s?start=40
https://www.phoca.cz/download/99-phoca- ... s?start=40
If you find Phoca extensions useful, please support the project