This topic contains 3 replies, has 2 voices, and was last updated by warrenpu 5 years, 8 months ago.
- Topic
I create configuration in routing.yml
12345678oro_campaign_bundle_api:resource: "@RriDesignerToolsBundle/Resources/config/oro/routing_api.yml"type: restprefix: api/rest/{version}requirements:version: latest|v1defaults:version: latestand create routing_api.yml like :
123oro_api_designer_tool:resource: '@RriDesignerToolsBundle/Controller/Api/Rest/DTRestController.php'type: restmy DTRestController is like:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071<?phpnamespace Rri\Bundle\DesignerToolsBundle\Controller\Api\Rest;use FOS\RestBundle\Controller\Annotations\Delete;use FOS\RestBundle\Controller\Annotations\Get;use FOS\RestBundle\Controller\Annotations\NamePrefix;use FOS\RestBundle\Controller\Annotations\QueryParam;use FOS\RestBundle\Controller\Annotations\RouteResource;use Nelmio\ApiDocBundle\Annotation\ApiDoc;use Oro\Bundle\EmailBundle\Cache\EmailCacheManager;use Oro\Bundle\EmailBundle\Entity\Email;use Oro\Bundle\EmailBundle\Entity\Manager\EmailApiEntityManager;use Oro\Bundle\SecurityBundle\Annotation\AclAncestor;use Oro\Bundle\SoapBundle\Controller\Api\Rest\RestController;use Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager;use Oro\Bundle\SoapBundle\Form\Handler\ApiFormHandler;use Oro\Bundle\SoapBundle\Request\Parameters\Filter\StringToArrayParameterFilter;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;/*** @RouteResource("designertool")* @NamePrefix("oro_api_")*/class DTRestController extends RestController {/*** @param int $id Logo id* @ApiDoc(* description="Get logos",* resource=true* )* @Get(requirements={"id"="\d+"})** @return \Symfony\Component\HttpFoundation\Response*/public function getAction($id){return ['aa','xx','cc'];}/*** Get entity Manager** @return ApiEntityManager*/public function getManager(){return $this->get('oro_product.brand.manager.api');}/*** @return ApiFormHandler*/public function getForm(){throw new \BadMethodCallException('Form is not available.');}/*** @return ApiFormHandler*/public function getFormHandler(){throw new \BadMethodCallException('Form handler is not available.');}}but I can not even test my new rest service , can someone help me , how can I create a useful rest service in orocommerce , the oro version I used is 3.0
The forum ‘Oro Community’ is closed to new topics and replies.