Create a Controller to be called externaly

Hello Comunity,

I’ve a doubt regarding Controllers at Axelor erp.
I’m in the need of calling axelor functions externally, for example to publish an endpoint to create a Lead
POST http://localhost:8080/xxxx/createLead with the information needed sent as body
In this controller I would inject the needed services to call the internal code of the ERP that executes those actions when the user clicks on it on the UI.
I’ve seen there’s the possibility to create custom controllers/services and so, but in the documentation I’ve found that you finally finish adding this endpoints to the form or as an action (maybe I’m missing something).
My idea is to be able to publish it inside my ERP with a custom path and custom parameters, just like a normal CRUD endpoint.

Any tips?

Thank you!


Are Webservices not the solution to your problem ?

Web Services in technical Documentation

Action Service in Advanced Services
The action can be single or list of comma separated actions.
An action can be either an xml action or a method call.

Hello @PakMax thanks for your response.
Yes I’ve had a look at them, but maybe I’m missunderstanding them, and as the examples I’ve seen at the documentation for REST service are pure CRUD operations on entities.
Then if I don’t get it wrong, with advanced services I could create a « com.axelor.apps.crm.web.HelloController » with a « sayHello » method and just call it with the needed json payload (for example) with a POST to « /ws/rest/com.axelor.apps.crm.web.HelloController/sayHello » ?

Thanks in advance

Reading the action Service more carefully I think you tried to mean this other option:

POST /ws/action/
Accept: application/json
Content-Type: application/json
  "action": "say-hello,apps.crm.web.HelloController:sayHello",
  "data": {
    "context":  {

Isn’t it?

I have not experienced Web Services myself.
But according to the documentation it could be:

POST /ws/action HTTP/1.1
Accept: application/json
Content-Type: application/json

" action": " com.axelor.apps.crm.web.HelloController:sayHello"
** " data": {**
** " context": {**
** " id": 1,**
** …**
** },**
** }**

Je n’avais pas vu votre réponse qui correspond à la mienne

Dont worry
Thank you very much for your time

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.