Skip to main content
Version: 8 - Apfelstrudel

ConnectorTypeXMLRPC

class connector_types.connector_type_xmlrpc.ConnectorTypeXMLRPC

Call a XMLRPC service.

Input Schema

  • url

    The URL of the XMLRPC endpoint.

    Type: string

  • func

    The function to call on the remote.

    Type: string

  • args

    Positional arguments for function call.

    Type: array

  • kwargs

    Keyword arguments for function call.

    Type: object

    Additional Properties: True

    Pattern Properties:

    • .*

      Data

Output Schema

  • result

    Data

Constants

ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca']

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
db = <your odoo database name>
api = <your odoo xmlrpc url>
userid = <your odoo user id>
password = <your odoo password>
products = this.connect(
'XMLRPC',
url=f'{api}/object',
func='execute_kw',
args=[
db,
userid,
password,
'product.product',
'search_read',
[[['type','=', 'product']]],
{
'fields': [
'code',
'name',
'categ_id',
]
},
],
).get('output_value').get('result')

The example above will call a odoo xmlrpc API

log:
- Start
- 'Connecting to <your odoo xmlrpc url>/object'
- Calling execute_kw

The result will be a list of json objects

result:
- id: 15
code: DESK0004
name: Customizable Desk
categ_id:
- 8
- All / Saleable / Office Furniture
- id: 16
code: DESK0005
name: Customizable Desk
categ_id:
- 8
- All / Saleable / Office Furniture