26.80

v 8.0 v 9.0 v 10.0 v 11.0 v 12.0 Third Party 31
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 82
Technical Name odoo_rest_api
Versions 9.0 8.0 11.0 12.0 10.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 82
Technical Name odoo_rest_api
Versions 9.0 8.0 11.0 12.0 10.0

Odoo Rest API

This module adds full support for Rest API in Odoo

FEATURES:

  • User can create, update, search, delete any record via Rest API
  • All python methods inside Odoo can be called from Rest Api
  • Works with every Odoo model and custom modules
  • Send context via rest api (e.g. language)
  • Operations on multiple records with one request
  • Authentication with Odoo login and password
  • Permissions based on Odoo user permissions
  • No additional python modules or software required - works on default Odoo
  • Test server and support: grzegorzgk1@gmail.com
  • POSSIBLE REQUESTS:

  • GET: /rest/<model> - get records from selected model; parameters: fields, offset, limit, domain, sort
  • GET: /rest/<model>/<ids> - get selected records from selected model; parameters: fields
  • POST: /rest/<model> - create record in selected model
  • PUT: /rest/<model>/<ids> - update selected records in selected model
  • DELETE: /rest/<model>/<ids> - delete selected records from selected model
  • POST: /rest/<model>/<method> - run any method from selected model
  • POST: /rest/<model>/<method>/<ids> - run any method from selected model for selected records
  • EXAMPLES:

    [Example 1] - Get all users data - selected fields

    Request:
    curl -X GET -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.users -d "{'fields': ['name', 'login']}"
    Response
    [
      {
        "id": 1,
        "login": "admin",
        "name": "Administrator"
      },
      {
        "id": 6,
        "login": "portal",
        "name": "Demo Portal User"
      },
      {
        "id": 5,
        "login": "demo",
        "name": "Demo User"
      },
      {
        "id": 7,
        "login": "grzegorzgk1@gmail.com",
        "name": "Grzegorz"
      }
    ]

    [Example 2] - Search users: name contains 'demo'

    Request:
    curl -X GET -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.users -d "{'domain': [['name', 'ilike', 'demo']], 'fields': ['name']}"
    Response
    [
      {
        "id": 6,
        "name": "Demo Portal User"
      },
      {
        "id": 5,
        "name": "Demo User"
      }
    ]

    [Example 3] - Get partners - selected ids

    Request:
    curl -X GET -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.partner/25,26 -d "{'fields': ['name']}"
    Response
    [
      {
        "id": 25,
        "name": "Chao Wang"
      },
      {
        "id": 26,
        "name": "David Simpson"
      }
    ]

    [Example 4] - Create record

    Request:
    curl -X POST -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.partner -d "{'name': 'Created Partner'}"
    Response
    46

    [Example 5] - Update 3 records with one request

    Request:
    curl -X PUT -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.partner/25,26,46 -d "{'name': 'New name'}"
    Response
    true

    [Example 6] - Delete selected records

    Request:
    curl -X DELETE -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/res.partner/26,46
    Response
    true

    [Example 7] - Execute model method - confirm sale order

    Request:
    curl -X POST -u admin:admin -H "Content-Type: text/html" http://localhost:8069/rest/sale.order/action_confirm/3
    Response
    true
    Any questions?
    Want to test this module?
    Email me: grzegorzgk1@gmail.com

    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.