Customizing API
How to add an endpoint to the Sylius API?
<?xml version="1.0" encoding="UTF-8" ?>
<!-- config/api_platform/Order.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
>
<resource class="%sylius.model.order.class%">
<operations>
<operation
name="custom_operation"
class="ApiPlatform\Metadata\Post"
uriTemplate="/shop/orders/custom-operation"
messenger="input"
input="App\Command\CustomCommand"
/>
</operations>
</resource>
</resources># config/api_platform/Order.yaml
resources:
'%sylius.model.order.class%':
operations:
ApiPlatform\Metadata\Post:
name: custom_operation
uriTemplate: '/shop/orders/custom-operation'
messenger: input
input: App\Command\CustomCommandHow to remove an endpoint from the Sylius API?
How to rename an endpoint’s path?
Last updated
Was this helpful?
