Odoo RESTful API Framework with JsonAPI, GraphQL and more

by
Odoo

100.44

v 17.0 Third Party 3
Live Preview
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 5115
Technical Name api_framework
LicenseOPL-1
Websitehttps://ekika.co
Versions 15.0 17.0 16.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 5115
Technical Name api_framework
LicenseOPL-1
Websitehttps://ekika.co
Versions 15.0 17.0 16.0
Supported Versions 15.0 16.0 17.0
Community
Enterprise

https://www.ekika.co/support

Odoo RESTful API Framework

Stop Wasting Time, Get More Done with API Framework!

Our RESTful API Solution provides 'easy-to-use' and 'flexible-to-maintain' RESTful APIs.

How these REST APIs can be used?

  • Automate Repetitive Tasks from External Systems
  • Streamline Workflows
  • Odoo Integration with Other Application
  • Build Custom Dashboards and Make Odoo Data Source
  • Make Mobile Applications
  • Create New UI of Odoo
  • Integrate IoT Solutions

Features these API Framework Provides:

  • Create Multiple APIs
  • Flexible API Request Options
  • Various Access and Authentication
  • Automate Login and Sign-up
  • Seamless Scaling for Reduced Downtime
  • Simplified Management
  • Building-block API Design

Multiple REST APIs, Auth & Access using API Framework
Easy to Use, Control and Customize Securely.

What is API Framework? and How it Works?

  • REST API simplifies communication and act as intermediaries between different software systems. It allows them to interact and share data seamlessly over the internet using HTTP requests. For example, a Rest API can enable a website to fetch information from a database, or it can allow a mobile app to send data to a server. In simpler terms, Rest API acts as a bridge that helps different applications talk to each other and work together smoothly, making tasks like data sharing and integration much easier.
  • This Odoo REST API Framework allows you most used trending REST API technologies with secure authentication and user centric data (odoo-model) access management.
  • Using this API Framework you can Integrate Various Applications, Access and Manage Data, Execute Odoo Workflows, Build Mobile Apps and Connect Web Application and Services, Extend Functionalities, Connect IoT devices, Automate External Systems and Customize Odoo and much much more.
True Dynamic

APIs with dynamically calculated models with both json-api and graphql for demand-based responses.

Json:API & GraphQL

Auth & Access

It has a strong foundation of authentication and authorization system using various alternate options.

Secure and Controlled

No-Extra-Code

No extra code required, your custom models are supported. But you have the option to do it as well.

Hassel Free Maintanance

Data Security

Provides you security. We don't bypass Odoo's authentication process, which makes risk-free business data APIs.

X route(.., auth=None, ..)

Limitless

Powerful to make a new frontend using Odoo backend. Integrate for Real-Time Updates like IoT.

Wings to Fly

Equipped

Plenty of free code snippets available to get started on your activity quickly.

Powerful Tools

JSON API OAuth2 Custom Access GraphQL API-Key
Basic Auth CRUD Sudo-Access Login-Pass
Method Calling Upload-Download
Schema Debugging
Dynamic & more...

Conclusion, this RESTful API Solution fits with each and every aspect of the ERP needs in terms of external exposure of data from your central ERP system.

As a dedicated but growing team, we're always striving to deliver the best possible experience. We value your feedback, so don't hesitate to share your concerns or specific requirements. We believe in open communication and collaboration. We value your feedback, so don't hesitate to share your concerns or specific requirements. We welcome your feature requests, and budget considerations to ensure our API solution perfectly aligns with your business goals.

RESTful API Framework Package Installation and Configuration.

Overview of Installation and Set-up Procedure.

This Odoo API Framework in designed to use in very easy manner. All you need to do is follow few steps defined below.

How to quick start Odoo API Framework for External Connectivity?:
  • Download the module file (usually a .zip file) from a Odoo App Store or from https://ekika.co website.

    When downloading applications prioritize using official sources like our website https://ekika.co or https://git.ekika.co or the Odoo Apps Store to ensure app quality, security, and ongoing support. Avoid using apps from untrusted third-party sources to mitigate the risk of security vulnerabilities and compatibility issues.
  • Put modules in addons path and ensure your Odoo 17 instance is up again and running with new files in consideration.
  • Install API Framework modules.
  • Setup user by givine access for APIs based on your operational method.
  • Once you install module and grant access you will find main API menu in your Odoo environment.
  • Setup Odoo RESTful API as per your desired need with communication protocol style, authentication, authorization style and use our Postman collection to speed up practical instead of reading documentation.
  • POSTMAN Collection: https://git.ekika.co/EKIKA.co/Odoo-API-Framework-POSTMAN-Collection

    You should update url and authentication option based on your api configuration. Also you may require to update id for reference record based on your environment where applicable.

Congratulations on starting to leverage APIs! This opens doors to exciting integrations that can significantly enhance your application's capabilities.

Prerequisites:

  • Download the module file (usually a .zip file) from a trusted source like https://ekika.co OR Odoo App Store
  • Ensure your Odoo 17 instance is up and running.
  • Have administrative access to your Odoo instance (self-hosted or odoo.sh).

How to install Odoo Apps?

  • Download the Module:
    • Locate the appropriate module for your needs on a trusted repository like the Odoo Apps Store (https://apps.odoo.com/apps) or from our website https://ekika.co .
    • Download the module file (typically a .zip file).
    How to download app from odoo app store.
  • Extract the Module Files:
    • Use a decompression tool like WinRAR or 7-Zip to extract the contents of the downloaded .zip file. This will create a folder containing the module's files.
  • Place the Module in the Addons Path (Custom Addons Recommended or Commit to your Version Control system i.e. git):
    • Recommended: Create a dedicated custom_addons repository/folder similar to your main Odoo addons directory. This keeps official and custom modules organized.
    • Odoo.sh: If using Odoo.sh, upload the extracted folder to the ~/src/user/ directory OR recommended to commit in custom addons.
    • Direct Odoo Installation: For a self-hosted Odoo instance, copy or move the extracted folder to the addons directory within your Odoo project directory using git recommended.
  • Using Git for Version Control (Optional but Recommended):
    • If the module is available in a Git repository, consider using Git for version control:
    • Navigate to your custom_addons directory using the terminal.
    • Clone the repository using the git clone command and the provided URL.
    • This approach allows you to track changes, collaborate with others, and easily update the module.
    • We manage our api addons for customers for regular important updates too. We strongly recommend you to use direct source to keep you up to date with changes. Send us email after purchase on hello@ekika.co to get access to our repository.
    Get API Repository Access
  • Restart Your Odoo Service:
    • For changes to take effect, restart your Odoo service. The specific method may vary depending on your installation method (manual, Docker, service manager like systemd). Refer to your Odoo documentation for detailed instructions.
  • Open Odoo in Your Browser and Log In with Admin Access:
    • Access your Odoo instance in a web browser (usually http://localhost:8069) in local system.
    • Use your administrator credentials to log in.
    Login with Admin
  • Activate Developer Mode:
    • Developer mode is typically required for installing newly added addons.
    • Go to Settings (usually a gear icon in the main menu).
    • Scroll to bottom in settings.
    • Click the link to activate Developer mode or add query-parameter in URL: &debug=1 after the /web and before # in the url.
    Activate Debug Mode Image
  • Update the Module List:
    • Go to the Apps section in your Odoo instance.
    • Click on Update Apps List. This ensures Odoo detects the newly added module from your addons path in configuration file.
    Update App List
  • Find and Install the "api_framework" App:
    • If the module you're installing depends on the api_framework app, search for it in the Apps section. (Optional in case if you are installing our free api helper modules)
    • If it's not already installed, click Install to proceed.
    Install API Framework
  • Configure API Permissions (Required to grant permission to API manager or User):
  • Verify Installation and Access:
    • Depending on the module, you might need to access specific menus or functionalities to verify successful installation. If you can see main API menu you have enough access to get started. You require administrative access as api containes user permission and user and permission management require user record access.
  • Additional Tips:
    • Backup: It's always recommended to back up your Odoo database before installing new modules, especially custom ones. Because we do not know you environment and what are things attached with module installation procedure.
    • Custom Modules and Security: Exercise caution when installing custom modules from untrusted sources. They could introduce security vulnerabilities or may cause weired behaviour in your environment.

What is API Authentication?

API authentication is the process of verifying the identity of a client or user who is making an API request. It ensures that only authorized users or systems are granted access to the API's resources or functionality. Authentication mechanisms typically involve the exchange of credentials or tokens between the client and the API server to establish trust and validate the client's identity. This process helps to maintain the security and integrity of the API by preventing unauthorized access and misuse of its services. There are various authentication methods commonly used in APIs:

  • API-Key Based
  • Basic Authentication
  • User Credentials
  • OAuth2

Here, we explain every API Authentication in brief:

  • API-Key Based: A simple method where clients include a unique key in their requests to authenticate themselves. These keys are passed in the request headers. The most popular choice for including API keys in headers "x-api-key" is a custom header convention for passing your API key. The API key must be sent with every request.
  • API Key is located on the API listing section and inside that request, you can add your API Key Manually or Auto Generated.
  • Then you have to add the API Key to your postman's headers in x-api-key's value field.
  • API-Key Based
    API-Key Based
  • Basic Authentication: In this method the client or user sends a request. The request header contains the Base64-encoded username and password, seprated by a colon. When handling the request, the server decodes the login details and checks if the user can access the requested content.
  • Basic Authentication
    Basic Authentication
  • User Credentials: In this method the client provides its username and password to the API server as proof of identity. The server then verifies these credentials against its records to authenticate the client. If the provided credentials match those stored in the server's database, the client is granted access to the API's resources or services.
  • User Credentials
  • OAuth2: OAuth2 stands for "Open Authorization 2.0". It is the second version of the OAuth protocol, which is an open standard for access delegation commonly used for API authentication and authorization. OAuth 2.0 is a widely used authorization framework that allows applications to securely access resources on behalf of users without needing their credentials. It's commonly used for API authentication in web and mobile applications. OAuth 2.0 uses Access Tokens. An Access Token is a piece of data that represents the authorization to access resources on behalf of the end-user.

JSON API

Introduction

JSON API is a specification for building APIs (Application Programming Interfaces) in JSON format. It provides guidelines for how client applications can request and receive data from a server.

How It Works

JSON API works by defining a specific structure for API requests and responses, allowing for consistency and ease of use. Here's how it works:

Request:
  1. Endpoint: Clients make requests to specific endpoints (URLs) on the server to retrieve or manipulate resources. For example, a client might request a list of articles from the “/articles” endpoint.
  2. HTTP Methods: JSON API uses standard HTTP methods like GET, POST, PATCH, and DELETE for different operations. GET is used to retrieve data, POST to create new resources, PATCH to update existing resources, and DELETE to remove resources.
  3. Parameters: Clients can include query parameters in the request URL to specify filtering, sorting, pagination, sparse fieldsets, or include related resources. For instance, clients can request only specific fields of a resource, or request related data to be included in the response.
  • Learn more about JSON API from here.
  • Also, Checkout https://jsonapi.org/ for official documentation of JSON API.

Create JSON API

  • First we have to go into our API listiing section where all the APIs are listed. Then click New to create new API showed in image below.
  • Create JSON API
  • Add the Name, Endpoint, Authentication, Access Control, & generate the API Key for the perticular user you want to give access to. Note: If you are not able to generate the API Key then make sure to do this following steps: Go to Configuration >> Settings >> API Key Settings >> Select Auto.
  • Copy the Endpoint URL and add it to the postman request section field. After that you have to add you model name (E.G res.partner). After that you can write your query by simply adding ? after the model name.
  • Add this API Key to Get Requests Header, inside key field enter X-API-Key and add the API Key in value field shown in image below.
  • JSON API Query Headers
  • Add the query parameters as you required.
  • JSON API Query
  • After adding query parameers you can simply send the request by clicking send button.
  • You will get this type of response shown in image below.
  • JSON API Query Output
Checkout below module for more information related to JSON API.
EKIKA JSON API Module

GraphQL API

Introduction

GraphQL is a query language for APIs and a runtime for executing those queries with existing data.

  1. Declarative Data Fetching: GraphQL allows clients to request only the data they need and nothing more. Clients can specify the shape and structure of the response, reducing the over-fetching and under-fetching of data that often occurs in REST APIs.

  2. Hierarchical Structure: GraphQL queries have a hierarchical structure, mirroring the shape of the response data. Clients can request nested fields, and the server responds with a JSON object that matches the requested structure.

How It Works

In GraphQL, queries and mutations are two types of operations used to interact with the API:

  1. Query Operation: A query in GraphQL is used to read or fetch data from the server. Clients can specify exactly what data they need, and the server will return only the requested data, no more and no less. Queries are similar to GET requests in REST APIs.
  2. Mutation Operation: A mutation in GraphQL is used to modify data on the server. Mutations are similar to POST, PUT, PATCH, or DELETE requests in REST APIs. Mutations can be used for creating, updating, or deleting records.
  • Learn more about GraphQl API from here.
  • Also, Checkout https://graphql.org/learn/ for official documentation of GraphQL API.

Create GraphQL API

  • First we have to go into our API listiing section where all the APIs are listed. Then click New to create new API showed in image below.
  • Create GraphQL API
  • Add the Name, Endpoint, Authentication, Access Control, & generate the API Key for the perticular user you want to give access to. Note: If you are not able to generate the API Key then make sure to do this following steps: Go to Configuration >> Settings >> API Key Settings >> Select Auto.
  • Copy the Endpoint URL and add it to the postman request section field. You don't have to add any query in this field.
  • Add this API Key to Post Requests Header, inside key field enter X-API-Key and add the API Key in value field shown in image below.
  • GraphQL API Query Headers
  • Write the query as you required.
  • GraphQL API Query
  • After adding query you can simply send the request by clicking send button.
  • You will get this type of response shown in image below.
  • GraphQL API Query Output
Checkout below module for more information related to GraphQL API.
EKIKA GraphQL API Module

API-Key Authentication

This module serves as a fundamental building block within the API Framework. To implement API-key based authentication in your API configuration system, it is essential to integrate this module. Keep in mind that this module is not designed to function independently; it relies on the API Framework Base (api_framework_base) as its foundation to seamlessly operate with various API authentication mechanisms.

Auth API-Key Introduction

API-Key authentication is a simple and effective way to secure your API endpoints by requiring clients to include an API key in the request headers. This authentication method ensures that only authorized users can access your API resources.

How It Works

When making a request to an API endpoint that requires authentication, clients must include an X-API-Key header in the HTTP request. The value of this header should be the API key provided to the client by the API provider.

  • Learn more about Auth API-Key from here.

Api OAuth2

OAuth2 stands for "Open Authorization 2.0". It is the second version of the OAuth protocol, which is an open standard for access delegation commonly used for API authentication and authorization. OAuth 2.0 is a widely used authorization framework that allows applications to securely access resources on behalf of users without needing their credentials. It's commonly used for API authentication in web and mobile applications. OAuth 2.0 uses Access Tokens. An Access Token is a piece of data that represents the authorization to access resources on behalf of the end-user.

Introduction

This module include authorization-code-grant flow of OAuth2 for API.

How It Works

Auhtorization and Token Related Steps:

  • First, client register redirect-uri, which is provided in api record form, to its respected provider.
  • Client has to made request to "/<api>/oauth2/provider/authorize" with its client_id in request-body(json), which returns authorization_url in json-body from response
  • When client use this authorization_url, client has to authorize with its respected user, after successful authorization server returns token information, which includes:
    • access_token, refresh_token, expires_in, expires_at, scope, token_type, id_token. Note: this differs from provider
    • db, login
  • If client wants to refresh the token & get access-token then made request to "/<api>/oauth2/token" with its client-id, client-user-identity in request-body(json), which return new token related information
  • If client wants to revoke the token then made request to "/<api>/oauth2/revoke" with its client-id, client-user-identity in request-body(json), which revoke the token from authorization server and also delete the client api user record.
  • API Resource Access Steps:

    • When client want fetch api data using oauth2 method, made http-request using header: Authorization: Bearer access_token_value
    • If access_token in valid then it return response data. and if access_token invalid then client has to refresh the token or authorize the user again.
For More Details
Python Request Examples:

1. Client Authorization:

import requests
import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/provider/authorize"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type': 'application/json'
}

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

print(response.text)

2. Refresh Token:

import requests
import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/token"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type': 'application/json'
}

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

print(response.text)

3. Revoke Token:

import requests
import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/revoke"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type''application/json'
}

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

print(response.text)
  • Learn more about Api Oauth2 from here.

Basic Authentication

Introduction

HTTP Basic Authentication is a simple authentication scheme built into the HTTP protocol. It is based on challenge-response mechanism and is widely used for securing web applications and APIs. This document provides an overview of HTTP Basic Authentication, how it works, and examples of how to implement it.

Format of Authorization Header

The Authorization header for HTTP Basic Authentication is constructed as follows:

Authorization: Basic base64(username:password)

The base64(username:password) is the base64 encoding of the concatenation of the username and password, separated by a colon (:).

Headers

Key Value
Authorization Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Example

Here's an example using cURL:

curl -X GET "https://api.example.com/resource" -H "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ="

Here's an example using Python:

import requests
    
api_url = 'https://api.example.com/resource'

# Make an authenticated GET request
headers = {
    'Authorization': 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
}

response = requests.get(api_url, headers=headers)
  • Learn more about Auth Basic from here.
  • Also, Checkout RFC 7617 for official documentation of "Basic" HTTP authentication.

User Authentication

Introduction

The user authentication API requests using username and password headers. By following these instructions, developers can ensure secure communication with the API server.

How It Works

The user authentication works by sending a username and password in the HTTP request header. The server challenges the client with a 401 Unauthorized response, indicating that authentication is required. The client then includes the username and password in the Authorization header of subsequent requests.

Headers

Key Value
username your-username
password your-password
Example

Here's an example using cURL:

curl -X GET -H "username: your-username" -H "password: your-password" https://api.example.com/resource

Here's an example using Python:

import requests
    
api_url = 'https://api.example.com/resource'

# Make an authenticated GET request
headers = {
    'username': 'your-username',
    'password': 'your-password',
}

response = requests.get(api_url, headers=headers)
  • Learn more about Auth User Credential from here.

JSON API Get Request Overview:

A GET Request in JSON API is a request to retrieve data from a server, in here it's retrieve data from odoo. It typically involves specifying the endpoint URL along with optional query parameters to filter or shape the response data. The response from the server is usually in JSON format, containing the requested data or an error message.

GET
{domain[:port]}/{endpoint}/{model}
  • This is the main query parameters which is mandatory to write when you are working with APIs.
  • Use "HTTP Get Method" to retrieve specific record from odoo.
  • 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.
  • Domain Image
  • To insert query we have to add "?" after the model, so it will indicates that query parameters is starting.
  • All other query parameters are included after model that you can see on next tabs.
  • 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. JSON API's media type designation is "application/vnd.api+json". Add this in Content-Type's value field and also add your API Key.
  • Ekika Header Image

Get Record with ID:

GET
{domain[:port]}/{endpoint}/{model}/{id}
  • The id indicates that specific record we want to retrieve.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches data for the sale.order model with ID 16 from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order/16

Query Parameters Output
Ekika JSON API Get Records with ID Query
Ekika JSON API Get Records with ID Output

Example(2): This JSON API query fetches data for the res.partner model with ID 14 from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/res.partner/14

Query Parameters Output
Ekika JSON API Get Records with ID Query
Ekika JSON API Get Records with ID Output

Get Record with Fields:

GET
{domain[:port]}/{endpoint}/{model}?fields[{model}]=field_name
  • The fields parameter is used to specify which fields of the model you want to retrieve. It's structured as "fields[{model}]=field_name"

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query retrieves specific fields name and date_order for all sale orders from the endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?fields[sale.order]=name,date_order

Query Parameters Output
Ekika JSON API Get Records with Fields Query
Ekika JSON API Get Records with Fields Output

Example(2): This JSON API query retrieves only the name and email fields for all res partners from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/res.partner?fields[res.partner]=name,email

Query Parameters Output
Ekika JSON API Get Records with Fields Query
Ekika JSON API Get Records with Fields Output

Get Record with Pagination:

GET
{domain[:port]}/{endpoint}/{model}?page[number]=1&page[size]=4
  • The page number parameter specifies the page number of the records you want to retrieve. The "page[number]=1" indicates the first page.
  • The page size parameter determines the number of records to be returned per page. The "page[size]=4" means that each page should contain four records.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches the first page of sale orders with a page size of 4 from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?page[number]=1&page[size]=4

Query Parameters Output
Ekika JSON API Get Records with Pagination Query
Ekika JSON API Get Records with Pagination Output

Example(2): This JSON API query retrieves the fifth page of res partners, with each page containing 3 res partners, from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/res.partner?page[number]=5&page[size]=3

Query Parameters Output
Ekika JSON API Get Records with Pagination Query
Ekika JSON API Get Records with Pagination Output

Get Record with Sorting:

GET
{domain[:port]}/{endpoint}/{model}?sort={fields_name}
  • The sort indicates the records to be sorts based on the specified field in ascending order sort={fields_name}. For Descending use "-", sort=-{fields_name}.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches sale orders from the endpoint demotestapi sorted by the name field in ascending order.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?sort=name

Query Parameters Output
Ekika JSON API Get Records with Sorting Query
Ekika JSON API Get Records with Sorting Output

Example(2): This JSON API query fetches sale orders from the endpoint demotestapi sorted primarily by the date_order field in ascending order, and then by the name field in ascending order as a secondary sorting criteria.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?sort=date_order,name

Query Parameters Output
Ekika JSON API Get Records with Sorting Query
Ekika JSON API Get Records with Sorting Output

Get Record with Filter:

GET
{domain[:port]}/{endpoint}/{model}?filter={domain}
  • The filter parameter is used to specify the filtering criteria in Odoo domain notation filter={domain}.
  • In Odoo domain notation, filtering conditions are represented as lists. The basic structure typically involves a combination of logical operators (AND, OR) and tuples representing field, operator, and value conditions. Using Odoo domain notation allows for advanced filtering capabilities, enabling the retrieval of specific records that meet complex criteria.

See the Example(1) with Query Parameters and Output:

Example(1): This JSON API query filters sale orders based on the conditions:

  • State is either 'sale' or 'cancel'.
  • Team ID is either 5 or 1.
  • Amount total is greater than 1000 and team ID is 1.
  • Partner ID is 11 or user ID is 6.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?filter=[AND, OR, ('state', '=', 'sale'), OR, ('state', '=', 'cancel'), ('team_id', '=', 5), OR, AND, ('amount_total', '>', 1000), ('team_id', '=', 1), OR, ('partner_id', '=', 11), ('user_id', '=', 6)]

Query Parameters Output
Ekika JSON API Get Records with Filter Query
Ekika JSON API Get Records with Filter Output

Get Record with Relational Fields:

GET
{domain[:port]}/{endpoint}/{model}?fields[{model}]=field_name
  • The fields[{model}]=field_name parameter allows the selection of specific fields from the model, including relational fields.
  • Relational fields in a database model establish relationships between different entities or models. For example, in the "sale.order" model, partner_id represent a relationship with the res.partner model.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches only the specified fields name, partner_id, and payment_term_id for all sale orders from the specified endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?fields[sale.order]=name,partner_id,payment_term_id

Query Parameters Output
Ekika JSON API Get Records with Relational Fields Query
Ekika JSON API Get Records with Relational Fields Output

Example(2): This JSON API query retrieves the specified fields name, parent_id, and child_ids for all partners from the provided endpoint demotestapi.

Query: http://api.17.dev.ekika.co/demotestapi/res.partner?fields[res.partner]=name,parent_id,child_ids

Query Parameters Output
Ekika JSON API Get Records with Relational Fields Query
Ekika JSON API Get Records with Relational Fields Output

Get Record with Relational Fields with Include:

GET
{domain[:port]}/{endpoint}/{model}?fields[{model}]=field_name&include=relational_field
  • The fields[{model}]=field_name parameter allows the selection of specific fields from the model, including relational fields.
  • The include parameter instructs the API to include the related data for the specified relational field in the response.
  • Relational fields establish connections or relationships between different entities or models.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches sale orders with fields name, partner_id, and date_order, and includes related partner information for each sale order.

Query: http://api.17.dev.ekika.co/demotestapi/sale.order?fields[sale.order]=name,partner_id,date_order&include=partner_id

Query Parameters Output
Ekika JSON API Get Records with Relational Fields with Include Query
Ekika JSON API Get Records with Relational Fields with Include Output

Example(2): This JSON API query retrieves partner data with fields name, parent_id, and child_ids, while also including information about the parent partner for each partner entry.

Query: http://api.17.dev.ekika.co/demotestapi/res.partner?fields[res.partner]=name,parent_id,child_ids&include=parent_id

Query Parameters Output
Ekika JSON API Get Records with Relational Fields with Include Query
Ekika JSON API Get Records with Relational Fields with Include Output

Get Record with Relational Fields, Include and Relational Include Data:

GET
{domain[:port]}/{endpoint}/{model}?fields[{model}]=field_name&include=relational_field&fields[{relation_model}]=field_name
  • The fields[{model}]=field_name parameter allows the selection of specific fields from the model, including relational fields.
  • The fields[{relation_model}]=field_name parameter allows the selection of specific fields from related models.
  • The include parameter instructs the API to include the related data for the specified relational field in the response.
  • Relational fields establish connections or relationships between different entities or models.

See the Example(1) & Example(2) with Query Parameters and Output:

Example(1): This JSON API query fetches sale order data with fields name, partner_id, and date_order, including partner information for each sale order with fields name and email.

Query: https://api.17.dev.ekika.co/demotestapi/sale.order?fields[sale.order]=name,partner_id,date_order&include=partner_id&fields[res.partner]=name,email

Query Parameters
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Query
Output
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Output
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Output

Example(2): This JSON API query retrieves sale order data with specific fields name, partner_id, order_line, and tag_ids, including related order lines and tags. Additionally, it fetches partner information with fields name and email, along with product quantity details for each order line, and tag names for each tag.

Query: https://api.17.dev.ekika.co/demotestapi/sale.order?fields[sale.order]=name,partner_id,order_line,tag_ids&include=order_line,partner_id,tag_ids&fields[res.partner]=name,email&fields[sale.order.line]=name,product_uom_qty&fields[crm.tag]=name

Query Parameters
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Query
Output
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Output
Ekika JSON API Get Records with Relational Fields, Include and Relational Include Data Output

JSON API Create Request Overview:

A POST Request in a JSON API is a way to send data to odoo to create a new resource. In a POST request, the data to be created is typically sent in the body of the request in JSON format.

POST
{domain[:port]}/{endpoint}/{model}
  • This is the main query parameters which is mandatory to write when you are working with APIs.
  • Use "HTTP POST Method" to create records in odoo.
  • 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.
  • Domain Image
  • In Post Request Method you don't have to write any query parameters in the request field like in Get Request Method, you simply write the queries in JSON Format in the body field.
  • 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. JSON API's media type designation is "application/vnd.api+json". Add this in Content-Type's value field and also add your API Key.
  • Ekika Header Image
Odoo's ORM (Object-Relational Mapping) & Field Types:

Odoo's ORM (Object-Relational Mapping) system allows you to define relationships between different models in your application. These relationships can be established using many2many, many2one, and one2many fields.

  • One2many: A one2many field creates a one-to-many relationship between the current model and another model. This means a single record of the current model is linked to multiple records of another model. It is defined as the inverse of a many2one field.
  • Many2one: A many2one field creates a many-to-one relationship between the current model and another model. This means multiple records of the current model can be linked to a single record of another model. It is essentially a foreign key.
  • Many2many: A many2many field creates a many-to-many relationship between two models. This means multiple records of the current model can be linked to multiple records of another model. This relationship is usually managed through a join table.

Create Record with attributes:

Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Demo Corporation Pvt Ltd.",
          "email": "demo@mail.com"
          "mobile": "1020304050",
          "company_type": "company",
          }
          }
          }
          

Example(1): This JSON API query Creates new res.partner with mentioned attributes like name, email, mobile, and company type.

Query Parameters Output
Ekika JSON API Create Records with Attributes Query
Ekika JSON API Create Records with Attributes Output

Create Record with relationship One2many Field:

  • Relationships: Defines any related resources associated with the partner entity being created. In this case, there is a relationship named "bank_ids" representing the bank accounts associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Demo Corporation Pvt Ltd.",
          "email": "demo@mail.com",
          "mobile": "1020304050",
          "company_type": "company"
          },
          "relationships": {
          "bank_ids":{
              "data": [
                  {
                  "type": "res.partner.bank",
                  "attributes": {
                      "sequence": 10,
                      "bank_id": 2,
                      "acc_number": "11212121212",
                      "allow_out_payment": true,
                      "acc_holder_name": false
                      }
                  }
              ]
          }
          }
          }
          }
          

Example(1): This request is structured according to JSON API conventions, facilitating the creation of a partner entity with associated bank accounts in a standardized manner.

Query Parameters Output
Ekika JSON API Create Records with Relationship One2many Field Query
Ekika JSON API Create Records with Relationship One2many Field Output

Create Record with relationship Many2One Field:

  • Relationships: Defines any related resources associated with the partner entity being created. In this case, there is a relationship named "user_id" representing the user accounts associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Demo Corporation Pvt Ltd.",
          "email": "demo@mail.com",
          "mobile": "1020304050",
          "company_type": "company"
          },
          "relationships": {
          "user_id": {
            "data": {
                "type": "res.users",
                "id": 2
              }
          }
          }
          }
          }
          

Example(1): This request is structured according to JSON API conventions, facilitating the creation of a partner entity with associated user accounts in a standardized manner.

Query Parameters Output
Ekika JSON API Create Records with Relationship Many2One Field Query
Ekika JSON API Create Records with Relationship Many2One Field Output

Create Record with relationship Many2Many Field:

  • Relationships: Defines any related resources associated with the partner entity being created. In this case, there is a relationship named "category_id" representing the categories associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Demo Corporation Pvt Ltd.",
          "email": "demo@mail.com",
          "mobile": "1020304050",
          "company_type": "company"
          },
          "relationships": {
          "category_id": {
            "data": [
                {
                "type": "res.partner.category",
                "id": "4"
                },
                {
                "type": "res.partner.category",
                "id": "5"
                }
              ]
          }
          }
          }
          }
          

Example(1): This request is structured according to JSON API conventions, facilitating the creation of a partner entity with associated categories in a standardized manner.

Query Parameters Output
Ekika JSON API Create Records with Relationship Many2Many Field Query
Ekika JSON API Create Records with Relationship Many2Many Field Output

Create Record with Odoo's field types "One2Many", "Many2One", and "Many2Many" together:

  • Use odoo field types, "One2Many", "Many2One", and "Many2Many" all in 1 request.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Jannie wills",
          "email": "jannie@mail.com",
          "mobile": "1002003005"
          "function": "CTO",
          "city": "London",
          "street": "London st139"
          },
          "relationships": {
          "bank_ids":{
              "data": [
                  {
                  "type": "res.partner.bank",
                  "attributes": {
                      "sequence": 20,
                      "bank_id": 2,
                      "acc_number": "1230321",
                      "allow_out_payment": true,
                      "acc_holder_name": true
                      }
                  }
              ]
          },
          "user_id": {
              "data": {
                  "type": "res.users",
                  "id": 2
              }
          },
          "category_id": {
              "data": [
                  {
                  "type": "res.partner.category",
                  "id": "4"
                  },
                  {
                  "type": "res.partner.category",
                  "id": "5"
                  }
              ]
          }
          }
          }
          }
          

Example(1): This request is structured according to JSON API conventions, facilitating the creation of a partner entity with associated Bank Accounts as One2many in a standardized manner and also a Sales Person assign to it as "Many2one" field type, and gave multile Tags to that person as "Many2many" field type.

Query Parameters Output
Ekika JSON API Create Records with Multiple Relationships Query
Ekika JSON API Create Records with Multiple Relationships Query

Record's created in dashboard.

Output Output
Ekika JSON API Create Records with Multiple Relationships Output
Ekika JSON API Create Records with Multiple Relationships Output

Date & Time format in Odoo:

  • In Odoo, date fields are used to store date and datetime values in the models. These fields are essential for tracking and managing time-related data, such as order dates, due dates, creation dates, etc. Odoo provides specific field types to handle date and datetime data effectively.
  • By default Odoo handles time zones by storing all datetime values in the database in Coordinated Universal Time (UTC).
How Odoo Handles Time Zones?
  1. Storage in UTC:
    • All datetime values are stored in UTC in the database. This approach ensures a single, consistent time reference.
  2. Conversion to User's Local Time Zone:
    • When a datetime value is displayed to a user, Odoo automatically converts it from UTC to the user's local time zone. The user's time zone can be set in their preferences.
  3. Setting User Time Zone:
    • Each user in Odoo can have their own time zone setting. This can be configured in the user's preferences under the "Preferences" menu.
Query:
          {
          "data": {
          "type": "sale.order",
          "attributes": {
          "date_order": "2023-06-12 10:22:57"
          },
          "relationships": {
          "partner_id": {
          "data": {
          "type": "res.partner",
          "id": "80"
          }
          },
          "tag_ids": {
          "data": [
          {
            "type": "crm.tags",
            "id": "2"
          },
          {
            "type": "crm.tags",
            "id": "1"
          }
          ]
          },
          "order_line": {
          "data": [
          {
            "type": "sample",
            "attributes": {
              "product_id": "36",
              "product_uom_qty": 6,
              "price_unit": "650.50"
            }
          },
          {
            "type": "sample",
            "attributes": {
              "product_id": "16",
              "product_uom_qty": 3,
              "price_unit": "680.75"
            }
          }
          ]
          }
          }
          }
          }
          

This JSON request is designed to create a new sale.order record in Odoo. It includes:

  • The order date and time.
  • A relationship to a customer (res.partner with ID 80).
  • Associations with two tags (crm.tags with IDs 2 and 1).
  • Two order lines, each specifying product details, quantities, and prices.

For better understanding, we added the example images below.

Query Parameters Output
Ekika JSON API Create Records Date & Time Format Query
Ekika JSON API Create Records Date & Time Format Output

You can see that in below image, we add the time 10:22:57 when writing the query, and it is showing the time 03:52:57 as the timezone which selected by us(IST). So, Odoo takes the time as UTC timezone.

Ekika JSON API Create Records Date & Time Format Output

Selection Field in Odoo:

  • Selection fields in Odoo are fields that allow users to choose from a predefined list of options.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Maggie",
          "email": "maggie@mail.com",
          "mobile": "1002003005",
          "function": "CTO",
          "city": "London",
          "street": "London st139",
          "ubl_cii_format": "ubl_bis3"
          }
          }
          }
          

We added the example images below for better understanding.

Note: Write the Key of the specific values in query while you are creating a new record. Refer the query parameters image.

Query Parameters Output
Ekika JSON API Create Records Selection Field Query
Ekika JSON API Create Records Selection Field Output

Below is the created record image which shows the selection field options list. You can add the option diectly while creating a new record, just make sure to write the Key Field in the query not the value.

Ekika JSON API Create Records Selection Field Output

JSON API Update Request Overview:

A Update Request JSON API is used to modify existing resources on odoo. This typically involves sending an HTTP PATCH request to the API endpoint demotestapi that corresponds to the resource you want to update.

PATCH
{domain[:port]}/{endpoint}/{model}
  • This is the main query parameters which is mandatory to write when you are working with APIs.
  • Use "HTTP PATCH Method" to update the records in odoo.
  • 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.
  • Domain Image
  • In PATCH Request Method you have to write some query parameters in the request field like in Get Request Method, you will learn about that in next tabs when you move forwad in this documentation.
  • 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. JSON API's media type designation is "application/vnd.api+json". Add this in Content-Type's value field and also add your API Key.
  • Ekika Header Image
Odoo's ORM (Object-Relational Mapping) & Field Types:

Odoo's ORM (Object-Relational Mapping) system allows you to define relationships between different models in your application. These relationships can be established using many2many, many2one, and one2many fields.

  • One2many: A one2many field creates a one-to-many relationship between the current model and another model. This means a single record of the current model is linked to multiple records of another model. It is defined as the inverse of a many2one field.
  • Many2one: A many2one field creates a many-to-one relationship between the current model and another model. This means multiple records of the current model can be linked to a single record of another model. It is essentially a foreign key.
  • Many2many: A many2many field creates a many-to-many relationship between two models. This means multiple records of the current model can be linked to multiple records of another model. This relationship is usually managed through a join table.

Update Record with Attributes:

Here, we already created a res partner ID 96, in which we are going to perform update records query to upadate the records.

Query:
          {
          "data": {
          "type": "res.partner",
          "id": 96,
          "attributes": {
          "name": "Joey Tribbiani",
          "email": "Joey@mail.com",
          "mobile": 1299129900,
          "city": "Gandhinagar",
          "website": "http://www.demosite.com",
          "function": "CTO"
          }
          }
          }
          

Example(1): This JSON object represents a PATCH request to update the details of a specific resource ID 96 in an API that uses the JSON.

Query Parameters Output
Ekika JSON API Update Records with Attributes Query
Ekika JSON API Update Records with Attributes Query
  • We created a res partner. Then we add the data of that person with the id which is assign to that person, in this case it's ID 96.
  • The request changes several attributes of this partner, such as their name, email, mobile number, city, website, and function showed in below image.
Ekika JSON API Update Records with Attributes Output

Update Record with relationship One2many Field:

  • Relationships: Defines any related resources associated with the partner entity being updated. In this case, there is a relationship named "bank_ids" representing the bank accounts associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "id": 96,
          "attributes": {
          "name": "Joey Tribbiani",
          "email": "Joey@mail.com",
          "mobile": 1299129900,
          "city": "Gandhinagar",
          "website": "http://www.demosite.com",
          "function": "CTO"
          },
          "relationships": {
          "bank_ids":{
              "data": [
                  {
                  "type": "res.partner.bank",
                  "attributes": {
                      "sequence": 10,
                      "bank_id": 2,
                      "acc_number": "23002300",
                      "allow_out_payment": true,
                      "acc_holder_name": true
                      }
                  }
              ]
          }
          }
          }
          }
          

Example(1): This request is update the bank account details of the user with ID 96.

Query when create record Query after update record
Ekika JSON API Update Records with Relationship One2many Field Query
Ekika JSON API Update Records with Relationship One2many Field Query
  • The request changes the relationship data of related bank account details of the person showed in below images.
Account number when created Account number after updated
Ekika JSON API Update Records with Relationship One2many Field Output
Ekika JSON API Update Records with Relationship One2many Field Output

Update Record with relationship Many2One Field:

  • Relationships: Defines any related resources associated with the partner entity being updated In this case, there is a relationship named "user_id" representing the user accounts associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Joey Tribbiani",
          "email": "Joey@mail.com",
          "mobile": 1299129900,
          "city": "Gandhinagar",
          "website": "http://www.demosite.com",
          "function": "CTO"
          },
          "relationships": {
          "user_id": {
            "data": {
                "type": "res.users",
                "id": 1
              }
          }
          }
          }
          }
          

Example(1): This request is update the sales person of the user with ID 96.

Query when create record Query after update record
Ekika JSON API Update Records with Relationship Many2One Field Query
Ekika JSON API Update Records with Relationship Many2One Field Query
  • The request changes the relationship data of related sales person details of the person showed in below images.
Sales person when created Sales person after updated
Ekika JSON API Update Records with Relationship Many2One Field Output
Ekika JSON API Update Records with Relationship Many2One Field Output

Update Record with relationship Many2Many Field:

  • Relationships: Defines any related resources associated with the partner entity being updated. In this case, there is a relationship named "category_id" representing the categories associated with the partner entity.
Query:
          {
          "data": {
          "type": "res.partner",
          "attributes": {
          "name": "Joey Tribbiani",
          "email": "Joey@mail.com",
          "mobile": 1299129900,
          "city": "Gandhinagar",
          "website": "http://www.demosite.com",
          "function": "CTO"
          },
          "relationships": {
          "category_id": {
            "data": [
                {
                "type": "res.partner.category",
                "id": "3"
                },
                {
                "type": "res.partner.category",
                "id": "6"
                }
              ]
          }
          }
          }
          }
          

Example(1): This request is update the tags field value of the user with ID 96.

Query when create record Query after update record
Ekika JSON API Update Records with Relationship Many2Many Field Query
Ekika JSON API Update Records with Relationship Many2Many Field Query
  • The request changes the tag values details of the person showed in below images.
Tags when created Tags after updated
Ekika JSON API Update Records with Relationship Many2Many Field Output
Ekika JSON API Update Records with Relationship Many2Many Field Output

Update Record with Odoo's field types "One2Many", "Many2One", and "Many2Many" together:

  • Use odoo field types, "One2Many", "Many2One", and "Many2Many" all in 1 request.
Query:
          {
          "data": {
          "type": "res.partner",
          "id": 96,
          "attributes": {
          "name": "Joey Tribbiani",
          "email": "Joeyupdated@mail.com",
          "mobile": 1299129900,
          "city": "Ahmedabad",
          "website": "http://www.demosite.com",
          "function": "CFO"
          },
          "relationships": {
          "bank_ids":{
              "data": [
                  {
                  "type": "res.partner.bank",
                  "attributes": {
                      "sequence": 20,
                      "bank_id": 1,
                      "acc_number": "999000999",
                      "allow_out_payment": true,
                      "acc_holder_name": true
                      }
                  }
              ]
          },
          "user_id": {
              "data": {
                  "type": "res.users",
                  "id": 1
              }
          },
          "category_id": {
              "data": [
                  {
                  "type": "res.partner.category",
                  "id": "4"
                  },
                  {
                  "type": "res.partner.category",
                  "id": "5"
                  }
              ]
          }
          }
          }
          }
          

Example(1): This request is structured according to JSON API conventions, facilitating the updation of a partner entity with associated Bank Accounts as One2many type in a standardized manner and also a Sales Person assign to it as "Many2one" field type, and gave multile Tags to that person as "Many2many" field type.

Query Parameters Query Parameters Continued
Ekika JSON API Update Records with Multiple Relationships Query
JSON API Update Records with Multiple Relationships Query

This is the all changes which is made through this PATCH Request. Refer the images below.

JSON API Update Records with Multiple Relationships Output
JSON API Update Records with Multiple Relationships Output

JSON API Delete Request:

A Delete Request in JSON API is used to remove a resource from odoo. This typically involves sending an HTTP DELETE request to the API endpoint corresponding to the resource you want to delete.

Delete
{domain[:port]}/{endpoint}/{model}/{id}
  • This is the main query parameters which is mandatory to write when you are working with APIs.
  • Use "HTTP DELETE Method" to delete the records in odoo.
  • 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.
  • Domain Image
  • ID indicates that specific record we want to delete.
  • 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. JSON API's media type designation is "application/vnd.api+json". Add this in Content-Type's value field and also add your API Key.
  • Ekika Header Image

This is the query in below image shows the query of specific record you want to delete from odoo & the header section also.

Ekika JSON API Delete Query

Request:

  1. Endpoint: Clients make requests to specific endpoints (URLs) on the server to retrieve or manipulate resources. For example, a client might request a list of articles from the "/articles" endpoint.
  2. HTTP Methods: JSON API uses standard HTTP methods like GET, POST, PATCH, and DELETE for different operations. GET is used to retrieve data, POST to create new resources, PATCH to update existing resources, and DELETE to remove resources.
  3. Parameters: Clients can include query parameters in the request URL to specify filtering, sorting, pagination, sparse fieldsets, or include related resources. For instance, clients can request only specific fields of a resource, or request related data to be included in the response.

Example of a JsonAPI Requests:

  • GET Requests:
  1. Sparse Fieldsets: Get sale.order with only the "name", "partner_id", "date_order" fields included in the response. GET /sale.order?fields[sale.order]=name,partner_id,date_order
  2. Including Related Resources: Get sale.order and include the related partner_id in the response. /sale.order?fields[sale.order]=partner_id&include=partner_id
  3. Pagination: Get the second page of sale.order with 5 records per page. GET /sale.order?page[number]=2&page[size]=5
  4. Sort: Get sale.order sorted by their date_order in descending order. GET /sale.order?sort=-date_order
  5. Filter: Get sale.order filter by standard odoo domain, consider below example. GET /sale.order?filter=[AND, OR, ('state', '=', 'sale'), OR, ('state', '=', 'cancel'), ('team_id', '=', 5), OR, AND, ('amount_total', '>', 1000), ('team_id', '=', 1), OR, ('partner_id', '=', 11), ('user_id', '=', 6)]

Get Records

JSON API Query Parameters Explanation:

JSON API is a specification for building APIs in JSON. This query is a set of parameters used in a JSON API request. These parameters define how the API should respond and what data should be included.

  • fields[res.partner]: Specifies the fields to include for the res.partner resource. This includes fields like name, is_company, email, phone, country_id, user_id, and company_id.
  • fields[res.country]: Specifies the fields to include for the res.country resource. This includes fields like name and code.
  • fields[res.users]: Specifies the fields to include for the res.users resource. This includes fields like name and active.
  • fields[res.company]: Specifies the fields to include for the res.company resource. This includes the field name.
  • Include Parameter: include: Specifies related resources to include along with the primary resource. In this case, it includes related resources like country_id, user_id, and company_id.
  • Pagination Parameters: page[number]: Specifies the page number of the result set. In this case, it's page number 1. page[size]: Specifies the number of items per page. In this case, it's 5 items per page.
  • Sorting Parameter: sort: Specifies the sorting order for the result set. The hyphen (-) before id indicates descending order. So, it sorts by name in ascending order and then by id in descending order.
  • Filtering Parameter: filter: Specifies the filter criteria to apply to the result set. In this case, it filters records where the field is_company is equal to true.
  • In summary, these parameters define how to fetch and manipulate data from the API, including which fields to include, which related resources to include, how to paginate the results, how to sort them, and how to filter them.
Headers Explanation:

These headers are used in a JSON API request to specify the format of the data being sent and to provide authentication information.

  • Content-Type: Specifies the format of the data being sent in the request body. In this case, it indicates that the data is in JSON API format (application/vnd.api+json).
  • x-api-key: Provides authentication information. It likely contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner? {..query params..}

Query Params
fields[res.partner] name,is_company,email,phone,country_id,user_id,company_id
fields[res.country] name,code
fields[res.users] name,active
include country_id,user_id,company_id
fields[res.company] name
page[number] 1
page[size] 5
sort name,-id
filter [('is_company', '=', true)]
Headers
Key Value
Content-Type application/vnd.api+json
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
      "meta": {
      "version": "1.1",
      "author-info": {
      "author": "Jane DOE",
      "author-email": "jane@ekika.co"
      },
      "documentation-link": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
      },
      "data": [
      {
      "type": "res.partner",
      "id": 14,
      "attributes": {
        "name": "Azure Interior",
        "is_company": true,
        "email": "azure.Interior24@example.com",
        "phone": "(870)-931-0505"
      },
      "relationships": {
        "country_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/relationships/country_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/country_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": {
            "type": "res.country",
            "id": 233
          }
        },
        "user_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/relationships/user_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/user_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "company_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/relationships/company_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14/company_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        }
      },
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/14"
      }
      },
      {
      "type": "res.partner",
      "id": 10,
      "attributes": {
        "name": "Deco Addict",
        "is_company": true,
        "email": "deco_addict@yourcompany.example.com",
        "phone": "(603)-996-3829"
      },
      "relationships": {
        "country_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/relationships/country_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/country_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": {
            "type": "res.country",
            "id": 233
          }
        },
        "user_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/relationships/user_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/user_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "company_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/relationships/company_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10/company_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        }
      },
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/10"
      }
      },
      {
      "type": "res.partner",
      "id": 1,
      "attributes": {
        "name": "EKIKA",
        "is_company": true,
        "email": "anand@ekika.co",
        "phone": "+91 9510031431"
      },
      "relationships": {
        "country_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/relationships/country_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/country_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": {
            "type": "res.country",
            "id": 233
          }
        },
        "user_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/relationships/user_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/user_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "company_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/relationships/company_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1/company_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        }
      },
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/1"
      }
      },
      {
      "type": "res.partner",
      "id": 56,
      "attributes": {
        "name": "Ekika Corporation New",
        "is_company": true,
        "email": "hello@ekika.co",
        "phone": "5554444555444"
      },
      "relationships": {
        "country_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/relationships/country_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/country_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "user_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/relationships/user_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/user_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "company_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/relationships/company_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56/company_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        }
      },
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/56"
      }
      },
      {
      "type": "res.partner",
      "id": 11,
      "attributes": {
        "name": "Gemini Furniture",
        "is_company": true,
        "email": "gemini_furniture@fake.geminifurniture.com",
        "phone": "(941)-284-4875"
      },
      "relationships": {
        "country_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/relationships/country_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/country_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": {
            "type": "res.country",
            "id": 233
          }
        },
        "user_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/relationships/user_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/user_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        },
        "company_id": {
          "links": {
            "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/relationships/company_id",
            "related": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11/company_id",
            "describedby": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
          },
          "data": null
        }
      },
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/11"
      }
      }
      ],
      "included": [
      {
      "type": "res.country",
      "id": 233,
      "attributes": {
        "name": "United States",
        "code": "US"
      },
      "relationships": {},
      "links": {
        "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.country/233"
      }
      }
      ],
      "links": {
      "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]",
      "first": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]",
      "prev": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]",
      "next": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=2&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]",
      "last": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=2&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]"
      }
      }
      curl --location --globoff 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]' \
      --header 'Content-Type: application/vnd.api+json' \
      --header 'x-api-key: {Your API-Key}'
      
      import requests
      import json

      url = "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?" \
        "fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id" \
        "&fields[res.country]=name,code&fields[res.users]=name,active" \
        "&include=country_id,user_id,company_id&fields[res.company]=name" \
        "&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]"

      payload = {}
      headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      }

      response = requests.request("GET", url, headers=headers, data=payload)
      print(response.text)
      
<?php
      $client = new Client();
      $headers = [
      'Content-Type' => 'application/vnd.api+json',
      'x-api-key' => '{Your API-Key}'
      ];
      $request = new Request('GET', 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]', $headers);
      $res = $client->sendAsync($request)->wait();
      echo $res->getBody();
      ?php
      
      const myHeaders = new Headers();
      myHeaders.append("Content-Type", "application/vnd.api+json");
      myHeaders.append("x-api-key", "{Your API-Key}");

      const requestOptions = {
      method: "GET",
      headers: myHeaders,
      redirect: "follow"
      };

      fetch("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]", requestOptions)
      .then((response) => response.text())
      .then((result) => console.log(result))
      .catch((error) => console.error(error));
      
      Unirest.setTimeouts(0, 0);
      HttpResponse response = Unirest.get("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]")
      .header("Content-Type", "application/vnd.api+json")
      .header("x-api-key", "{Your API-Key}")
      .asString();                                
      
      package main

      import (
      "fmt"
      "net/http"
      "io/ioutil"
      )

      func main() {

      url := "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]"
      method := "GET"

      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)

      if err != nil {
      fmt.Println(err)
      return
      }
      req.Header.Add("Content-Type", "application/vnd.api+json")
      req.Header.Add("x-api-key", "{Your API-Key}")

      res, err := client.Do(req)
      if err != nil {
      fmt.Println(err)
      return
      }
      defer res.Body.Close()

      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
      fmt.Println(err)
      return
      }
      fmt.Println(string(body))
      }                                
      
      var headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      };
      var dio = Dio();
      var response = await dio.request(
      'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]',
      options: Options(
        method: 'GET',
        headers: headers,
      ),
      );

      if (response.statusCode == 200) {
      print(json.encode(response.data));
      }
      else {
      print(response.statusMessage);
      }
      

Create Records

JSON API Query Parameters Explanation:

This request is used to create a new res.partner resource with specified attributes and relationships, including its categories and bank accounts.

  • type: res.partner: Indicates the type of resource being created, which is a res.partner.
  • attributes: active: Boolean indicating whether the partner is active.
  • attributes: name: Name of the partner (e.g., "Ekika Corporation").
  • attributes: company_type: Type of the company, in this case, it's set to "company".
  • attributes: city, street, zip: Address details.
  • attributes: comment: Additional comments or notes.
  • attributes: phone, mobile, email: Contact information.
  • attributes: website: Website URL.
  • relationships: category_id: Represents the relationship between the new partner and its categories. Each category is represented as an object with a type and an id. This specifies which categories the partner belongs to. In this case, it belongs to categories with IDs 4 and 3.
  • relationships: bank_ids: Represents the relationship between the new partner and its bank accounts. Each bank account is represented as an object with a type and an attributes object containing details such as sequence, bank_id, acc_number, allow_out_payment, and acc_holder_name.
Headers Explanation:

These headers are used in a JSON API request to specify the format of the data being sent and to provide authentication information.

  • Content-Type: Specifies the format of the data being sent in the request body. In this case, it indicates that the data is in JSON API format (application/vnd.api+json).
  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner? {..query params..}

Query Params
{
        "data": {
            "type": "res.partner",
            "attributes": {
                "active": true,
                "name": "Ekika Corporation",
                "company_type": "company",
                "city": "Gandhinagar",
                "street": "Gandhinagar",
                "zip": "382421",
                "comment": "<p>Comment Here</p>",
                "phone": "5554444555444",
                "mobile": "1010101",
                "website": "http://www.ekika.co",
                "email": "hello@ekika.co"
            },
            "relationships": {
                "category_id": {
                    "data": [
                        {
                        "type": "res.partner.category",
                        "id": "4"
                        },
                        {
                        "type": "res.partner.category",
                        "id": "3"
                        }
                    ]
                },
                "bank_ids":{
                    "data": [
                        {
                        "type": "res.partner.bank",
                        "attributes": {
                            "sequence": 10,
                            "bank_id": 2,
                            "acc_number": "11212121212",
                            "allow_out_payment": true,
                            "acc_holder_name": false
                            }
                        },
                        {
                        "type": "res.partner.bank",
                        "attributes": {
                            "sequence": 11,
                            "bank_id": 3,
                            "acc_number": "3434343434343434",
                            "allow_out_payment": true,
                            "acc_holder_name": false
                            }
                        }
                    ]
                }
            }
        }
      }
                                  
Headers
Key Value
Content-Type application/vnd.api+json
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
        "meta": {
            "version": "1.1",
            "author-info": {
                "author": "Jane DOE",
                "author-email": "jane@ekika.co"
            },
            "documentation-link": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
        },
        "data": {
            "type": "res.partner",
            "attributes": {
                "active": true,
                "name": "Ekika Corporation",
                "company_type": "company",
                "city": "Gandhinagar",
                "street": "Gandhinagar",
                "zip": "382421",
                "comment": "<p>Comment Here</p>",
                "phone": "5554444555444",
                "mobile": "1010101",
                "website": "http://www.ekika.co",
                "email": "hello@ekika.co"
            },
            "relationships": {
                "category_id": {
                    "data": [
                        {
                            "type": "res.partner.category",
                            "id": "4"
                        },
                        {
                            "type": "res.partner.category",
                            "id": "3"
                        }
                    ]
                },
                "bank_ids": {
                    "data": [
                        {
                            "type": "res.partner.bank",
                            "attributes": {
                                "sequence": 10,
                                "bank_id": 2,
                                "acc_number": "11212121212",
                                "allow_out_payment": true,
                                "acc_holder_name": false
                            }
                        },
                        {
                            "type": "res.partner.bank",
                            "attributes": {
                                "sequence": 11,
                                "bank_id": 3,
                                "acc_number": "3434343434343434",
                                "allow_out_payment": true,
                                "acc_holder_name": false
                            }
                        }
                    ]
                }
            },
            "id": 70,
            "links": {
                "self": "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner/70"
            }
        },
        "included": [],
        "links": {}
      }
      curl --location --globoff 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]' \
      --header 'Content-Type: application/vnd.api+json' \
      --header 'x-api-key: {Your API-Key}'
      
      import requests
      import json

      url = "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?" \
        "fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id" \
        "&fields[res.country]=name,code&fields[res.users]=name,active" \
        "&include=country_id,user_id,company_id&fields[res.company]=name" \
        "&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]"

      payload = {}
      headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      }

      response = requests.request("GET", url, headers=headers, data=payload)
      print(response.text)
      
<?php
      $client = new Client();
      $headers = [
      'Content-Type' => 'application/vnd.api+json',
      'x-api-key' => '{Your API-Key}'
      ];
      $request = new Request('GET', 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]', $headers);
      $res = $client->sendAsync($request)->wait();
      echo $res->getBody();
      ?php
      
      const myHeaders = new Headers();
      myHeaders.append("Content-Type", "application/vnd.api+json");
      myHeaders.append("x-api-key", "{Your API-Key}");

      const requestOptions = {
      method: "GET",
      headers: myHeaders,
      redirect: "follow"
      };

      fetch("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]", requestOptions)
      .then((response) => response.text())
      .then((result) => console.log(result))
      .catch((error) => console.error(error));
      
      Unirest.setTimeouts(0, 0);
      HttpResponse response = Unirest.get("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]")
      .header("Content-Type", "application/vnd.api+json")
      .header("x-api-key", "{Your API-Key}")
      .asString();                                
      
      package main

      import (
      "fmt"
      "net/http"
      "io/ioutil"
      )

      func main() {

      url := "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]"
      method := "GET"

      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)

      if err != nil {
      fmt.Println(err)
      return
      }
      req.Header.Add("Content-Type", "application/vnd.api+json")
      req.Header.Add("x-api-key", "{Your API-Key}")

      res, err := client.Do(req)
      if err != nil {
      fmt.Println(err)
      return
      }
      defer res.Body.Close()

      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
      fmt.Println(err)
      return
      }
      fmt.Println(string(body))
      }                                
      
      var headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      };
      var dio = Dio();
      var response = await dio.request(
      'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]',
      options: Options(
        method: 'GET',
        headers: headers,
      ),
      );

      if (response.statusCode == 200) {
      print(json.encode(response.data));
      }
      else {
      print(response.statusMessage);
      }
      

Update Records

JSON API Query Parameters Explanation:

This request is used to update the attributes of the res.partner resource with ID 70, including its contact details, address, and other information.

  • type: res.partner: Indicates the type of resource being updated, which is a res.partner.
  • id: 70: Specifies the ID of the resource to be updated, in this case, the partner with ID 70.
  • attributes: active: Boolean indicating whether the partner is active.
  • attributes: name: Name of the partner (e.g., "Ekika Corporation").
  • attributes: company_type: Type of the company, in this case, it's set to "company".
  • attributes: city, street, zip: Address details.
  • attributes: comment: Additional comments or notes.
  • attributes: phone, mobile, email: Contact information.
  • attributes: website: Website URL.
  • relationships: category_id: Represents the relationship between the partner and its categories. data:: Indicates that there are no categories associated with this partner.
  • relationships: bank_ids: Represents the relationship between the partner and its bank accounts. data:: Indicates that there are no bank accounts associated with this partner.
  • Overall, this request is used to update the attributes of the res.partner resource with ID 70, including its contact details, address, and other information. It also specifies that the partner has no associated categories or bank accounts.
Headers Explanation:

These headers are used in a JSON API request to specify the format of the data being sent and to provide authentication information.

  • Content-Type: Specifies the format of the data being sent in the request body. In this case, it indicates that the data is in JSON API format (application/vnd.api+json).
  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner? {..query params..}

Query Params
{
        "data": {
            "type": "res.partner",
            "id": 70,
            "attributes": {
                "active": true,
                "name": "Ekika Corporation Pvt Ltd.",
                "company_type": "company",
                "city": "Gandhinagar",
                "street": "Gandhinagar",
                "zip": "000000",
                "comment": "<p>Comment Here</p>",
                "phone": "5554444555444",
                "mobile": "1010101",
                "website": "http://www.ekika.co",
                "email": "hello@ekika.co"
            },
            "relationships": {
                "category_id": {
                    "data": []
                },
                "bank_ids":{
                    "data": []
                }
            }
        }
      }
                                  
Headers
Key Value
Content-Type application/vnd.api+json
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
        "meta": {
            "version": "1.1",
            "author-info": {
                "author": "Jane DOE",
                "author-email": "jane@ekika.co"
            },
            "documentation-link": "https://api.17.dev.ekika.co/web#id=13&cids=1&menu_id=98&action=152&active_id=25&model=easy.jsonapi.doc&view_type=form"
        },
        "data": {
            "type": "res.partner",
            "id": 70,
            "attributes": {
                "active": true,
                "name": "Ekika Corporation Pvt Ltd.",
                "company_type": "company",
                "city": "Gandhinagar",
                "street": "Gandhinagar",
                "zip": "000000",
                "comment": "<p>Comment Here</p>",
                "phone": "5554444555444",
                "mobile": "1010101",
                "website": "http://www.ekika.co",
                "email": "hello@ekika.co"
            },
            "relationships": {
                "category_id": {
                    "data": []
                },
                "bank_ids": {
                    "data": []
                }
            }
        },
        "included": [],
        "links": {}
      }
      curl --location --globoff 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]' \
      --header 'Content-Type: application/vnd.api+json' \
      --header 'x-api-key: {Your API-Key}'
      
      import requests
      import json

      url = "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?" \
        "fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id" \
        "&fields[res.country]=name,code&fields[res.users]=name,active" \
        "&include=country_id,user_id,company_id&fields[res.company]=name" \
        "&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]"

      payload = {}
      headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      }

      response = requests.request("GET", url, headers=headers, data=payload)
      print(response.text)
      
