diff --git a/rest_api_odoo/Postman Collections/Odoo REST Api.postman_collection.json b/rest_api_odoo/Postman Collections/Odoo REST Api.postman_collection.json index f474d5311..2f73d85c0 100644 --- a/rest_api_odoo/Postman Collections/Odoo REST Api.postman_collection.json +++ b/rest_api_odoo/Postman Collections/Odoo REST Api.postman_collection.json @@ -39,7 +39,7 @@ "host": [ "cybrosys" ], - "port": "8016", + "port": "8017", "path": [ "odoo_connect" ] @@ -86,7 +86,7 @@ "host": [ "cybrosys" ], - "port": "8016", + "port": "8017", "path": [ "send_request" ], @@ -140,7 +140,7 @@ "host": [ "cybrosys" ], - "port": "8016", + "port": "8017", "path": [ "send_request" ], @@ -190,7 +190,7 @@ "host": [ "cybrosys" ], - "port": "8016", + "port": "8017", "path": [ "send_request" ], @@ -235,7 +235,7 @@ "host": [ "cybrosys" ], - "port": "8016", + "port": "8017", "path": [ "send_request" ], diff --git a/rest_api_odoo/__manifest__.py b/rest_api_odoo/__manifest__.py index af3c23388..6dfca578e 100644 --- a/rest_api_odoo/__manifest__.py +++ b/rest_api_odoo/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { "name": "Odoo rest API", - "version": "17.0.1.0.0", + "version": "17.0.1.0.2", "category": "Tools", "summary": """This app helps to interact with odoo, backend with help of rest api requests""", diff --git a/rest_api_odoo/doc/RELEASE_NOTES.md b/rest_api_odoo/doc/RELEASE_NOTES.md index d281db9ab..a444529a5 100644 --- a/rest_api_odoo/doc/RELEASE_NOTES.md +++ b/rest_api_odoo/doc/RELEASE_NOTES.md @@ -8,3 +8,8 @@ #### Version 17.0.1.0.1 ##### BUG FIX - Updated the issue of date fields + +#### 25.11.2024 +#### Version 17.0.1.0.2 +##### BUG FIX +- Included documentation in the index file. diff --git a/rest_api_odoo/static/description/assets/screenshots/1.png b/rest_api_odoo/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..c7928c974 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/1.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/10.png b/rest_api_odoo/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..5a860487e Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/10.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/11.png b/rest_api_odoo/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..129f84109 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/11.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/12.png b/rest_api_odoo/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..b4e1c3fc2 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/12.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/13.png b/rest_api_odoo/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..f6b14a527 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/13.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/14.png b/rest_api_odoo/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..cca458ecc Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/14.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/15.png b/rest_api_odoo/static/description/assets/screenshots/15.png new file mode 100644 index 000000000..134e5c962 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/15.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/16.png b/rest_api_odoo/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..8f375413d Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/16.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/17.png b/rest_api_odoo/static/description/assets/screenshots/17.png new file mode 100644 index 000000000..435d0167b Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/17.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/18.png b/rest_api_odoo/static/description/assets/screenshots/18.png new file mode 100644 index 000000000..9b30b3cfb Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/18.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/19.png b/rest_api_odoo/static/description/assets/screenshots/19.png new file mode 100644 index 000000000..67132dc8e Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/19.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/2.png b/rest_api_odoo/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..eb6799a39 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/2.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/20.png b/rest_api_odoo/static/description/assets/screenshots/20.png new file mode 100644 index 000000000..e89c52e09 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/20.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/21.png b/rest_api_odoo/static/description/assets/screenshots/21.png new file mode 100644 index 000000000..e3561e9a7 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/21.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/22.png b/rest_api_odoo/static/description/assets/screenshots/22.png new file mode 100644 index 000000000..d64265235 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/22.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/23.png b/rest_api_odoo/static/description/assets/screenshots/23.png new file mode 100644 index 000000000..94a253646 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/23.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/24.png b/rest_api_odoo/static/description/assets/screenshots/24.png new file mode 100644 index 000000000..3f5cc58e5 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/24.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/3.png b/rest_api_odoo/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..231cf7404 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/3.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/4.png b/rest_api_odoo/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..e985293eb Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/4.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/5.png b/rest_api_odoo/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..194f55810 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/5.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/6.png b/rest_api_odoo/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..e58e2b1f8 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/6.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/7.png b/rest_api_odoo/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..747032082 Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/7.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/8.png b/rest_api_odoo/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..2689c6bac Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/8.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/9.png b/rest_api_odoo/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..05077b84e Binary files /dev/null and b/rest_api_odoo/static/description/assets/screenshots/9.png differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api.png b/rest_api_odoo/static/description/assets/screenshots/rest_api.png deleted file mode 100644 index daaebe23b..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api.png and /dev/null differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api_1.png b/rest_api_odoo/static/description/assets/screenshots/rest_api_1.png deleted file mode 100644 index 62c63630a..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api_1.png and /dev/null differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api_2.png b/rest_api_odoo/static/description/assets/screenshots/rest_api_2.png deleted file mode 100644 index 45063358e..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api_2.png and /dev/null differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api_3.png b/rest_api_odoo/static/description/assets/screenshots/rest_api_3.png deleted file mode 100644 index 3d5367f65..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api_3.png and /dev/null differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api_4.png b/rest_api_odoo/static/description/assets/screenshots/rest_api_4.png deleted file mode 100644 index 55b5f42e6..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api_4.png and /dev/null differ diff --git a/rest_api_odoo/static/description/assets/screenshots/rest_api_5.png b/rest_api_odoo/static/description/assets/screenshots/rest_api_5.png deleted file mode 100644 index 2bfe803c0..000000000 Binary files a/rest_api_odoo/static/description/assets/screenshots/rest_api_5.png and /dev/null differ diff --git a/rest_api_odoo/static/description/index.html b/rest_api_odoo/static/description/index.html index 2bdcc0ac9..d19217840 100644 --- a/rest_api_odoo/static/description/index.html +++ b/rest_api_odoo/static/description/index.html @@ -48,7 +48,7 @@

The odoo Rest API module allow us to connect to database - with the help of GET , POST , PUT and DELETE request. + with the help of GET ,POST ,PUT and DELETE request.

- Screenshots + Documentation
  • + style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> +
    + +
    +
    +

    + Step 1: Add a New Parameter in the Odoo.conf + File

    +

    + Before installing the module, Add + "server_wide_modules = web, base, + rest_api_odoo" to odoo.conf file. This + configuration enables the server to handle + requests without requiring database + selection. Once this is done, you can + proceed to + install the module. +
    Note: If you need to uninstall + the module, ensure you remove this parameter + from the configuration file. + +

    +
    +
    +
  • +
    +
    +
    + +
    +
    +

    + Step 2: Locate the Postman collections in the + provided app folder.

    +

    + In the extracted module folder, locate the + Postman collections file in JSON format. +

    +
    +
    +
    +
    +
    -
    +
    +

    + Step 3: Open Postman and click the Import + button. +

    +
    +
    +
    +
    +
    -

    -
      -
    • First of all, we have to add a new - parameter in odoo conf. - file. -
    • -
    • server_wide_modules = web, base, - rest_api_odoo
      - - This will allow us to send request - to - server without - selecting database first.
      - - Incase - if you have to - uninstall the module , you have to - remove this parameter. -
      - Next we can install the - module. -
    • -
    • After installing the Rest api app we - can - see a new api key - field in users. -
    • - - Next we have to generate the api-key - for - the current - user.
      -
    • You can import the postman - collections - provided in the app - folder for authentication and - interacting with database in - various methods. -
    • -
    + Step 4: Select the JSON file from the module folder + to import the collection.

    @@ -257,53 +289,14 @@
    -

    -
      -
    • We have attached Postman - collections through which - you can - authenticate rest api. -
    • -
    • First, extract the zip file. - Then, you will obtain the - JSON-format - file, which you can directly import - into - POSTMAN.
    • -
    • The url format will be like this - - http://localhost:8017/odoo_connect - Replace 'localhost:8016' with your - localhost port number. -
    • -
    • You have to provide database name, - username and password - through the headers while sending - request. -
    • -
    • If the authentication is successful - , an - api key will be - generated for the current user. -
    • -
    • This key will be used when sending - api - requests to - database. -
    • -
    • The response will be like this - - {"Status": "auth - successful", "User": "Mitchell - Admin", - "api-key": - "66c2ebab-d4dc-42f0-87d0-d1646e887569"}. -
    • -
    + Imported collections.

    @@ -313,39 +306,50 @@
    -
    +
    +

    + Step 5:Open Authentication. +

    +
    +
    +
    +
    +
    -
    +
    +

    + Step 6: Update the Base URL, db (Database Name), + login (Database Username) and password + (Database Password) under Headers. +

    +
    +
    +
    +
    +
    -

    -
      -
    • After rest api authentication, we - can - create records in the - rest api app. -
    • -
    • Here we can choose the model, and - also - we can - choose the http methods. -
    • -
    • The api response will be based on - these - records. -
    • -
    + Step 7: Click Send.

    @@ -354,10 +358,17 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    - Get Records

    + If authentication is successful, an API key + will be generated for the current user. +
    @@ -365,47 +376,23 @@ style="padding: 1rem 4rem !important;">
    +
    + +
    -
      -
    • You can send GET request to retrieve - data from the - database. -
    • -
    • The postman collection has been provided - with--> - app files for - sending request from postman. -
    • -
    • You have to provide username, password - and api - key through - the header. -
    • -
    • Model can be passed as argument as the - technical - name , and - also if you want - specific record you can provide the id - as well, -
    • -
    • The format for GET method will be like - this - http://localhost:8016/send_request?model=res.partner&Id=10. -
    • -
    • We can specify the fields inside the - JSON data, - and it will - be like this - {"fields": ["name", - "email"]}.
    • -
    • This is the format of api response - {"records": - [{"id": - 10, "email": - "deco.addict82@example.com", - "name": "Deco - Addict"}]}. -
    • - -
    +

    + API Key in the User's Form View +

    +

    + To find the generated API Key for the + current user, navigate to Settings > Users & + Companies > Users, open the user's form + view, and go to the API tab. The API Key + will be displayed there. +

    @@ -413,70 +400,56 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    - Create Records

    + Step 8: Create Rest API Records. + +

    + Navigate to Rest API in Rest API module and + create new record. Select + the model and the HTTP methods. The chosen + methods + will determine the allowed actions on the + records, and the API response will reflect + the changes made. +

    + +
    +
    + +

    -
      -
    • Using POST method , you can create - new records - in the - database. -
    • -
    • Just make sure you enabled POST - method for the - model record - in rest api app , otherwise you will - get 'method - not - allowed' message. -
    • -
    • For creating record you have to - provide the JSON - data along - with the model. -
    • -
    • You can make use of the postman - collection that - we have - added with app files. -
    • -
    • The format for sending POST request - will be like - this - http://localhost:8016/send_request?model=res.partner. -
    • -
    • This is the format for JSON data - - { - "fields" :["name", "phone"] , - "values": {"name": "abc", - "phone":"55962441552" - } }. -
    • -
    • Make sure the data entered in - correct format - otherwise you - will get 'Invalid JSON data' - message. -
    • -
    • Response will be in this format - - {"New - resource": - [{"id": 51, "name": "abc", - "phone": - "55962441552"}]}. -
    • -
    + Step 9: Getting Records via REST API

    +

    + Open Get records api collection in postman + and add the db, login, password, api-key in + the headers. Pass the model + (e.g., product.template) in the URL to + retrieve records for that model. +
    + + Note: + + Make sure that GET method is enabled for product.template model in Rest API record. +

    @@ -484,10 +457,18 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    - Update Records

    + Step 10: Specify the fields you want to retrieve in + the JSON data under Body section and click + Send. +
    @@ -495,45 +476,15 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    -
      -
    • Updation of records in the database - can be done - with PUT - method. -
    • -
    • You have to provide the model and - also the id or - the record - that you want to update. -
    • -
    • You can use the Postman collection - that we have - provided and , you - will be always have to send request - with your - login - credentials. Otherwise, it will be - showing - access denied. -
    • -
    • The format for sending PUT request - will be like - this - http://localhost:8016/send_request?model=res.partner&Id=46. -
    • -
    • Here too you have to provide the - JSON data - through which the - updates will be done. -
    • -
    • The response format will be like - this - {"Updated - resource": [{"id": 46, "email": - "abc@example.com", "name": - "Toni"}]}.
    • -
    + The retrieved records.

    @@ -542,10 +493,22 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    - Delete Records

    + Step 11: Get a specific record. + +

    + To retrieve a specific record, pass the ID + in the URL (e.g., + http://localhost:8027/send_request?model=product.template&Id=28) + and click Send. +

    @@ -553,46 +516,179 @@ style="padding: 1rem 4rem !important;">
    +
    + +

    -
      -
    • Database records can be deleted by - sending - DELETE method - request. -
    • -
    • For the deletion we have to provide - the Model - and the record - id that we want to delete. -
    • -
    • Make sure you have permission to - delete files - for the - selected model in the rest api - record. -
    • -
    • The delete request format will be - like this - - http://localhost:8016/send_request?model=res.partner&Id=46. -
    • -
    • The response after successful - deletion will be - - - {"Resource deleted": [{"id": 46, - "email": - "abc@example.com", - "name": "Toni"}]}.
    • -
    + Retrieved record.

    +
    +
    +
    + +
    +
    +

    + Step 12: Creating Records via POST Method +

    +

    + Open Create Records from Rest API + Collection. Add db, api-key, login and + password under Headers. Update the Base Url. +

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Step 13: Provide the JSON data under the Body section + and specify the model in the URL. Click + Send.

    +

    + Note: Make sure that POST method is enabled for the selected model in Rest API record. +

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Created Record.

    +
    +
    +
    +
    +
    + +
    +
    +

    + Step 14: Update Records Using PUT.

    +

    + Open Update Records from Rest API + Collection. Add db, api-key, login and + password under Headers. Update the Base Url. + + Note: Make sure that PUT method is enabled for the selected model in Rest API record. +

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Step 15: Provide the JSON data under the Body section + and specify the model in the URL. Click + Send.

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Response after record update.

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Step 16: Delete Records Using DELETE.

    +

    + Open Delete Records from Rest API + Collection. Add db, api-key, login and + password under Headers. Update the Base Url. Add the model and the id of the record to delete and click Send. + + Note: Make sure that DELETE method is enabled for the selected model in Rest API record. + +

    +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Response after deleting the record.

    +
    +
    +
      +
    • + +