Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
21783 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ

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

They had mention in doc

Tác giả

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

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả

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.

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ

Thank you for the Zato link.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 23
25076
1
thg 2 22
4214
4
thg 3 15
17321
2
thg 3 24
9608
0
thg 7 25
166