<?php
      $client = new Client();
      $headers = [
      'Content-Type' => 'application/vnd.api+json',
      'x-api-key' => '{Your API-Key}'
      ];
      $request = new Request('GET', 'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]', $headers);
      $res = $client->sendAsync($request)->wait();
      echo $res->getBody();
      ?php
      
      const myHeaders = new Headers();
      myHeaders.append("Content-Type", "application/vnd.api+json");
      myHeaders.append("x-api-key", "{Your API-Key}");

      const requestOptions = {
      method: "GET",
      headers: myHeaders,
      redirect: "follow"
      };

      fetch("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]", requestOptions)
      .then((response) => response.text())
      .then((result) => console.log(result))
      .catch((error) => console.error(error));
      
      Unirest.setTimeouts(0, 0);
      HttpResponse response = Unirest.get("https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]")
      .header("Content-Type", "application/vnd.api+json")
      .header("x-api-key", "{Your API-Key}")
      .asString();                                
      
      package main

      import (
      "fmt"
      "net/http"
      "io/ioutil"
      )

      func main() {

      url := "https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name%2Cis_company%2Cemail%2Cphone%2Ccountry_id%2Cuser_id%2Ccompany_id&fields[res.country]=name%2Ccode&fields[res.users]=name%2Cactive&include=country_id%2Cuser_id%2Ccompany_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name%2C-id&filter=[(%27is_company%27%2C%20%27%3D%27%2C%20true)]"
      method := "GET"

      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)

      if err != nil {
      fmt.Println(err)
      return
      }
      req.Header.Add("Content-Type", "application/vnd.api+json")
      req.Header.Add("x-api-key", "{Your API-Key}")

      res, err := client.Do(req)
      if err != nil {
      fmt.Println(err)
      return
      }
      defer res.Body.Close()

      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
      fmt.Println(err)
      return
      }
      fmt.Println(string(body))
      }                                
      
      var headers = {
      'Content-Type': 'application/vnd.api+json',
      'x-api-key': '{Your API-Key}'
      };
      var dio = Dio();
      var response = await dio.request(
      'https://api.17.dev.ekika.co/user-jsonapi-apikey/res.partner?fields[res.partner]=name,is_company,email,phone,country_id,user_id,company_id&fields[res.country]=name,code&fields[res.users]=name,active&include=country_id,user_id,company_id&fields[res.company]=name&page[number]=1&page[size]=5&sort=name,-id&filter=[('is_company', '=', true)]',
      options: Options(
        method: 'GET',
        headers: headers,
      ),
      );

      if (response.statusCode == 200) {
      print(json.encode(response.data));
      }
      else {
      print(response.statusMessage);
      }
      

Get Records

GraphQL API Query Explanation:

GraphQL API is a specification for building APIs that allows clients to request exactly the data they need. This query is a set of parameters used in a GraphQL API request. These parameters define how the API should respond and what data should be included.

  • Query Definition (query MyQuery): The first keyword in the GraphQL query is "query". It signifies that a query operation is being performed in the next block of code followed by the name of the query, which is "MyQuery". This is a user-defined name and can be customized as needed.
  • ResPartner: This is the name of the query operation. It's asking for data related to a resource called "ResPartner".
  • Variables: Inside parentheses, there are variables defined like $offset, $limit, $order, and $domain. These variables can be passed values when executing the query. Each variable is preceded by a dollar sign ($) and followed by its type. For example, Int represents integer values, and String represents text.
  • $offset: This variable is used for pagination. It determines the starting point from which records should be fetched. For example, if $offset is set to 10, the query will start retrieving records from the 11th record onward.
  • $limit: Also used for pagination, this variable specifies the maximum number of records to be returned in a single query response. For instance, if $limit is set to 6, the query will return a maximum of 6 records.
  • $order: This variable is used to specify the order in which the retrieved records should be sorted. It likely takes a string value representing the field on which to sort and the sorting direction (e.g., ascending or descending).
  • $domain: This variable [["is_company","=",true]] filter the data to include only records where the 'is_company' field is equal to true.
  • Fields: Inside "ResPartner", we list the specific pieces of information we want about each partner. This could include their ID, name, phone number, email, and other details.
  • Nested Fields: Fields like country_id, user_id, and company_id are followed by curly braces containing more fields. Some pieces of information, like which country a partner is in (country_id), have more details we want to know, like the country's name and code.
  • country_id: This field represents the country where each partner is located. Inside country_id, we have two nested fields: name and code. "name" field give us the full name of the country (e.g., "United States"). "code" field give us the country's abbreviated code (e.g., "US").
  • user_id: This field indicates the user associated with each partner. Inside user_id, we have two nested fields: name and active. "name" field give us the user's name (e.g., "John Doe"). "active" tell us whether the user is currently active or not (e.g., true/false).
  • company_id: This field shows the company to which each partner belongs. Inside company_id, we have a single nested field: name. "name" field provide us with the name of the company (e.g., "ABC Corp").
Headers Explanation:

These headers are used in a GraphQL API request to specify the format of the data being sent and to provide authentication information.

  • Content-Type: Specifies the format of the data being sent in the request body. In this case, it indicates that the data is in GraphQL API format (application/json).
  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
GraphQL Variables Explanation:
  • In GraphQL, variables are defined separately from the query itself and are typically passed as a JSON object when executing the query. GraphQL supports passing variables in formats other than JSON, although JSON is the most common format used in practice.
  • offset: 0: This sets the offset to 0, meaning that the query will start fetching records from the beginning.
  • limit: 6: This sets the limit to 6, indicating that the query should return a maximum of 6 records.
  • order: "name,id decs": This means "order the data by name, and if names are the same, order them by id in descending order.
  • domain: This means "filter the data to include only records where the 'is_company' field is equal to true."
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-graphql-apikey

Query

query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {
ResPartner(
  offset: $offset
  limit: $limit
  order: $order
  domain: $domain
)
{
  id
  name
  phone
  email
  is_company
  country_id{
      name
      code
  }
  user_id{
      name
      active
  }
  company_id{
      name
  }
}
}
                            
GraphQL Variables:
{
  "offset": 0,
  "limit": 6,
  "order": "name,id desc",
  "domain": [["is_company","=",true]]
}
                            
Headers
Key Value
Content-Type application/json
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
"data": {
  "ResPartner": [
      {
          "id": 14,
          "name": "Azure Interior",
          "phone": "(870)-931-0505",
          "email": "azure.Interior24@example.com",
          "is_company": true,
          "country_id": {
              "name": "United States",
              "code": "US"
          },
          "user_id": null,
          "company_id": null
      },
      {
          "id": 10,
          "name": "Deco Addict",
          "phone": "(603)-996-3829",
          "email": "deco_addict@yourcompany.example.com",
          "is_company": true,
          "country_id": {
              "name": "United States",
              "code": "US"
          },
          "user_id": null,
          "company_id": null
      },
      {
          "id": 1,
          "name": "EKIKA",
          "phone": "+91 9510031431",
          "email": "anand@ekika.co",
          "is_company": true,
          "country_id": {
              "name": "United States",
              "code": "US"
          },
          "user_id": null,
          "company_id": null
      },
      {
          "id": 66,
          "name": "Ekika Corporation New",
          "phone": "5554444555444",
          "email": "hello@ekika.co",
          "is_company": true,
          "country_id": null,
          "user_id": null,
          "company_id": null
      },
      {
          "id": 56,
          "name": "Ekika Corporation New",
          "phone": "5554444555444",
          "email": "hello@ekika.co",
          "is_company": true,
          "country_id": null,
          "user_id": null,
          "company_id": null
      },
      {
          "id": 11,
          "name": "Gemini Furniture",
          "phone": "(941)-284-4875",
          "email": "gemini_furniture@fake.geminifurniture.com",
          "is_company": true,
          "country_id": {
              "name": "United States",
              "code": "US"
          },
          "user_id": null,
          "company_id": null
      }
  ],
  "pageInfo": {
      "ResPartner": {
          "totalCount": 11,
          "hasNextPage": true
      }
  }
}
}
curl --location 'https://api.17.dev.ekika.co/user-graphql-apikey' \
--header 'x-api-key: {YOUR-API-KEY}' \
--header 'Content-Type: application/json' \
--data '{
  "query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\n  
      ResPartner(\n    
          offset: $offset\n    
          limit: $limit\n    
          order: $order\n    
          domain: $domain\n  
      )\n  
      {\n    
          id\n    
          name\n    
          phone\n    
          email\n    
          is_company\n    
          country_id{\n      
              name\n      
              code\n    
          }\n    
          user_id{\n      
              name\n      
              active\n    
          }\n    
          company_id{\n      
              name\n    
          }\n  
      }\n
  }",
  "variables": {
      "offset": 0,
      "limit": 6,
      "order": "name,id desc",
      "domain": [
          ["is_company", "=", true]
      ]
  }
}'
import requests
import json

url = "https://api.17.dev.ekika.co/user-graphql-apikey"

payload = "{\"query\":\"query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\\n  ResPartner(\\n    offset: $offset\\n    limit: $limit\\n    order: $order\\n    domain: $domain\\n  )\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{\"offset\":0,\"limit\":6,\"order\":\"name,id desc\",\"domain\":[[\"is_company\",\"=\",true]]}}"
headers = {
'x-api-key': '{Your API-Key}',
'Content-Type': 'application/json'
}

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

print(response.text)
<?php
$client = new Client();
$headers = [
'x-api-key' => '{Your API-Key}',
'Content-Type' => 'application/json'
];
$body = '{
"query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {
  ResPartner(
    offset: $offset
    limit: $limit
    order: $order
    domain: $domain
  ) {
    id
    name
    phone
    email
    is_company
    country_id {
      name
      code
    }
    user_id {
      name
      active
    }
    company_id {
      name
    }
  }
}",
"variables": {
  "offset": 0,
  "limit": 6,
  "order": "name,id desc",
  "domain": [["is_company","=",true]]
}
}';
$request = new Request('POST', 'https://api.17.dev.ekika.co/user-graphql-apikey', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{Your API-Key}");
myHeaders.append("Content-Type", "application/json");

const graphql = JSON.stringify({
query: `
  query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {
    ResPartner(
      offset: $offset
      limit: $limit
      order: $order
      domain: $domain
    ) {
      id
      name
      phone
      email
      is_company
      country_id {
        name
        code
      }
      user_id {
        name
        active
      }
      company_id {
        name
      }
    }
  }
`,
variables: {
  "offset": 0,
  "limit": 6,
  "order": "name,id desc",
  "domain": [["is_company", "=", true]]
}
});

const requestOptions = {
method: "POST",
headers: myHeaders,
body: graphql,
redirect: "follow"
};

fetch("https://api.17.dev.ekika.co/user-graphql-apikey", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.post("https://api.17.dev.ekika.co/user-graphql-apikey")
.header("x-api-key", "{Your API-Key}")
.header("Content-Type", "application/json")
.body("{\"query\":\"query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\\n  ResPartner(\\n    offset: $offset\\n    limit: $limit\\n    order: $order\\n    domain: $domain\\n  )\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{\"offset\":0,\"limit\":6,\"order\":\"name,id desc\",\"domain\":[[\"is_company\",\"=\",true]]}}")
.asString();
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.17.dev.ekika.co/user-graphql-apikey"
method := "POST"

payload := strings.NewReader("{\"query\":\"query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\\n  ResPartner(\\n    offset: $offset\\n    limit: $limit\\n    order: $order\\n    domain: $domain\\n  )\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{\"offset\":0,\"limit\":6,\"order\":\"name,id desc\",\"domain\":[[\"is_company\",\"=\",true]]}}")

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
  fmt.Println(err)
  return
}
req.Header.Add("x-api-key", "{Your API-Key}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
  fmt.Println(err)
  return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
  fmt.Println(err)
  return
}
fmt.Println(string(body))
}
var headers = {
'x-api-key': '{Your API-Key}',
'Content-Type': 'application/json'
};
var data = '''{"query":"query MyQuery(\$offset: Int, \$limit: Int, \$order: String, \$domain: [[Any]]) {\\n  ResPartner(\\n    offset: \$offset\\n    limit: \$limit\\n    order: \$order\\n    domain: \$domain\\n  )\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}","variables":{"offset":0,"limit":6,"order":"name,id desc","domain":[["is_company","=",true]]}}''';

var dio = Dio();
var response = await dio.request(
'https://api.17.dev.ekika.co/user-graphql-apikey',
options: Options(
  method: 'POST',
  headers: headers,
),
data: data,
);

if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}

Get Single Record

GraphQL Query Explanation:

This GraphQL query is retrieving information about a specific ResPartner with the ID "22". You can enter any of the ID to retrieve a specific information including details like name, phone, email, etc., and also includes the name of the company to which the partner belongs.

  • Query Definition (query MyQuery): The first keyword in the GraphQL query is "query". It signifies that a query operation is being performed in the next block of code followed by the name of the query, which is "MyQuery". This is a user-defined name and can be customized as needed.
  • ResPartner: This is the name of the query operation. It's asking for data related to a resource called "ResPartner".
  • Field Selections: Inside the query, we specified fields that we want to retrieve for the ResPartner with ID "22".
  • id: The unique identifier of the partner.
  • name: The name of the partner.
  • phone: The phone number of the partner.
  • email: The email address of the partner.
  • is_company: A boolean field indicating whether the partner is a company or not.
  • country_id: This appears to be a related field indicating the country associated with the partner. Within this field, you are querying for "name" and "code" of the country.
  • user_id: This refers to the user associated with the partner. We are querying for the "name" and "active" status of the user.
  • company_id: This field represents the company associated with the partner. It indicates the company to which the partner belongs. Here, we are querying for the "name" of the company.
Headers Explanation:

These headers are used in a GraphQL API request to specify the format of the data being sent and to provide authentication information.

  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-graphql-apikey

Query

query MyQuery {
ResPartner(id: "22")
{
  id
  name
  phone
  email
  is_company
  country_id{
    name
    code
  }
  user_id{
    name
    active
  }
  company_id{
    name
  }
}
}
                            
Headers
Key Value
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
  "data": {
      "ResPartner": [
          {
              "id": 22,
              "name": "Jesse Blue",
              "phone": "(829)-386-3277",
              "email": "jesse.brown74@example.com",
              "is_company": false,
              "country_id": {
                  "name": "United States",
                  "code": "US"
              },
              "user_id": null,
              "company_id": {
                  "name": "EKIKA"
              }
          }
      ],
      "pageInfo": {
          "ResPartner": {
              "totalCount": 1,
              "hasNextPage": false
          }
      }
  }
}
curl --location 'https://api.17.dev.ekika.co/user-graphql-apikey' \
--header 'x-api-key: {Your API-Key} \
--header 'Content-Type: application/json' \
--data '{"query":"query MyQuery {\n  ResPartner(id: \"22\")\n  {\n    id\n    name\n    phone\n    email\n    is_company\n    country_id{\n      name\n      code\n    }\n    user_id{\n      name\n      active\n    }\n    company_id{\n      name\n    }\n  }\n}","variables":{}}'
import requests
import json

url = "https://api.17.dev.ekika.co/user-graphql-apikey"

payload = "{\"query\":\"query MyQuery {\\n  ResPartner(id: \\\"22\\\")\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{}}"
headers = {
'x-api-key': '{Your API-Key}',
'Content-Type': 'application/json'
}

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

print(response.text)
<?php
$client = new Client();
$headers = [
'x-api-key' => '{Your API-Key}',
'Content-Type' => 'application/json'
];
$body = '{"query":"query MyQuery {\\n  ResPartner(id: \\"22\\")\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}","variables":{}}';
$request = new Request('POST', 'https://api.17.dev.ekika.co/user-graphql-apikey', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{Your API-Key}");
myHeaders.append("Content-Type", "application/json");

const graphql = JSON.stringify({
query: "query MyQuery {\n  ResPartner(id: \"22\")\n  {\n    id\n    name\n    phone\n    email\n    is_company\n    country_id{\n      name\n      code\n    }\n    user_id{\n      name\n      active\n    }\n    company_id{\n      name\n    }\n  }\n}",
variables: {}
})
const requestOptions = {
method: "POST",
headers: myHeaders,
body: graphql,
redirect: "follow"
};

fetch("https://api.17.dev.ekika.co/user-graphql-apikey", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.post("https://api.17.dev.ekika.co/user-graphql-apikey")
.header("x-api-key", "{Your API-Key}")
.header("Content-Type", "application/json")
.body("{\"query\":\"query MyQuery {\\n  ResPartner(id: \\\"22\\\")\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{}}")
.asString();
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.17.dev.ekika.co/user-graphql-apikey"
method := "POST"

payload := strings.NewReader("{\"query\":\"query MyQuery {\\n  ResPartner(id: \\\"22\\\")\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}\",\"variables\":{}}")

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
  fmt.Println(err)
  return
}
req.Header.Add("x-api-key", "{Your API-Key}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
  fmt.Println(err)
  return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
  fmt.Println(err)
  return
}
fmt.Println(string(body))
}
var headers = {
'x-api-key': '{Your API-Key}',
'Content-Type': 'application/json'
};
var data = '''{"query":"query MyQuery {\\n  ResPartner(id: \\"22\\")\\n  {\\n    id\\n    name\\n    phone\\n    email\\n    is_company\\n    country_id{\\n      name\\n      code\\n    }\\n    user_id{\\n      name\\n      active\\n    }\\n    company_id{\\n      name\\n    }\\n  }\\n}","variables":{}}''';

var dio = Dio();
var response = await dio.request(
'https://api.17.dev.ekika.co/user-graphql-apikey',
options: Options(
  method: 'POST',
  headers: headers,
),
data: data,
);

if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}

Create Records

GraphQL Query Explanation:

This GraphQL mutation query is responsible for creating a new partner entity (ResPartner) in the system.

  • mutation Create: A mutation in GraphQL is a type of request used to modify data on the server. It's often used to perform operations such as creating, updating, or deleting data. Unlike queries, which are used for fetching data, mutations are used for making modifications to the data. In this example, the mutation is used to create a new ResPartner record with specified details like name, contact information, address, etc.
  • Alias: createResPartner: An alias is a way to provide a custom name to the result of a field or operation. In this mutation query, createResPartner is the alias given to the result of the mutation operation ResPartner. This alias is helpful when you have multiple mutation operations in a single request, allowing you to distinguish between the results of each operation.
  • Mutation Operation: ResPartner: Specifies that the mutation will create a new ResPartner record.
  • ResPartnerValues: An object containing key-value pairs representing the fields and their values for the new ResPartner record being created.
  • Fields: Fields such as active, name, category_id, company_type, bank_ids, city, street, zip, comment, phone, mobile, website, and email are provided with respective values.
  • bank_ids: This field represents an array of bank account details associated with the new partner being created. Each item in the bank_ids array contains details about a specific bank account.
  • sequence: A numerical value indicating the order or position of the bank account.
  • bank_id: The unique identifier of the bank associated with the account.
  • acc_number: The account number for this bank account.
  • allow_out_payment: A boolean value indicating whether outgoing payments are allowed from this account.
  • acc_holder_name: A boolean value indicating whether the account holder's name is required for transactions.
  • Other Fields: All other fields and their values are also to be added.
  • Selection Set: Specifies the fields of the created ResPartner record that should be returned after the mutation operation. Fields such as active, category_id, bank_ids, city, comment, company_type, id, name, phone, mobile, email, street, and zip are included.
  • You can returen any of the field with their specific values, you don't have to specify all fields if you don't want every details to be returned.
Headers Explanation:

These headers are used in a GraphQL API request to specify the format of the data being sent and to provide authentication information.

  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-graphql-apikey

Query

mutation Create {
  createResPartner: ResPartner(
      ResPartnerValues: {
          active: true,
          name: "Ekika Corporation New",
          category_id: [4, 3]
          company_type: "company",
          bank_ids: [
                  [0, 0, {
                    sequence: 10,
                    bank_id: 2,
                    acc_number: "11212121212",
                    allow_out_payment: true,
                    acc_holder_name: false
                  }],
                  [0, 0, {
                    sequence: 11,
                    bank_id: 3,
                    acc_number: "3434343434343434",
                    allow_out_payment: true,
                    acc_holder_name: false
                  }]
      ]
          city: "Gandhinagar",
          street: "Gandhinagar",
          street2: "",
          zip: "382421",
          comment: "<p>Comment Here</p>",
          phone: "5554444555444",
          mobile: "1010101",
          website: "http://www.ekika.co",
          email: "hello@ekika.co",
      }
  )
  {
      active
      category_id
      bank_ids
      city
      comment
      company_type
      id
      name
      phone
      mobile
      email
      street
      zip
  }
}
                            
