简体   繁体   中英

got 301 and then 404 error response while calling end point in odoo15

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM