Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
15794 Представления

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

Аватар
Отменить
Лучший ответ

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


Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
дек. 19
2697
0
февр. 24
3718
1
июн. 24
1556
1
нояб. 23
4187
1
мар. 23
5670