v 8.0 v 9.0 v 10.0 v 11.0 v 12.0 Third Party 40
Lines of code 193
Technical Name rest_api_drc
Websitehttp://www.drcsystems.com
Also available in version v 9.0 v 11.0 v 8.0 v 10.0
You bought this module and need support? Click here!
Lines of code 193
Technical Name rest_api_drc
Websitehttp://www.drcsystems.com
Also available in version v 9.0 v 11.0 v 8.0 v 10.0

Features

This module provide REST API (json) access to Odoo models.
  • Available Operations
    • Get Token :

      Odoo requires users of the API to be authenticated before they can use any other API. Authentication itself is done through the authenticate function and returns Token. On Every API call user must send a token to Access any API.

      • Example:
        localhost:8069/api/user/get_token?login=admin&password=admin
        It will Return:
        {"token": "24e635ff9cc74429bed3d420243f5aa6"}   # If authentication done.
    • Delete Token :

      User can delete token so, API call is not allow to access by that token On Detele token API call user must send a token.

      • Example:
        localhost:8069/api/user/delete_token?token=24e635ff9cc74429bed3d420243f5aa6
        Return:
        {"success": "Token '24e635ff9cc74429bed3d420243f5aa6' Deleted Successfully"}

    • Refresh Token :

      User can Refresh token so, token will be updated and return new token. On Refresh token API call user must send a token.

      • Example:
        localhost:8069/api/user/refresh_token?token=24e635ff9cc74429bed3d420243f5aa6
        Return:
        {"token": "cd7bdf0dfb7d4d74b08d3eae84af934c"}

    • Search Record:

      list records , it is mandatory to pass model name if id is pass with url then return a single record of a specific id Found else check domain in post data , if domain is found then return matched records else return all the data with id and name field.

      By default a search will return the ids and name of all records matching the condition, which may be a huge number.if offset and limit parameters are available to only retrieve a subset of all matched records.

      By default a search will return the ids and name of all records matching the condition, it may possible that also you want to read other fields name with that name and ids. Note: it will always returns id as default field name if field name is not given it will return (id and name) otherwise it will return (id and all given fields name).

      • Example for single record :
        localhost:8069/api/res.partner/search/1?token=24e635ff9cc74429bed3d420243f5aa6
      • Example for search using domain, offset and limit
        localhost:8069/api/res.partner/search?token=cd7bdf0dfb7d4d74b08d3eae84af934c&
        		&domain=[('customer','=', True)]&offset=10&limit=2&fields=['name','phone']

        • It will Return :
          [
              {
                  "phone": "+44 121 690 4596",
                  "id": 25,
                  "name": "David Simpson"
              },
              {
                  "phone": false,
                  "id": 35,
                  "name": "Jacob Taylor"
              },
          ]
          					            
                                     
    • Create Record:

      create record , it is mandatory to pass model name and values for record creation pass as create_vals of JOSN/Dictionary format. .

      • Example:
        localhost:8069/api/product.product/create?token=24e635ff9cc74429bed3d420243f5aa6&
                                	create_vals={'name':'Apple'}
        • It will Return :
          {'id':101}
                                        
    • Update Record:

      update record , it is mandatory to pass model name and record id and values for record update pass as update_vals in JOSN/Dictionary format.

      • Example:
        localhost:8069/api/product.product/update/101?token=24e635ff9cc74429bed3d420243f5aa6&
        	update_vals={'name':'Mango'}
        • It will Return :
          {'success':'Record Updated Successfully'}
                                        
    • Delete Record:

      Delete record , it is mandatory to pass model name and record id For Delete multiple records pass record ids in url parameter as 'unlink_ids' as in list format.

      • Example for single record:
        localhost:8069/api/product.product/unlink/59?token=24e635ff9cc74429bed3d420243f5aa6
        • It will Return :
          {'success':'Records Successfully Deleted 59'}
                                        
      • Example for multi record:
        localhost:8069/api/product.product/unlink/?token=24e635ff9cc74429bed3d420243f5aa6&
        	unlink_ids=[60,61]
                                
        • It will Return :
          {'success':'Records Successfully Deleted [60,61]'}
                                        
    • Calling method of any model :

      For calling a method of any model , it is mandatory to pass model name, record id and method name method call based on new api standards. so no need to pass cr,uid,ids,context as method argument. Other then this argument pass as 'args'=[arg1,arg2] in query string

      • Example for calling a method without argument:
        localhost:8069/api/sale.order/26/method/action_confirm/
        	?token=1ec448c54a004165b4c0da976b227260
        • It will Return :
          {"success": "True"}

          It will return dictionary its key 'success' and and its value is as per return value of calling method

      • Example for calling method with arguments:

        def get_salenote(self, partner_id)' this method is of sale.order model. For calling this method we need to pass partner_id as argument

        localhost:8069/api/sale.order/35/method/get_salenote/
        	?token=1ec448c54a004165b4c0da976b227260&args=[3]
                                
        • It will Return :
          {"success": "sale note"}
                                        
      • Example for calling method with keyword arguments:
        localhost:8069/api/sale.order/33/method/action_invoice_create/?
        	token=1ec448c54a004165b4c0da976b227260&args={'date_invoice':'2016-09-02'}
                                
        • It will Return :
          {"success": "12"}
                                        

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.
There are no ratings yet!
User management
by
jhonatan salazar
on 11/11/19, 11:25 PM Confirmed Purchase

Hi, I'm wondering if when creating, reading and updating records, and also calling methods, the API is impersonating the user with which the token was generated, meaning that if this is returning the records the user has grants to, and also for logging matters if odoo is saving using that very same user for tracking record updating and creation matters