Skip to Content
Menu
This question has been flagged
2 Replies
14464 Views

Hello, everyone!

So, I have a little question. I need to consume an external API provided by a client from my company. I'm searching a lot and I can't find how to do this, the only thing I can manage to find is how to develop an API to be consumed by others, but I need the exact opposite. I just want to take some info I have and be able to send data to this external API. I really hope that someone could help me, 'cause I'm pretty confused on how to do it. If there are some documentation or anything on this that could help me, I appreciate.
I have even looked in the controllers and all that odoo.http stuff session, but I didn't understood a lot and don't actualy know if this is the case of using it.

If somebody could help me, I really appreciate it.

OBS: As I've said in the title, I'm using the version 11 of Odoo

Avatar
Discard
Best Answer

you need python-requests library get or post data to external API
https://requests.readthedocs.io/en/master/
In standard odoo code, there are many examples available. just global search `requests.post` or requests.get` keyword you will find many examples like
https://github.com/odoo/odoo/blob/11.0/addons/google_drive/models/google_drive.py#L95

Note: there is no need to write any controller for it you can use it anywhere in the codebase


Avatar
Discard
Best Answer

Hi,

Not sure what exactly you are looking for, If you are looking how to fetch the data from Odoo database, you can go through the odoo documentation:  External API

Along with it, to fetch value and update in the database, you can make use of the controllers too, see an example here: https://www.youtube.com/watch?v=wGvuRbCyytk

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 19
1922
0
Feb 24
2932
1
Jun 24
324
1
Nov 23
3159
1
Mar 23
4833