Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
21793 Visualizzazioni

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.

Avatar
Abbandona

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

They had mention in doc

Autore

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

Risposta migliore

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.

Avatar
Abbandona
Autore

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.

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.

Autore

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.

Risposta migliore

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.

Avatar
Abbandona

Thank you for the Zato link.

Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
feb 23
25117
1
feb 22
4230
4
mar 15
17334
2
mar 24
9621
0
lug 25
211