3

I created a public route in Odoo10 with type json and i tried to call it from a API clinet( ARC), i am getting 404 Not found error. I don't know why.

Here is my code

controller.py

# -*- coding: utf-8 -*-
from odoo import http,tools
from odoo.http import request, Response
import requests
class TestURL(http.Controller):
    @http.route('/create_lead', type="json", method=['POST'], auth='public', csrf=False)
   def createLead(self,**kw):
       print('Inside create lead')
       // rest of the code here

Here is the response i am getting in api client:

{"jsonrpc": "2.0", "id": null, "error": {"message": "404: Not Found", "code": 404, "data": {"debug": "Traceback (most recent call last):\n  File \"/home/user/Projects/odoo-10/odoo/http.py\", line 642, in _handle_exception\n    return super(JsonRequest, self)._handle_exception(exception)\n  File \"/home/user/Projects/odoo-10/odoo/http.py\", line 1471, in _dispatch_nodb\n    func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match()\n  File \"/usr/local/lib/python2.7/dist-packages/werkzeug/routing.py\", line 1581, in match\n    raise NotFound()\nNotFound: 404 Not Found: The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.\n", "exception_type": "internal_error", "message": "404 Not Found: The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.", "name": "werkzeug.exceptions.NotFound", "arguments": []}, "http_status": 404}}
KbiR
  • 4,047
  • 6
  • 37
  • 103

1 Answers1

0

Try

@http.route(['/create_lead']...

and check the identation

Plaoo
  • 417
  • 3
  • 19