Headers
Key Value
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
  "data": {
      "createResPartner": [
          {
              "active": true,
              "category_id": [
                  4,
                  3
              ],
              "bank_ids": [
                  20,
                  21
              ],
              "city": "Gandhinagar",
              "comment": "<p>Comment Here</p>",
              "company_type": "company",
              "id": 69,
              "name": "Ekika Corporation New",
              "phone": "5554444555444",
              "mobile": "1010101",
              "email": "hello@ekika.co",
              "street": "Gandhinagar",
              "zip": "382421"
          }
      ]
  }
}
curl --location 'https://api.17.dev.ekika.co/user-graphql-apikey' \
--header 'x-api-key: {YOUR-API-KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "query": "mutation Create {
      createResPartner: ResPartner(
          ResPartnerValues: {
              active: true,
              name: \"Ekika Corporation New\",
              category_id: [4, 3],
              company_type: \"company\",
              bank_ids: [
                  [0, 0, {
                      sequence: 10,
                      bank_id: 2,
                      acc_number: \"11212121212\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }],
                  [0, 0, {
                      sequence: 11,
                      bank_id: 3,
                      acc_number: \"3434343434343434\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }]
              ],
              city: \"Gandhinagar\",
              street: \"Gandhinagar\",
              street2: \"\",
              zip: \"382421\",
              comment: \"<p>Comment Here</p>\",
              phone: \"5554444555444\",
              mobile: \"1010101\",
              website: \"http://www.ekika.co\",
              email: \"hello@ekika.co\"
          }
      )
      {
          active
          category_id
          bank_ids
          city
          comment
          company_type
          id
          name
          phone
          mobile
          email
          street
          zip
      }
  }",
  "variables": {}
}'
import requests
import json

url = "https://api.17.dev.ekika.co/user-graphql-apikey"

payload = '''
{
  "query": "mutation Create {
      createResPartner: ResPartner(
          ResPartnerValues: {
              active: true,
              name: \\"Ekika Corporation New\\",
              category_id: [4, 3],
              company_type: \\"company\\",
              bank_ids: [
                  [0, 0, {
                      sequence: 10,
                      bank_id: 2,
                      acc_number: \\"11212121212\\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }],
                  [0, 0, {
                      sequence: 11,
                      bank_id: 3,
                      acc_number: \\"3434343434343434\\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }]
              ],
              city: \\"Gandhinagar\\",
              street: \\"Gandhinagar\\",
              street2: \\"\\",
              zip: \\"382421\\",
              comment: \\"

Comment Here

\\", phone: \\"5554444555444\\", mobile: \\"1010101\\", website: \\"http://www.ekika.co\\", email: \\"hello@ekika.co\\" } ) { active category_id bank_ids city comment company_type id name phone mobile email street zip } }", "variables": {} } ''' headers = { 'x-api-key': '{Your API-Key}', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
<?php
$client = new Client();
$headers = [
  'x-api-key' => '{API-KEY}',
  'Content-Type' => 'application/json'
];

$bodyData = [
  "query" => "mutation Create {
      createResPartner: ResPartner(
          ResPartnerValues: {
              active: true,
              name: \"Ekika Corporation New\",
              category_id: [4, 3],
              company_type: \"company\",
              bank_ids: [
                  [0, 0, {
                      sequence: 10,
                      bank_id: 2,
                      acc_number: \"11212121212\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }],
                  [0, 0, {
                      sequence: 11,
                      bank_id: 3,
                      acc_number: \"3434343434343434\",
                      allow_out_payment: true,
                      acc_holder_name: false
                  }]
              ],
              city: \"Gandhinagar\",
              street: \"Gandhinagar\",
              street2: \"\",
              zip: \"382421\",
              comment: \"<p>Comment Here</p>\",
              phone: \"5554444555444\",
              mobile: \"1010101\",
              website: \"http://www.ekika.co\",
              email: \"hello@ekika.co\",
          }
      )
      {
          active
          category_id
          bank_ids
          city
          comment
          company_type
          id
          name
          phone
          mobile
          email
          street
          zip
      }
  }",
  "variables" => []
];

$body = json_encode($bodyData);

$request = new Request('POST', 'https://api.17.dev.ekika.co/user-graphql-apikey', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{YOUR-API-KEY}");
myHeaders.append("Content-Type", "application/json");

const graphql = JSON.stringify({
query: `
  mutation Create {
    createResPartner: ResPartner(
      ResPartnerValues: {
        active: true,
        name: "Ekika Corporation New",
        category_id: [4, 3],
        company_type: "company",
        bank_ids: [
          [0, 0, {
            sequence: 10,
            bank_id: 2,
            acc_number: "11212121212",
            allow_out_payment: true,
            acc_holder_name: false
          }],
          [0, 0, {
            sequence: 11,
            bank_id: 3,
            acc_number: "3434343434343434",
            allow_out_payment: true,
            acc_holder_name: false
          }]
        ],
        city: "Gandhinagar",
        street: "Gandhinagar",
        street2: "",
        zip: "382421",
        comment: "

Comment Here

", phone: "5554444555444", mobile: "1010101", website: "http://www.ekika.co", email: "hello@ekika.co" } ) { active category_id bank_ids city comment company_type id name phone mobile email street zip } } `, variables: {} }); const requestOptions = { method: "POST", headers: myHeaders, body: graphql, redirect: "follow" }; fetch("https://api.17.dev.ekika.co/user-graphql-apikey", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.error(error));
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.post("https://api.17.dev.ekika.co/user-graphql-apikey")
.header("x-api-key", "{Your API-Key}")
.header("Content-Type", "application/json")
.body("{\"query\":\"mutation Create {\\n    createResPartner: ResPartner(\\n        ResPartnerValues: {\\n            active: true,\\n            name: \\\"Ekika Corporation New\\\",\\n            category_id: [4, 3]\\n            company_type: \\\"company\\\",\\n            bank_ids: [\\n\\t\\t\\t\\t\\t[0, 0, {\\n\\t\\t\\t\\t\\t\\tsequence: 10,\\n\\t\\t\\t\\t\\t\\tbank_id: 2,\\n\\t\\t\\t\\t\\t\\tacc_number: \\\"11212121212\\\",\\n\\t\\t\\t\\t\\t\\tallow_out_payment: true,\\n\\t\\t\\t\\t\\t\\tacc_holder_name: false\\n\\t\\t\\t\\t\\t}],\\n\\t\\t\\t\\t\\t[0, 0, {\\n\\t\\t\\t\\t\\t\\tsequence: 11,\\n\\t\\t\\t\\t\\t\\tbank_id: 3,\\n\\t\\t\\t\\t\\t\\tacc_number: \\\"3434343434343434\\\",\\n\\t\\t\\t\\t\\t\\tallow_out_payment: true,\\n\\t\\t\\t\\t\\t\\tacc_holder_name: false\\n\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t]\\n            city: \\\"Gandhinagar\\\",\\n            street: \\\"Gandhinagar\\\",\\n            street2: \\\"\\\",\\n            zip: \\\"382421\\\",\\n            comment: \\\"

Comment Here

\\\",\\n phone: \\\"5554444555444\\\",\\n mobile: \\\"1010101\\\",\\n website: \\\"http://www.ekika.co\\\",\\n email: \\\"hello@ekika.co\\\",\\n }\\n )\\n {\\n active\\n category_id\\n bank_ids\\n city\\n comment\\n company_type\\n id\\n name\\n phone\\n mobile\\n email\\n street\\n zip\\n }\\n}\",\"variables\":{}}") .asString();
package main

import (
"fmt"
"io/ioutil"
"net/http"
)

func main() {

url := "https://api.17.dev.ekika.co/user-graphql-apikey"
method := "POST"

payload := `{"query":"mutation Create {
createResPartner: ResPartner(
ResPartnerValues: {
active: true,
name: \"Ekika Corporation New\",
category_id: [4, 3]
company_type: \"company\",
bank_ids: [
  [0, 0, {
    sequence: 10,
    bank_id: 2,
    acc_number: \"11212121212\",
    allow_out_payment: true,
    acc_holder_name: false
  }],
  [0, 0, {
    sequence: 11,
    bank_id: 3,
    acc_number: \"3434343434343434\",
    allow_out_payment: true,
    acc_holder_name: false
  }]
]
city: \"Gandhinagar\",
street: \"Gandhinagar\",
street2: \"\",
zip: \"382421\",
comment: \"<p>Comment Here</p>\",
phone: \"5554444555444\",
mobile: \"1010101\",
website: \"http://www.ekika.co\",
email: \"hello@ekika.co\",
}
) {
active
category_id
bank_ids
city
comment
company_type
id
name
phone
mobile
email
street
zip
}
}","variables":{}}`

client := &http.Client{}
req, err := http.NewRequest(method, url, strings.NewReader(payload))

if err != nil {
  fmt.Println(err)
  return
}
req.Header.Add("x-api-key", "{Your API-Key}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
  fmt.Println(err)
  return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
  fmt.Println(err)
  return
}
fmt.Println(string(body))
}
var headers = {
'x-api-key': '{Your API-Key}',
'Content-Type': 'application/json'
};

var data = '''{"query":"mutation Create {
createResPartner: ResPartner(
  ResPartnerValues: {
    active: true,
    name: \\"Ekika Corporation New\\",
    category_id: [4, 3]
    company_type: \\"company\\",
    bank_ids: [
      [0, 0, {
        sequence: 10,
        bank_id: 2,
        acc_number: \\"11212121212\\",
        allow_out_payment: true,
        acc_holder_name: false
      }],
      [0, 0, {
        sequence: 11,
        bank_id: 3,
        acc_number: \\"3434343434343434\\",
        allow_out_payment: true,
        acc_holder_name: false
      }]
    ]
    city: \\"Gandhinagar\\",
    street: \\"Gandhinagar\\",
    street2: \\"\\",
    zip: \\"382421\\",
    comment: \\"<p>Comment Here</p>\\",
    phone: \\"5554444555444\\",
    mobile: \\"1010101\\",
    website: \\"http://www.ekika.co\\",
    email: \\"hello@ekika.co\\",
  }
) {
  active
  category_id
  bank_ids
  city
  comment
  company_type
  id
  name
  phone
  mobile
  email
  street
  zip
}
}","variables":{}}''';

var dio = Dio();
var response = await dio.request(
'https://api.17.dev.ekika.co/user-graphql-apikey',
options: Options(
  method: 'POST',
  headers: headers,
),
data: data,
);

if (response.statusCode == 200) {
print(json.encode(response.data));
} else {
print(response.statusMessage);
}

Update Records

GraphQL Query Explanation:

This GraphQL mutation updates a ResPartner record with the ID 69 in the system.

  • mutation Update: This indicates that the mutation will perform an update operation.
  • Alias: updateResPartner: This is an alias given to the result of the mutation. It allows you to identify and access the result of this specific mutation in the response.
  • Mutation Operation: ResPartner: Specifies the type of operation being performed, which is updating a ResPartner record.
  • id: Specifies the ID of the ResPartner record to be updated. In this case, it's ID 69.
  • ResPartnerValues: An object containing key-value pairs representing the fields and their updated values for the ResPartner record.
  • Selection Set: Specifies the fields of the updated ResPartner record that should be returned after the mutation operation. You can write any field you want to return as result.
  • You can returen any of the field with their specific values, you don't have to specify all fields if you don't want every details to be returned.
  • In summary this mutation updates the specified ResPartner record with new values for the specified fields and returns the updated values of certain fields in the response.
Headers Explanation:

These headers are used in a GraphQL API request to specify the format of the data being sent and to provide authentication information.

  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-graphql-apikey

Query

mutation Update {
  updateResPartner: ResPartner(
      id: 69, 
      ResPartnerValues: {
          active: true,
          name: "Ekika Corporation PVT LTD.",
          category_id: null
          company_type: "company"
      }
  )
  {
      active
      category_id {
          id
          name
      }
      bank_ids {
          id
      }
      city
      comment
      company_type
      id
      name
      phone
      mobile
      email
      street
      zip
  }
}
                            
Headers
Key Value
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
  "data": {
      "updateResPartner": [
          {
              "active": true,
              "category_id": [],
              "bank_ids": [
                  {
                      "id": 20
                  },
                  {
                      "id": 21
                  }
              ],
              "city": "Gandhinagar",
              "comment": "<p>Comment Here</p>",
              "company_type": "company",
              "id": 69,
              "name": "Ekika Corporation PVT LTD.",
              "phone": "5554444555444",
              "mobile": "1010101",
              "email": "hello@ekika.co",
              "street": "Gandhinagar",
              "zip": "382421"
          }
      ]
  }
}
curl --location 'https://api.17.dev.ekika.co/user-graphql-apikey' \
--header 'x-api-key: {YOUR-API-KEY}' \
--header 'Content-Type: application/json' \
--data '{"query":"mutation Update {\n    updateResPartner: ResPartner(\n        id: 69, \n        ResPartnerValues: {\n            active: true,\n            name: \"Ekika Corporation PVT LTD.\",\n            category_id: null\n            company_type: \"company\"\n        }\n    )\n    {\n        active\n        category_id {\n            id\n            name\n        }\n        bank_ids {\n            id\n        }\n        city\n        comment\n        company_type\n        id\n        name\n        phone\n        mobile\n        email\n        street\n        zip\n    }\n}","variables":{}}'
import requests
import json

url = "https://api.17.dev.ekika.co/user-graphql-apikey"

payload = "{\"query\":\"mutation Update {\\n    updateResPartner: ResPartner(\\n        id: 69, \\n        ResPartnerValues: {\\n            active: true,\\n            name: \\\"Ekika Corporation PVT LTD.\\\",\\n            category_id: null\\n            company_type: \\\"company\\\"\\n        }\\n    )\\n    {\\n        active\\n        category_id {\\n            id\\n            name\\n        }\\n        bank_ids {\\n            id\\n        }\\n        city\\n        comment\\n        company_type\\n        id\\n        name\\n        phone\\n        mobile\\n        email\\n        street\\n        zip\\n    }\\n}\",\"variables\":{}}"
headers = {
'x-api-key': '{YOUR-API-KEY}',
'Content-Type': 'application/json'
}

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

print(response.text)
<?php
$client = new Client();
$headers = [
'x-api-key' => '{YOUR-API-KEY}',
'Content-Type' => 'application/json'
];
$body = '{"query":"mutation Update {\\n    updateResPartner: ResPartner(\\n        id: 69, \\n        ResPartnerValues: {\\n            active: true,\\n            name: \\"Ekika Corporation PVT LTD.\\",\\n            category_id: null\\n            company_type: \\"company\\"\\n        }\\n    )\\n    {\\n        active\\n        category_id {\\n            id\\n            name\\n        }\\n        bank_ids {\\n            id\\n        }\\n        city\\n        comment\\n        company_type\\n        id\\n        name\\n        phone\\n        mobile\\n        email\\n        street\\n        zip\\n    }\\n}","variables":{}}';
$request = new Request('POST', 'https://api.17.dev.ekika.co/user-graphql-apikey', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{YOUR-API-KEY}");
myHeaders.append("Content-Type", "application/json");

const graphql = JSON.stringify({
query: "mutation Update {\n    updateResPartner: ResPartner(\n        id: 69, \n        ResPartnerValues: {\n            active: true,\n            name: \"Ekika Corporation PVT LTD.\",\n            category_id: null\n            company_type: \"company\"\n        }\n    )\n    {\n        active\n        category_id {\n            id\n            name\n        }\n        bank_ids {\n            id\n        }\n        city\n        comment\n        company_type\n        id\n        name\n        phone\n        mobile\n        email\n        street\n        zip\n    }\n}",
variables: {}
})
const requestOptions = {
method: "POST",
headers: myHeaders,
body: graphql,
redirect: "follow"
};

fetch("https://api.17.dev.ekika.co/user-graphql-apikey", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.17.dev.ekika.co/user-graphql-apikey")
.header("x-api-key", "{YOUR-API-KEY}")
.header("Content-Type", "application/json")
.body("{\"query\":\"mutation Update {\\n    updateResPartner: ResPartner(\\n        id: 69, \\n        ResPartnerValues: {\\n            active: true,\\n            name: \\\"Ekika Corporation PVT LTD.\\\",\\n            category_id: null\\n            company_type: \\\"company\\\"\\n        }\\n    )\\n    {\\n        active\\n        category_id {\\n            id\\n            name\\n        }\\n        bank_ids {\\n            id\\n        }\\n        city\\n        comment\\n        company_type\\n        id\\n        name\\n        phone\\n        mobile\\n        email\\n        street\\n        zip\\n    }\\n}\",\"variables\":{}}")
.asString();

package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.17.dev.ekika.co/user-graphql-apikey"
method := "POST"

payload := strings.NewReader("{\"query\":\"mutation Update {\\n    updateResPartner: ResPartner(\\n        id: 69, \\n        ResPartnerValues: {\\n            active: true,\\n            name: \\\"Ekika Corporation PVT LTD.\\\",\\n            category_id: null\\n            company_type: \\\"company\\\"\\n        }\\n    )\\n    {\\n        active\\n        category_id {\\n            id\\n            name\\n        }\\n        bank_ids {\\n            id\\n        }\\n        city\\n        comment\\n        company_type\\n        id\\n        name\\n        phone\\n        mobile\\n        email\\n        street\\n        zip\\n    }\\n}\",\"variables\":{}}")

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
  fmt.Println(err)
  return
}
req.Header.Add("x-api-key", "{YOUR-API-KEY}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
  fmt.Println(err)
  return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
  fmt.Println(err)
  return
}
fmt.Println(string(body))
}
var headers = {
'x-api-key': '{YOUR-API-KEY}',
'Content-Type': 'application/json'
};
var data = '''{"query":"mutation Update {\\n    updateResPartner: ResPartner(\\n        id: 69, \\n        ResPartnerValues: {\\n            active: true,\\n            name: \\"Ekika Corporation PVT LTD.\\",\\n            category_id: null\\n            company_type: \\"company\\"\\n        }\\n    )\\n    {\\n        active\\n        category_id {\\n            id\\n            name\\n        }\\n        bank_ids {\\n            id\\n        }\\n        city\\n        comment\\n        company_type\\n        id\\n        name\\n        phone\\n        mobile\\n        email\\n        street\\n        zip\\n    }\\n}","variables":{}}''';

var dio = Dio();
var response = await dio.request(
'https://api.17.dev.ekika.co/user-graphql-apikey',
options: Options(
  method: 'POST',
  headers: headers,
),
data: data,
);

if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}

Delete Records

GraphQL Query Explanation:

This mutation deletes the ResPartner record with the ID 69 from the system.

  • mutation Delete: This indicates that the mutation will perform an delete operation.
  • Alias: deleteResPartner: This is an alias given to the result of the mutation. It allows you to identify and access the result of this specific mutation in the response.
  • Mutation Operation: ResPartner: Specifies the type of operation being performed, which is deleting a ResPartner record.
  • id: Specifies the ID of the ResPartner record to be deleted. In this case, it's ID 69.
  • Selection Set: There is no selection set specified after the mutation operation. This means that the mutation does not return any specific fields of the deleted ResPartner record in the response.
Headers Explanation:

These headers are used in a GraphQL API request to specify the format of the data being sent and to provide authentication information.

  • x-api-key: Provides authentication information. It contains an API key (Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z), which is a unique identifier used to authenticate the client making the request. This key allows the API server to verify that the client has the necessary permissions to access the requested resources.
You can execute above request on any model of Odoo.

Note: You have to check access control if your find mismatch of records as per your expectation.

Request

GET

https://api.17.dev.ekika.co/user-graphql-apikey

Query

mutation Delete {
  deleteResPartner: ResPartner(
      id: 69, 
  )
}
                            
Headers
Key Value
x-api-key {Your API-Key} (e.g., Qm7M6q!JRwwL:*->QX~;>S|^NC.8ID5z)
Response
{
  "data": {
      "delete": "Success"
  }
}
curl --location 'https://api.17.dev.ekika.co/user-graphql-apikey' \
--header 'x-api-key: "{YOUR-API-KEY} \
--header 'Content-Type: application/json' \
--data '{"query":"mutation Delete {\ndeleteResPartner: ResPartner(\nid: 69, \n)\n}","variables":{}}'
import requests
import json

url = "https://api.17.dev.ekika.co/user-graphql-apikey"

payload = "{\"query\":\"mutation Delete {\\ndeleteResPartner: ResPartner(\\nid: 69, \\n)\\n}\",\"variables\":{}}"
headers = {
'x-api-key': "{YOUR-API-KEY}",
'Content-Type': 'application/json'
}

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

print(response.text)

<?php
$client = new Client();
$headers = [
'x-api-key' => "{YOUR-API-KEY}",
'Content-Type' => 'application/json'
];
$body = '{"query":"mutation Delete {\\ndeleteResPartner: ResPartner(\\nid: 69, \\n)\\n}","variables":{}}';
$request = new Request('POST', 'https://api.17.dev.ekika.co/user-graphql-apikey', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

const myHeaders = new Headers();
myHeaders.append("x-api-key", "{YOUR-API-KEY}");
myHeaders.append("Content-Type", "application/json");

const graphql = JSON.stringify({
query: "mutation Delete {\ndeleteResPartner: ResPartner(\nid: 69, \n)\n}",
variables: {}
})
const requestOptions = {
method: "POST",
headers: myHeaders,
body: graphql,
redirect: "follow"
};

fetch("https://api.17.dev.ekika.co/user-graphql-apikey", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.post("https://api.17.dev.ekika.co/user-graphql-apikey")
.header("x-api-key", "{YOUR-API-KEY}")
.header("Content-Type", "application/json")
.body("{\"query\":\"mutation Delete {\\ndeleteResPartner: ResPartner(\\nid: 69, \\n)\\n}\",\"variables\":{}}")
.asString();

package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.17.dev.ekika.co/user-graphql-apikey"
method := "POST"

payload := strings.NewReader("{\"query\":\"mutation Delete {\\ndeleteResPartner: ResPartner(\\nid: 69, \\n)\\n}\",\"variables\":{}}")

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
  fmt.Println(err)
  return
}
req.Header.Add("x-api-key", "{YOUR-API-KEY}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
  fmt.Println(err)
  return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
  fmt.Println(err)
  return
}
fmt.Println(string(body))
}
var headers = {
'x-api-key': "{YOUR-API-KEY}",
'Content-Type': 'application/json'
};
var data = '''{"query":"mutation Delete {\\ndeleteResPartner: ResPartner(\\nid: 69, \\n)\\n}","variables":{}}''';

var dio = Dio();
var response = await dio.request(
'https://api.17.dev.ekika.co/user-graphql-apikey',
options: Options(
  method: 'POST',
  headers: headers,
),
data: data,
);

if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}

Powerful Free Helper Tools (Coming Soon!)

Our suite of free helper tools for the API Framework is coming soon! These modules will seamlessly integrate with this API Framework, unlocking new features of interacting with your Odoo environment from external applications.

Need Help?

EKIKA Has Your Back - 24/7 Support.

We're just a message away, no matter the time zone.

90 Days Free Support

We understand that even with great documentation, you might have questions or need additional assistance. That's why we offer exceptional support for "Odoo REST API Framework" users!

https://ekika.co/api
Documentation & User Guide
(copy link to clipboard)
https://www.youtube.com/@ekika_co/videos
Video Guide
(copy link to clipboard)
https://ekika.co/support
Support
(copy link to clipboard)

Contact Us:

  • Whats App / Phone: +919510031431 -- URGENT
  • EMail: hello@ekika.co
  • Skype: amshukla17
  • Website: https://ekika.co
  • Support Ticket: https://ekika.co/support -- Get Notifications of Progress.
  • 24 x 7 Available! Contact us NOW.

We love hearing your ideas for improvement! If you have a feature in mind that would make your Odoo experience even better, simply contact us. We're happy to discuss your needs and explore the best way to implement them.

Frequently Asked Questions (FAQs)

Welcome to our FAQ page! This resource is designed to answer common questions you might have about API Framework. We've categorized the questions for easy browsing, and you can also use the search bar on our website to find specific answers quickly. If you don't see your question addressed here, feel free to contact us!

Contact Us:

  • Whats App / Phone: +919510031431 -- URGENT
  • EMail: hello@ekika.co
  • Skype: amshukla17
  • Website: https://ekika.co
  • Support Ticket: https://ekika.co/support -- Get Notifications of Progress.
  • 24 x 7 Available! Contact us NOW.

We love hearing your ideas for improvement! If you have a feature in mind that would make your Odoo experience even better, simply contact us. We're happy to discuss your needs and explore the best way to implement them.

We offer a wide range of Odoo services to help you at any stage, from initial setup ("implementation") to ongoing customization and support. This includes:

  • Adding new features and functionalities ("addons development")
  • Changing behaviour of whole system ("server and structure level changes")
  • Server maintenance and configuration changes ("nginx / filestores / size issues etc.")
  • Integration with other systems
  • RESTful APIs, WebHooks, Slave-Master DB, Real-time data communication ("socket connection") etc.
  • Improving app performance and user experience ("performance tuning" and "UI/UX design")
  • Secure and reliable managed hosting solutions
  • Annual maintenance contracts to keep your Odoo running smoothly and so much more...

Basically, we're your one-stop shop for all things Odoo! We offer premium services at competitive rates.

The beauty of this API Framework is that it's highly flexible! You're not limited to a specific number of APIs. You can create as many as your needs require to connect your Odoo environment with other applications.

Here's what makes it so dynamic:

  • Define Endpoints: You have full control over defining endpoints within each API. These endpoints specify how data can be accessed and manipulated within your Odoo system.
  • Customizable Configuration: You can configure each API to perfectly suit the needs of the application it connects to. This ensures a seamless and efficient integration. It allows you to configure authentication, authorization, protocols, users and much more.

In short, this API Framework empowers you to build a robust network of custom APIs tailored to your specific requirements.

You can change the key expiration time by simply doing this steps:

  • Go to the API section in which your specific API is published.
  • First you have to unpublished it and cancel it.
  • After that you change the key expiration date and time based on your requirements.
  • Lastly, just publish your API to use it.

Odoo models themselves are dynamically calculated with API configuration. They are the core building blocks that represent data within your Odoo instance (e.g., products, customers, orders etc.).

API Framework and Model Access: The API framework acts as an intermediary between external applications and your Odoo models. You can configure the API framework to define:

  • Endpoints: These specify how data can be accessed and manipulated within specific models.
  • Authentication: You can use API keys, Basic, OAuth2, User Credential or other methods to control access to the API.
  • Authorization: You can define user roles and permissions to control which users or applications can access specific models or functionalities through the API using odoo's standard permission management system.

So you will have:

  • Flexibility: You can create custom APIs to expose specific data or functionalities from your Odoo models to external applications.
  • Security: You can control access to models and data through API configuration.
  • Unified Access: The API provides a standardized way for external applications to interact with your Odoo data, regardless of whether they use standard or custom models.
  • Actions and Workflow: You can call methods of your Odoo models so you have ability to execute workflow and actions as well.

Important Considerations:

  • Not all models exposed by default: While the API framework can provide access to most models, your configured access with groups and groups assigned to user will define what information user can access using APIs.
  • Strong Authentication: Never use auth=None or weak authentication mechanisms. Implement robust authentication methods like API keys, OAuth, or Basic with proper key management practices.
  • Granular Authorization: Don't grant blanket access. Use authorization to control what users or applications can access specific models, data fields, and functionalities within your Odoo instance. Implement role-based access control (RBAC) to assign permissions based on user roles as per Odoo standards. So we recommand to use custom or user based access system from our APIs. We provide sudo access for MVP or quick start work, we do not recommand it for producation usage.

In summary: The API framework acts as a bridge, allowing external applications to interact with your Odoo models securely and efficiently. You have granular control over what data and functionalities are exposed through custom API configurations.

No, GraphQL Subscriptions with WebSocket connection are not included in the standard API framework bundle.

Here's why:

Specialized Implementation: GraphQL Subscriptions require a specific implementation tailored to real-time data updates. This makes them unsuitable for generic use within the broader API framework.

Do you offer GraphQL Subscriptions for Projects?

Yes, absolutely! While not included in the standard bundle, we offer custom development of GraphQL Subscriptions specifically designed for your project needs.

We have basic generic demo available if you would like to give it a try.

How can I learn more about Custom GraphQL Subscriptions?

Contact Us: Reach out to our team directly to discuss your project requirements and request a demo of our custom GraphQL Subscription solutions. We look forward to helping you unlock the power of real-time data with GraphQL Subscriptions!

Changelog

  • Version 1.1 [Jun 22, 2023]

      Milestone: Well Documented Release
    • New Remove GraphQL Subscription to decrease price from api_framework and put it standalone.
    • New Well written documentation.
    • New Add CORS Support.
    • Fixes Bug Fixes and Refinements: Various bug fixes and code improvements were implemented across different modules to enhance stability and performance.
  • Version 1.0 [Dec 18, 2023] Phobimo (Stable)

      Milestone: Full Feature Release
    • New Functionality for exporting reports for both API types was added to facilitate better analysis and tracking of data.
    • New JsonAPI Meta Information related fields and views were incorporated, expanding the scope of available information for users and improving the overall user experience.
    • Enhancement Separate documentation views were created for JSON API and GraphQL functionalities, providing users with clearer guidance on utilizing these features effectively.
    • Fixes Bug Fixes and Refinements: Various bug fixes and code improvements were implemented across different modules to enhance stability and performance.
  • Version 0.9 [Nov 30, 2023]

      Security and Access Control Boost
    • New API logging functionalities were introduced, providing administrators with insights into API usage and facilitating debugging processes.
    • Enhancement GraphQL Enhancements: GraphQL functionalities like introspection, schema directives, multi-query support, and argument passing were refactored, enhancing the flexibility and capabilities of GraphQL endpoints.
    • Enhancement JSON API Enhancements: JSON API functionalities related improvements in documentation and error handling, ensuring smoother interactions and troubleshooting processes.
    • Enhancement Additional Features: Easy-API form improvements were made, simplifying the process of managing field visibility and adding custom access settings.
    • Fixes Security and Access Control: Bug fixes and integration testing with OAuth for login and authorization, supporting various grant types with json api and graphql. Bug fixes of Access control features, allowing administrators to define user groups and customize access settings for better control over data and functionalities.
  • Version 0.8 [Oct 31, 2023]

      Focus on Additional Features and Enhancements
    • New Easy-API Improvements: Stages within the easy-API form were introduced to manage field visibility, offering users more control over the presentation of data (ccb76eb). Implemented unique constraint validations for specific easy-api model fields (a4486b5).
    • Enhancement Enabled adding custom access settings directly from the easy-api form (8b68799). Additionally, functionalities for API logging with options for filtering groups were implemented (b5185e9), improving monitoring capabilities.
  • Version 0.7 [Oct 17, 2023] Marsorb (Beta)

      Documentation, Security, and Access Control Prioritized
    • New OAuth Integration: OAuth functionalities for login and authorization were introduced (38dae19). Implemented support for various OAuth grant types (Implicit, Resource Owner Password Credentials, Client Credentials). Support for various OAuth grant types, token revocation, refresh, and authorization code generation was implemented (86d777e).
    • New Documentation Improvements: Introduced separate Documentation views for JSON-API and GraphQL functionalities (a4b0802, 70db31f).
    • New Access Control: Created three user groups (API Manager, Controller, Document Viewer) with designated access levels (993e672). Custom access settings could now be assigned directly from the easy-API form, offering finer control over data access and usage (8b68799).
    • Enhancement Enhanced JSON-API documentation to reflect model changes (c96984a). Functionalities for exporting reports for both JSON-API and GraphQL were added, improving accessibility and usability for users (fda0508, 1a8e3a0).
  • Version 0.6 [Oct 09, 2023]

      Focus on GraphQL Advancements
    • Enhancement GraphQL Introspection and Schemas: Functionalities for generating GraphQL Introspection data and Schemas were implemented (f920592, edea7d7). Added functionalities for handling introspection queries like '__type' (418cc21). Support for specifying GraphQL schema directives and descriptions was introduced (c57714b, 989a46).
    • Enhancement Enhanced functionalities: Various other enhancements such as multi-query functionality within GraphQL (f920592), passing arguments and variables directly to GraphQL domains (103994d), implemented search functionality using ID arguments within GraphQL (e4fadcf), added support for boolean data types within GraphQL (56d5597), enhanced error handling for GraphQL dispatchers (bcedcf2).
  • Version 0.5 [Sep 29, 2023]

      Continued Development of JSON-API Integration and Easy-API Implementation & Enhancements
    • New Easy-API: Introduced Easy-API with functionalities for simplified API creation (dca56b3, f90daed), including a publish button, help section, and advanced settings (f5129c6, c41d78b, fd8df7d). Security was improved with the implementation of Sudo-Access functionality. Implemented a test module for the Easy-JsonApi module (f871315).
    • New Security Improvements: Implemented Sudo-Access functionality for enhanced security (cf81e04).
    • Enhancement JSON-API Development: Continued development and refinement of JSON-API functionalities (622c8b6, 704b8db, ebe5941), including handling relationships, generating links, and supporting CRUD operations (serve_get, serve_post, serve_patch, serve_delete methods) (841ed4a, 5c8609d, 7551936). Enhanced error handling and exception management were implemented to ensure robustness (Json-API exceptions raised). Documented functionalities with code comments and a dedicated JSON-API documentation section (247c7ee, e525845).
    • Fixes Additional Improvements: Various other enhancements were made, including custom access control functionalities (69c9259), improved API logging (f923d6a, be1f6dd), and bug fixes across different modules (f431ec8, 28f5a7f, c43d4e6).
  • Version 0.4 [Sep 11, 2023]

      API Enhancements and Additional Improvements
    • Enhancement API Enhancements: Added functionalities for handling page size, automatic/manual API key generation (ab260e4, 105e1d5, 2769d86), and API logging with configurable tail length (9d6c5c2, 0b99c78). Improved error handling and exception management within the API framework were also implemented (5599db2, json-api exceptions modified). Refactored code structure for better organization (f23490e, 62d49b4).
    • Enhancement Additional Improvements: Implemented functionalities for applying rules within the application (3736b93), enhanced debug functionalities (2ee5266), and separated API mode configuration from the main codebase (013674a). Security was improved by defaulting to not storing sessions on every request (9acb14c). Added functionalities for dynamic route support (c8a5120).
  • Version 0.3 [Aug 31, 2023]

      Introduced GraphQL Support
    • New GraphQL Implementation: Successfully implemented Create, Read, Update, and Delete (CRUD) operations for GraphQL (99e7d56, deb0dec, 2a90be2, 5290b95), along with handling inline fragments and domains (eaf7585, e32c4b4). These additions expanded the capabilities of the framework, particularly in supporting GraphQL endpoints.
  • Version 0.2 [Aug 16, 2023]

      Implementation of JSON-API Integration
    • New JSON-API Integration:
      • Core functionalities for JSON-API data formatting were implemented (57d8b0b, cd1dbd2, 31fd365), along with handling fields and include parameters in querie (21fd365, 5cc17bb).
      • Additional functionalities such as search models were introduced (032e8e4) and marked JSON-API as work-in-progress with ongoing development (f8954b6, 8a10a1c).
  • Initial Version 0.1 [Jul 31, 2023] Mars Awakens (Alpha)

      Inception and Foundation Laying
    • New New important release
      • EKIKA launches ORF (Odoo REST Framework), a beta project inspired by Django's DRF. ORF fills a gap in the Odoo community by providing a powerful API framework for Odoo users, aiming to improve their experience.
      • Create Security Groups (API Admin or Manager, Read-only - Document Viewer, User or Developer).
      • Resource Management: Established resource control models (baac3dc) and developed modules for resource access control (fe94f4e), setting the stage for effective management of resources within the framework.
      • Important Authentication & Authorization: Implemented API key-based authentication (e2da633) and functionalities for authentication type with resource control (a1a1555). Create modules for API user authentication and exception handling (733ca5e, 828cc2f, 1673b3f).
      • Important API Framework Foundation: Created the base API module (f16ec49, 4735ef6, 8940aba) and implemented functionalities for API configuration settings (4034de8, 94ac818), HTTP requests (d2e45fa), and developed a module for testing API endpoints (f9a2336).

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 RESTful API Bundle v1.0

Author:Anand Shukla
Company:EKIKA Corporation Private Limited
Support:https://ekika.co/support
Phone:+91-9510031431
Email:hello@ekika.co
Skype:amshukla17
Published:Dec 16, 2023
Last Update:April 21, 2024
Version:v1.0
Odoo Version:15.0, 16.0, 17.0
Doc Update:April 21, 2024

Introduction

The Odoo RESTful API Bundle simplifies integrating external applications with your Odoo ERP system. It offers a modular framework, allowing you to build Dynamic and Custom APIs tailored to your specific needs. This documentation guides you through installation, configuration, and using the API Bundle's functionalities.

Why this API Bundle?

  • Dynamic Connectivity: Effortlessly connect your APIs to Odoo models and fields.
  • Modular Design: Build custom APIs with a flexible, building-block approach.
  • Multiple APIs and Endpoints: Create and manage multiple APIs within a single Odoo environment/database and beyond.
  • Authentication Options: Select from various authentication methods like API keys, Basic Auth, Standard User Credentials or OAuth2 Authentication.
  • Comprehensive Documentation: Access clear documentation for each module within the bundle.
  • Redoc: Open API specification based documentation of Json:API you configure.
  • Introspection: GraphQL Introspection within Odoo for documentation of GraphQL APIs you configure.
  • Postman Collection: https://git.ekika.co/EKIKA.co/Odoo-API-Framework-POSTMAN-Collection
  • Flutter Sample: Contact us to get easy to build mobile applications with the source code.
  • Expert Support: Receive exceptional support from the EKIKA team.

Two types of API Specifications:

  1. GraphQL (Know more about GraphQL here)
  2. JSON:API Specification v1.1 (Know more about JSON:API)
  3. More to come like odoo standard jsonrpc, xmlrpc supported with api framework architecture, gRPC, Webhooks, Subscriptions, Custom etc.
  4. You can implement your own too.

Four Types of Authentication:

  1. API-Key Based Authentication (know more)
  2. Basic Authentication (know more)
  3. Standard User Credentials Authentication (know more)
  4. OAuth2 Authentication (know more)

Three Types of Access Controls:

  1. Standard User Based Access (supported from foundation)
  2. Sudo User Access (supported from foundation)
  3. Custom Managed API Specific User Access (know more)

NOTE

How and Which modules you should Buy?

If you do not want everything in a bundle and want to save based on your need, then do not spend more. You can buy separate apps based on your purpose. Let me tell you how you should buy OR contact us so we can suggest what you should buy.

Examples:

  1. Suppose You want to use API-Key authentication and Json:API specification for RESTful APIs. Just buy the following apps. When you add the following two apps in your cart you will have 5 apps in the cart and you have to spend less compare to price of full bundle.
  2. Similar way if you only need graphql and Basic Authentication add the following two apps in your cart.

You will have full control on your APIs from a single database. You can make more than 20+ flavors of API using this framework with version 1.0. We are already enhancing this framework so request your needs to us. We do not charge for any generic usable developments around APIs. Contact Us for your specific needs. skype:- amshukla17

Contact us for your query: https://ekika.co/support

Getting Started

Installation

  1. Download the Module: Acquire the api_framework module exclusively from the official Odoo app store, our website, or by reaching out to us directly. Avoid obtaining the module from any other source, as it could jeopardize your Odoo environment or engage in malicious activities.
  2. Put in Addons Path and Restart Odoo: Once you have the modules, put it in the odoo addons path and restart your Odoo instance to apply the modules.
  3. Module Installation: * Log in to your Odoo instance with administrative credentials. * Navigate to the Apps module. * Click on the Update Apps List to ensure you have the latest modules. * Search for "API Framework" or "api_framework" and install the module.

Congratulations! You've successfully installed the Odoo API Framework. Now, let's explore how to configure it.

Configuration and Overview

The Odoo API Framework offers a balance of simplicity and flexibility in its configuration. Follow these steps to tailor the framework to your specific use cases:

  1. Access API Configuration Settings:
    • In Odoo, navigate to the API main menu. (If you do not find allow access of API administration to your user.)
    • Look for the API Settings menu. (You can create multiple api for different purposes or for different groups of people all can be configured it's own way.)
  2. API Setup and Authentication Options:
    • Choose a name based on usage.
    • Define a base path to access your api.
    • Choose from a variety of authentication methods, including API key, user-based, or OAuth2.
    • Effortlessly establish and oversee access to your API resources.
    • Click Open
    • Configure Users
    • Access Document and build your query based on following needs json:api or graphql.

For detailed information you have to read documentation done on each module we provided below.

Protocol / API specification:

Authentication:

Access:

Do not buy Odoo API Base as a single app it just has framework style approach for foundation to maintain API Framework building block. It is very useful if you are a advance level principal developer. Otherwise we do not recommend purchasing this base app as a single item.

Do not remove dependent apps from cart after adding one app. It may be possible you do not get what you are expecting, instead contact us. We are happy to save your budget.

We believe in building strong partnerships with our customers. Let us help you unlock the full potential of your Odoo implementation. Contact EKIKA today for a free consultation and see how we can streamline your workflows.

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.