This question has been flagged
1 Reply
5619 Views

Hi,

I installed  the "Base Rest (OCA)" application in Odoo 13.

I followed the documentation .

So I added in odoo configuration :

[base_rest]
dev_mode=True

I added  controller.py :

class ProductService(Component):
    _inherit = 'base.rest.service'
    _name = 'product.service'
    _collection = 'base.rest.public.services'
    _usage = 'product'
    _description = """
                Product Services !!!
    """
 
    def get(self, _id):
        return self._to_json(self._get(_id))

and component.py :

 class MyRestController(main.RestController):
     _collection_name = "base.rest.public.services"
     _root_path = '/rest_api/public/'
     _default_path = "public"


But , I got 404 error :" The page you requested could not be found" when displaying the URL : http://localhost:8069/rest_api/public/

Any help please ? Can someone explain how to run a simple example with REST APIs.

Thanks.


Avatar
Discard
Best Answer

I think you are missing "product" in the url and an identifier.

try http://localhost:8069/rest_api/public/product/1

Avatar
Discard