Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Technical
  3. REST API - Odoo 14 v 14.0
  4. Sales Conditions FAQ

REST API - Odoo 14

by Odoer.GH
Odoo

$ 11.31

v 14.0 Third Party 29
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 484
Technical Name api_restful_odoo
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 484
Technical Name api_restful_odoo

Authentication

  • Login
  • Logout

In order to be able to access any entity an access token needs to generated which serves as session cookies in a regular web language. The token will be needed for every subsequent requests. Except for /api/login enpoint that accept multipart/form-data as the Content type every other endpoints accept application/json as the 'Content Type'.
Token will give the user access only to models which he have access to.
The period which the token needs to be expired is parametrable and you can modify it.

Login (Request access token)

Python request

To retrive an access token these following parameters needs to be set.

  • the database name as db
  • the connecting username as login
  • the user password as password
The above request will return a response like below.

Logout

To logout of the system the token needs to be destroyed i.e deleted, by doing that the user/application making the request on behalf of the user will have not futher access to Odoo. The token /api/logout listen to both GET and DELETE requests, GET will fetch the token while delete request will deleted the token.

Python request:

CRUD on model.model: Example: sale.order

To get or fetch existing sale order

There is posibilty of applying some record filters in order to get just the specific record.

  • limit: This define the total number of record we are expecting
  • offset: where the query will start from
  • fields: this is the list of field that we wanted to return, this can be leave empty if we wanted to return all the fields.
  • domain: domain is like a filter it is always a list of tuples (field, operator, value)
These payload applies to all records in Odoo.
We can perform create, update and delete operation on any records using corresponding HTTP request headers.
  • GET: For retriving existing records
  • POST: For creating new records
  • PATCH: Call an action button on a record
  • DELETE: To delete a record
All the API of currently installed modules or any module that may be installed has already cattered for dynamically. The API follows this sematic pattern
/api{api route}/modelP{model name}/id{optional id for delete request} e.g for sale order Get request to api/sale.order endpoint will return all the sale order in the system.

Get specific element

  • Get request
  • Response

The reponse with all the fields, but the return fields can specified along side the request, and also, specific records can be specified by sending along the request Odoo domain as json body.

The above will only return 2 maximum records, id, partner and sale order name, that have an ID in the given list [10,11,12,13,14], the offset can be set also.

POST request

PUT request

Put request is meant for updating fields in a record. e.g updating partner name.

In the above request, we send a json body like this {"name":"partner name edited"}, calling the put request updated the res.partrner with id = 15 with new data.

PATCH request

Patch request is meant for calling an action button on a record. example: validating sale order.

In the above request, we send a json body like this {"_method":"action_confirm"} The _method is the action/button name in odoo. This is similar to clicking Confirm Button on sale order with ID 37

DELETE request

We only need to make a delete request to the resource.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
  • Ratings
  • Discuss
It doesn't work
by
Mohamed
on 9/29/21, 3:52 AM

hello,

this is not working, I installed it locally and on a server, it installed without errors but when trying to login like the example it gives me error 404,

I handled to use rpc instead of it.


by
Kben
on 10/25/24, 5:09 AM Confirmed Purchase

Hello,

When I install the module in Odoo 14 CE locally, I get the error 404; with http://localhost:8069/api/login

What could be the problem?


by
linyaohui
on 1/21/22, 2:47 AM Confirmed Purchase

The token /api/logout listen to both GET and DELETE requests, GET will fetch the token while delete request will deleted the token.
get not working for fresh

{"type": "invalid object model", "message": "The model logout is not available in the registry."}


Will it work with Odoo.sh
by
webshop.admin@zafco.com
on 10/11/21, 3:16 AM

Hi,


Can we use this with Odoo.sh or only with On-Prim databases?


by
Jorge Washington Cáceres Campana
on 8/9/21, 3:15 PM Confirmed Purchase

Hi

 I installed this module in Odoo 14 CE, but when I send with curl like the example, I get the error 404; when I send wit postman with "content-type=application/json" I have error 200 from odoo Server, please I need your help


thank you


by
Mikhail Ivanov
on 5/29/21, 9:05 PM Confirmed Purchase

Hei, my dear collegues! I guess, you also know that no one of you methods except Get, Login and Logout do not work, right? Neither POST nor PUT

Contact me asap, please!


by
vijay gwala
on 5/22/21, 7:15 AM

Are you sure this will handle cross origin requests (CORS) because my purpose is to use authentication from react side.


APi documentation et al.
by
WMSSoft Pty Ltd
on 3/9/21, 1:36 AM

Do you have further documentation for this rest api for odoo.  Does it allow CRUD to all objects in Odoo?  One thing I wanted to do was update a draft delivery, then validate it and then create a back order delivery if one was required.  Do you think your API would allow me to do this? (what api calls would be required)


Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with