Reputation: 31
I am trying to establish communication between odoo and magento using the magento odoo connector. Odoo V8 and Magento 2.1.2 are running on 2 different servers using vagrant, so far i have been able to install the connector on odoo by following the installation guide, it is right after that where things started to seem ambiguous. Odoo server: 192.168.33.11:8069 Magento server: 192.168.33.12 see below the connector configuration interface:
2016-11-06 14:01:55,850 1842 ERROR magentodoo openerp.addons.magentoerpconnect.magento_model:
Traceback (most recent call last):
File "/vagrant/packages/connector-magento/magentoerpconnect/magento_model.py", line 214, in synchronize_metadata
import_batch(session, model, backend.id)
File "/vagrant/packages/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 382, in import_batch
importer.run(filters=filters)
File "/vagrant/packages/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 251, in run
record_ids = self.backend_adapter.search(filters)
File "/vagrant/packages/connector-magento/magentoerpconnect/unit/backend_adapter.py", line 211, in search
[filters] if filters else [{}])
File "/vagrant/packages/connector-magento/magentoerpconnect/unit/backend_adapter.py", line 159, in _call
full_url=custom_url) as api:
File "/usr/local/lib/python2.7/dist-packages/magento/api.py", line 150, in __enter__
self.username, self.password)
File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1321, in single_request
response.msg,
ProtocolError: <ProtocolError for magento:[email protected]/index.php/api/xmlrpc: 404 Not Found>
Upvotes: 1
Views: 557
Reputation: 14746
Magento 2 ships with a SOAP and REST based API. There is no longer an XML-RPC based API.
In order to established connection with magento 2 you need such additional details (REST API)....
Consumer Key (customer_key)
Consumer Secret (customer_secret)
Access Token (token)
Access Token Secret (secret)
Example (create client to send request and get response)
import oauth2 as oauth
consumer = oauth.Consumer(key=customer_key, secret=customer_secret)
token = oauth.Token(key=token, secret=secret)
client = oauth.Client(consumer, token)
Once you get the client then you can send request to magento.
data = NONE
api_url = 'VALID API URL'
headers = {'Accept': '*/*', 'Content-Type': 'application/json','Authorization':'Bearer %s'%token}
resp, content = client.request(api_url, method='GET/POST', body=json.dumps(data),headers=headers)
Click here for detailed connection theory
Upvotes: 1