Init webservice

Added routes.yml, added a controller that returns dummy data. I want to test how this works and then expand on it to actually use the database to grab real data.
This commit is contained in:
2026-02-09 15:04:44 +01:00
parent e5fe85c8e5
commit 5b3c638b5c
2 changed files with 24 additions and 0 deletions

5
config/routes.yml Normal file
View File

@@ -0,0 +1,5 @@
ws_orderreference_get_reference:
path: /order-reference/{id_order}
methods: [GET]
defaults:
_controller: 'Module\WsOrderreference\Controller\OrderReferenceController::getReferenceAction'

View File

@@ -0,0 +1,19 @@
<?php
namespace Module\WsOrderreference\Controller;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use Symfony\Component\HttpFoundation\JsonResponse;
class OrderReferenceController extends FrameworkBundleAdminController
{
public function getReferenceAction(int $id_order)
{
// Dummy data for testing
return new JsonResponse([
'orderId' => $id_order,
'customReference' => 'DUMMY-REF-12345',
'status' => 'This is a test response'
]);
}
}