Hi,
I am evaluating the OOTB Form Template and Components for a requirement for a client.
We have to submit the Form to a Third Party REST API. We have no need to save the form data in AEM or any other persistent system.
What i have observed is if I configure the REST Endpoint in the Submit action, the request first comes to AEM and then goes to a third party.
Is this the expected behavior?
Can i not send the Form Data directly to a third party API?
Regards,
Manas
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Manas,
You can do an ajax call to service endpoint from javascript or jquery or any library of your choice. But if you want to do something structural. Then you call the endpoint from Sling Models and map the response from the endpoint some Sling Models and use it via sightly(This might be useful in GET request). For post, put and delete I don't think you need extra AEM layer for external service endpoint its an option. Like if you want to hide your external endpoint url or something then you can use the AEM layer.
~susheel
Views
Replies
Total Likes
Views
Replies
Total Likes
The best way is to write a custom form action that will send the Form data to an OSGi service. See:
Once you get the data to a Java service - you can invoke a third party REST Service using HTTP Java APIs.
See:
This would be the best way to address your requirements.
Views
Replies
Total Likes
Thanks smacdonald2008.
I already went through those links.
But my question is slightly different.
In case i DO need to send something directly to an End Point, Do i still need to go via AEM?
I am thinking why to increase the LOAD on AEM when it does not need to process a request.
Regards,
Manas
Views
Replies
Total Likes
Sending data to a 3rd party endpoint is a custom operation. The logic needs to be somewhere.
In the case of a Form - when you do a submit operation - you need to submit the data where it can be read and then sent to a 3rd party endpoint.
To address this - Java is the best way. AEM is build to handle this type of operations. I would recommend using a Sling Servlet for this use case
Views
Replies
Total Likes
Hi Manas,
You can do an ajax call to service endpoint from javascript or jquery or any library of your choice. But if you want to do something structural. Then you call the endpoint from Sling Models and map the response from the endpoint some Sling Models and use it via sightly(This might be useful in GET request). For post, put and delete I don't think you need extra AEM layer for external service endpoint its an option. Like if you want to hide your external endpoint url or something then you can use the AEM layer.
~susheel
Views
Replies
Total Likes