Enable Dark Mode!
how-to-authenticate-postman-or-the-advance-rest-client-arc-with-the-odoo-api.jpg
By: Shahul Faizh

How to Authenticate Postman or the Advance Rest Client (ARC) With the Odoo API

Technical Odoo 15

Third-party tools such as Postman or Advance Rest Client require authentication before requesting any API call (GET, POST). This blog will teach you how to authenticate Postman or the Advance Rest Client (ARC) with the Odoo API (Web Controllers). 

To authenticate Odoo, we need header and cookie information, which Postman or the Advance Rest Client will use. We need to set the "session id" cookie and provide some header information.

The following are the 

Steps for configuring header and cookie information in Postman or Advance Rest Client:

Step 1: Make a Post Request

POST requests allow data to be appended to the endpoint. This is a mechanism for adding information to the server's request body.

how-to-authenticate-postman-or-the-advance-rest-client-arc-with-the-odoo-api-cybrosys

Step 2: Authentication URL

The Authentication URL command gives the URL of the endpoint used to verify user credentials. The endpoint supplied in the URL validates the user credentials in the authorization header.

how-to-authenticate-postman-or-the-advance-rest-client-arc-with-the-odoo-api-cybrosys

Step 3: Set Header Information

Headers in an HTTP request or response are extra pieces of information sent to the user or the server.

Content-Type: application/json

how-to-authenticate-postman-or-the-advance-rest-client-arc-with-the-odoo-api-cybrosys

Step 4: Set Body Information

The "body" of a POST request is where values are transmitted.

{
   "jsonrpc": "2.0",
   "params": {
       "db": "database_name",
       "login": "user_login",
       "password": "user_password"
   }
}

how-to-authenticate-postman-or-the-advance-rest-client-arc-with-the-odoo-api-cybrosys

Send the request, and if it's successful, Odoo will respond with user information and a Set-Cookie header, instructing the postman to set the session id cookie

{
"jsonrpc": "2.0",
"id": null,
"result": {
"uid": 2,
"is_system": true,
"is_admin": true,
"user_context": {
"lang": "en_US",
"tz": "Europe/Brussels",
"uid": 2
},
"db": "cybrosys",
"server_version": "15.0",
"server_version_info": [
15,
0,
0,
"final",
0,
""
],
"support_url": "https://www.odoo.com/buy",
"name": "Mitchell Admin",
"username": "1",
"partner_display_name": "YourCompany, Mitchell Admin",
"company_id": 1,
"partner_id": 3,
"web.base.url": "http://localhost:8015",
"active_ids_limit": 20000,
"profile_session": null,
"profile_collectors": null,
"profile_params": null,
"max_file_upload_size": 134217728,
"home_action_id": false,
"cache_hashes": {
"translations": "5227498d9df4b403b0244c75aac21e0c091e50ce",
"load_menus": "1de66f5f09776cbe9dd1ab81cf10c36630fe92329a9306490d1e1733217dcd01",
"qweb": "6bfb3c97a5b82b7f1e7164cc8fc814205000b155488287a7082d6fd2a208a3ae",
"assets_discuss_public": "a9e4893f8fd804740fc59ef67dc6e2b992ba7b6f6cc1aa1a29d7e8a1a48d9f60"
},
"currencies": {
"1": {
"symbol": "€",
"position": "after",
"digits": [
69,
2
]
},
"2": {
"symbol": "$",
"position": "before",
"digits": [
69,
2
]
}
},
"user_companies": {
"current_company": 1,
"allowed_companies": {
"2": {
"id": 2,
"name": "My Company (Chicago)",
"sequence": 10
},
"1": {
"id": 1,
"name": "My Company (San Francisco)",
"sequence": 0
}
}
},
"show_effect": "True",
"display_switch_company_menu": true,
"user_id": [
2
],
"max_time_between_keys_in_ms": 55,
"web_tours": [],
"tour_disable": true,
"notification_type": "email",
"odoobot_initialized": true,
"iap_company_enrich": false
}
}

You can now request any other authentication-required URL.

http://localhost:8069/call_url

These features can make the best option and bring your business to great heights within a shorter span of time and resources.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message