Skip to Content
Menu

Odoo Standard RESTful JSON API

by
Odoo

170.90

v 18.0 Third Party 38
Live Preview
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 2013
Technical Name easy_restjson
LicenseOPL-1
Websitehttps://ekika.co
Versions 12.0 13.0 14.0 15.0 16.0 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 2013
Technical Name easy_restjson
LicenseOPL-1
Websitehttps://ekika.co
Versions 12.0 13.0 14.0 15.0 16.0 17.0 18.0

Odoo Standard RESTful JSON API

Background Image

How It Works:

By defining a standard structure for API requests and responses, this module promotes consistency and ease of use.

Each request includes a various methods such as Search, Search Read, Read, Check Access Right, & Create etc, that defines the action to be performed on the resource. The server's response typically contains the requested data in JSON format, along with an HTTP status code to indicate success or failure.

Standard REST Json API Request's Overview:

POST
{domain[:port]}/{endpoint}/{model}/{method}
  • This is the main query parameters which is mandatory to write when you are working with APIs.
  • Use "HTTP POST Method" to send specific data.
  • Domain is specified your wesite's domain address. The port number is optional.
  • Endpoint is the specific path within the API that identifies the particular resource or action. This part of the URL tells the server what type of operation is being requested.
  • Model is Odoo's technical name of entities and also known as model name, record's model or entities. You can identify it from the URL shown below.
  • Method specifies the type of action being performed on the server.
  • Domain Image
  • Headers in an API request are key-value pairs sent between the client and the server, providing additional information about the request or the client itself. They are part of the HTTP protocol and can carry various types of metadata.
  • Add "Content-Type" and "x-api-key" keys with their specific values. REST API's media type designation is "application/json". Add this in Content-Type's value field and also add your API Key.
  • Rest JSON API Headers

Search Read:

POST
http://localhost:8016/api-rest-json/res.partner/search_read

See the Example with Query & Output:

Example: This query combines search and read operations for res.partner records in a local Odoo instance via the /api-rest-json/res.partner/search_read endpoint. It retrieves records that match specified criteria and returns their details in a single request.

Query & Output
Rest JSON Search Read Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/search_read"

payload = json.dumps({
"args": [
    [
    [
        "is_company",
        "=",
        True
    ]
    ]
],
"kwargs": {
    "fields": [
    "name",
    "country_id",
    "comment",
    "is_company"
    ],
    "limit": 5
}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Search Count:

POST
http://localhost:8016/api-rest-json/res.partner/search_count

See the Example with Query & Output:

Example: This query returns the count of res.partner records in a local Odoo instance via the /api-rest-json/res.partner/search_count endpoint.

Query & Output
Rest JSON Search Count Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/search_count"

payload = json.dumps({
"args": [
    [
    [
        "is_company",
        "=",
        True
    ]
    ]
],
"kwargs": {}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Read:

POST
http://localhost:8016/api-rest-json/res.partner/read

See the Example with Query & Output:

Example: This query retrieves details of res.partner records from a local Odoo instance via the /api-rest-json/res.partner/read endpoint.

Query & Output
Rest JSON Read Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/read"

payload = json.dumps({
"args": [
    [
    14,
    10,
    11
    ]
],
"kwargs": {
    "fields": [
    "name",
    "country_id",
    "comment",
    "is_company"
    ]
}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Read Group:

POST
http://localhost:8016/api-rest-json/res.partner/read_group

See the Example with Query & Output:

Example: This query retrieves grouped data for res.partner records in a local Odoo instance via the /api-rest-json/res.partner/read_group endpoint. It allows grouping records based on specified fields.

Query & Output
Rest JSON Read Group Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/read_group"

payload = json.dumps({
"args": [
    [
    [
        "is_company",
        "=",
        False
    ]
    ]
],
"kwargs": {
    "fields": [
    "name",
    "country_id",
    "comment",
    "is_company"
    ],
    "groupby": "country_id"
}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Create:

POST
http://localhost:8016/api-rest-json/res.partner/create

See the Example with Query & Output:

Example: This query creates a new res.partner record in a local Odoo instance via the /api-rest-json/res.partner/create endpoint. It uses the POST method to send the necessary data for the new record.

Query & Output
Rest JSON Create Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/create"

payload = json.dumps({
"args": [
    {
    "name": "Sample Partner",
    "email": "sample-partner@example.com"
    }
],
"kwargs": {}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Write:

POST
http://localhost:8016/api-rest-json/res.partner/write

See the Example with Query & Output:

Example: This query updates existing res.partner records in a local Odoo instance via the /api-rest-json/res.partner/write endpoint. It uses the POST method to send updated data for specific records, modifying their fields.

Query & Output
Rest JSON Write Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/write"

payload = json.dumps({
"args": [
    [
    49
    ],
    {
    "name": "Sample Partner Change",
    "email": "sample-partner-change@example.com"
    }
],
"kwargs": {}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Fields Get:

POST
http://localhost:8016/api-rest-json/res.partner/fields_get

See the Example with Query & Output:

Example: This query retrieves the field definitions for the res.partner model in a local Odoo instance via the /api-rest-json/res.partner/fields_get endpoint. It provides information about the fields, such as their types, labels, and other properties.

Query & Output
Rest JSON Fields Get Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/fields_get"

payload = json.dumps({
"args": [],
"kwargs": {
    "attributes": [
    "string",
    "help",
    "type"
    ]
}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Check Access Rights:

POST
http://localhost:8016/api-rest-json/res.partner/check_access_rights

See the Example with Query & Output:

Example: This query checks the access rights for the res.partner model in a local Odoo instance via the /api-rest-json/res.partner/check_access_rights endpoint. It verifies whether the user has the necessary permissions (such as create, read, write, delete) for the specified model.

Query & Output
Rest JSON Check Access Rights Request
Query:
*** python ***

import requests
import json

url = "http://localhost:8016/api-rest-json/res.partner/check_access_rights"

payload = json.dumps({
"args": [
    "create"
],
"kwargs": {}
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Swagger Documentation

Document View Setting 2 Document View Setting 1

Services EKIKA Provides

EKIKA is your destination for expert Odoo ERP implementation and customization. We pride ourselves on building reliable, trust-based partnerships that give you full transparency and control over your business processes.

With over 12 years of experience, we can assist you with eCommerce platforms, production planning, point-of-sale systems, managing inventory adjustments, and providing advanced field worker tracking solutions to optimize your workflows and boost operational efficiency.

Ekika Odoo Implementation

Implementation

Utilise Odoo ERP tailored for your business needs for smooth operations.

Ekika Odoo Customization

Customization

Personalized adjustments to Odoo modules for seamless management.

Ekika Odoo Support

Support

Ongoing assistance and maintenance to optimize your Odoo system's performance.

Are you struggling with disorganized operations, high operational costs, or lack of transparency in your processes? What sets us apart is our commitment to personalized solutions tailored to your unique business needs and our proactive support, ensuring seamless integration and ongoing success.

Would you like to explore Odoo ERP for your business? Schedule a free consultation with EKIKA today!

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

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.