Integrating external api calls from another app into axelor

Dear Community,

Is there a guide on how to do http request GET/POST on external api(other app) and then display the JSON/data returned inside axelor using custom views?

I have look into Actions and WebService Action on axelor docs but it was only doing api request on axelor api’s not other app’s api.

Hi,

Maybe you can use a Controller (java) that will call the external API and return the object. This controller can be called from a field using “expr=call:my.class:MyMethod()” of from an action-method to set a field value.

Have a look here: https://docs.axelor.com/adk/5.0/dev-guide/modules/coding.html

Regards

hi femtonext
now i want to wtire a custom service and public it by json object to external app (maybe mobile app)
how can i do it with axelor?

Thanks

Hi,

If you want to call service from your app use “Controller” (see https://docs.axelor.com/adk/5.0/dev-guide/modules/coding.html)
If you want an external app to call your app, have a look here: https://docs.axelor.com/adk/5.0/dev-guide/web-services/index.html

Hi,
But i mean when i write a custome services ex: stock_move functions and i want to public it as a json services for mobile client. How i can do that?
because i see the document it only support some single method: read, update, create, delete for a models.
thanks so much!

Hi femtonext are you there!

If i want to public a bussiness API by rest services, it not only single model object to client. how i can do that?

thanks you!

To create your custom service inside the Axelor app you just have to create your own module and to declare your self RestEasy class. These defined classes will be automatically scanned at start.

Just have a look at classes source here com.axelor.web.service (ADK) to see how to create a custom JSON Service.

You have the choice to return Axelor Response or JaxResponse as you need.

Regards

hi @gengulay did you find a solution ?