Search Here

API Authentication for Odoo in Postman or Advance Rest Client

 In this article, you will learn how to authenticate Postman or Advance Rest Client (ARC) with Odoo API (Web Controllers). Before requesting any API call (GET , POST) third-party tools like Postman or Advance Rest Client needs authentication.

Postman or Advance Rest Client API Authentication in Odoo, Configure Postman or Advance Rest Client for Odoo, Json, Call Controller via postman, Rest API


How to Authenticate Odoo with Postman or Advance Rest Client

To authenticate Odoo we need header and cookie info, that will be used by Postman or Advance Rest Client. We need to set the "session_id" in the cookie and give some header info.

Below are the steps to set header and cookie information in Postman or Advance Rest Client:


No. Step Detail
1 Create Post Request Post
2 Authentication URL http://localhost:8069/web/session/authenticate
3 Set Header Info Content-Type: application/json
4 Set Body { "jsonrpc": "2.0", "params": { "db": "test_db", "login": "admin", "password": "admin" } }

Send the request and if successful Odoo will respond with information about the user, and the response header will include Set-Cookie which tells the postman to set the session_id cookie. 

{
"jsonrpc": "2.0"
"id": null
"result": {
"username": "admin"
"user_context": {
"lang": "en_US"
"tz": "Asia"
"uid": 1
}
"uid": 1
"db": "test"
"company_id": 1
"session_id": "1325e3fa0c0469077b9e9c6bc1f6bdc575ed8a8d"
}
}

Now you can request any other URL that requires authentication.

http://localhost:8069/call_to_api

Post a Comment

0 Comments