[SOLVED] REST API - ODOO Authentication |
2/6/2024 1:10:04 PM |
PHPRunner General questions | |
![]() Hi, My 1st time using REST API here, I have this credentials below and no problem on postman
My authentication (in postman body) { I have trigger in my customer data once I create new customer in phprunner, I have button that will push the record to ODOO via REST API $curl = curl_init(); nothing happen when I click the button, what did I missed? TIA |
|
![]() |
Admin 2/6/2024 |
It is not very clear how PHPRunner applies here since you are using your own custom PHP code here. What happens when you run this code manually? |
![]() |
mic'',) author 2/6/2024 |
nothing happen, what did I missed? I put the code in the server using custom button |
W
|
wpl 2/7/2024 |
Your code says: echo $response; But nothing was assigned to $response, so it seems to be empty. Therefore, you should try: $response = curl_exec($curl); beforehand and see what will be returned. Regards |
![]() |
Admin 2/7/2024 |
I don't think you understood the question. Did you run this code manually, outside of PHPRunner? |
![]() |
mic'',) author 2/8/2024 |
Hi Sergey, Did you run this code manually, outside of PHPRunner? Yes and tried this on custom buttom on server side to check if theres a response, but nothing happen as well tho what I found, I need the authenticated session and I tried this
Ive tried the authentication (code below) outside phprunner but, unfornately Ive got 0 value response heres my code, no idea what I missed. <?php the response 0 Any thoughts? Thanks in advance |
![]() |
Admin 2/8/2024 |
You need to make sure that your code runs outside of PHPRunner first. Once you got it working you can copy and paste it into button's Server event. By placing the untested code there yuo are just adding an extra level of complexity. Your REST API provider should provide some sample code that you can use. Also, Postman can generate PHP code for you. |
![]() |
mic'',) author 2/8/2024 |
Hi Sergey Yes and I've done testing outside PHPR
Also, integrating this inside PHPRunner via custom custom button.
I just add this (code below), and created a function in After Application Initialized, to get the return authenticated session. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); I dont need to use xmlrpc for authentication when integrating to ODOO Creating, updating and deleting of customers, product successfully done on test server. |