Home > Software engineering >  got 301 and then 404 error response while calling end point in odoo15
got 301 and then 404 error response while calling end point in odoo15

Time:09-27

here is my code:

    from odoo import http
_logger = logging.getLogger(__name__)

class CrmController(http.Controller):

    @http.route('/crm/lead', type='json', auth='none', website=True, methods=['POST'])
    def post_data_end_point(self):
        print("==== api called successfully ====")
        return "api called successfully---"

after call this end point on postman i got this error

2022-09-14 09:44:09,925 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:09] "POST /crm/lead/ HTTP/1.1" 301 - 35 0.020 0.817
2022-09-14 09:44:10,421 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:10] "GET /crm/lead HTTP/1.1" 404 - 214 0.116 0.357

CodePudding user response:

you have define type='json' it means it response only json(dictionary) object not string.

  • Related