Odoo Help

2

How implement RESTful API on OpenERP v7

By
santoshnayak
on 9/6/13, 9:43 AM 12,389 views

My company is using Purchase, Sale and Accounting module in OpenERP. We have few business apllications.User can store informations from Accout module in OpenERP as well as from different businesses. For storing information from different businesses we need RESTful API. Can any one help providing some guide lines and examples. Your suggestion will be highly appreciate. Thank you.

OpenERP Official : Support for REST-style webservices is planned for future releases of OpenERP.

They had mention in doc

Zahin
on 10/2/13, 11:52 AM

Zahin, They mentioned in openerp v6. I am using v7. let me confirm, whether v7 has REST-style or not.

santoshnayak
on 10/18/13, 12:06 PM
2
mike
On 9/6/13, 1:15 PM

First go to addons/web/http.py and study class JsonRequest. Then go to addons/web/controllers/main.py for examples on using whats in http.py. Everything you need to develop your own API spec is in there - authentication, session handlers, JSON object spec, methods for searching/updating object through the ORM etc. etc.

main.py illustrates how to define your own controllers and endpoints and provides many useful reusable methods to help avoid reinventing the wheel.

Thank you so much Mike for your valuable time. Let me clear one thing, what you told is it for RESTful API ? I think it's JSON RPC, correct me if i'm wrong. I went through JsonRequest in addons/web/http.py and also addons/web/controllers/main.py. I'm not clear after studing those classes. Can you please provide me one simple example on accounting module, implementing all CRUD operation in RESTful API.

santoshnayak
on 9/10/13, 8:47 AM

Sorry I should have pointed you to HttpRequest in http.py instead. A good example of its usage is upload_attachment in main.py where POST data in the request is used to create an OpenERP object. I'm sorry but I don't have time to give a more complete example right now. Basically you'll define endpoints using _cp_path in your controller class and then add methods for each CRUD operation. Honestly, it would probably be easier to use Django-Tastypie for your API and leverage the OpenERP/Django connector to access OpenERP models.

mike
on 9/10/13, 10:51 AM

Thanks a lot Mike. Sorry for taking your time, does OpenERP v7 support MySQL ? If so, give some guide lines for migrating DB to MySQL.

santoshnayak
on 9/11/13, 4:26 AM
1

Daniel Reis

--Daniel Reis--
3451
| 6 7 9
Lisbon, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt


Daniel Reis
On 9/6/13, 7:59 PM

Or you could use an ESB to translate the different apps messaging formats to the one you prefer. For this I suggest having a look at Zato.

Thank you for the Zato link.

Med Said BARA
on 2/27/16, 10:22 AM
0
Mateus Lopes
On 11/15/14, 7:41 AM

Use this : https://github.com/tgpfeiffer/restful-openerp

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 9/6/13, 9:43 AM
Seen: 12389 times
Last updated: 3/16/15, 8:10 AM