Submit to a Rest EndPoint

Avatar

Avatar

manass33544664

Avatar

manass33544664

manass33544664

09-08-2017

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

susheel

Avatar

susheel

susheel

11-08-2017

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

Answers (4)

Answers (4)

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

11-08-2017

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

Avatar

Avatar

manass33544664

Avatar

manass33544664

manass33544664

11-08-2017

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

11-08-2017

The best way is to write a custom form action that will send the Form data to an OSGi service. See:

Adobe Experience Manager Help | Creating a custom action for an Adobe Experience Manager Form compon...

Once you get the data to a Java service - you can invoke a third party REST Service using HTTP Java APIs.

See:

Adobe Experience Manager Help | Creating Adobe Experience Manager bundles that invoke third party Re...

This would be the best way to address your requirements.

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K
kautuk_sahni
Community Manager

11-08-2017

mandeepgandhi any help here?

~kautuk