Invoke REST API - AEM 6.3 Forms | Community
Skip to main content
Level 4
June 20, 2017

Invoke REST API - AEM 6.3 Forms

  • June 20, 2017
  • 1 reply
  • 14926 views

Hi Guru's ,

I'm currently exploring AEM 6.3 forms and trying out a usecase to invoke a rest endpoint on click of a button .

I achieved this use case in AEM 6.2 via code editor where on click event I was excuting a peice of java script code which would make a ajax style call to rest API and render the response .

I'm trying to see if there is any better way to acheive this in AEM 6.3 .

I do not have the swagger file for the REST API and it is a third party service . Will i still be able to use Forms data integrations ? Or Is there any GuideUtils API to invoke rest based endpoints or java script way is the best to go  ? I found the article below  to execute SOAP based services , however couldn't find any thing similar for rest based calls ?

AEM 6.2 Forms Help | API to invoke web services from adaptive forms

Thanks in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

smacdonald2008
Level 10
June 20, 2017

Here is a general AEM article on how to invoke a 3rd party Restful web service: Scott's Digital Community: Creating Adobe Experience Manager services that invoke third party Restful web services

You can write an AEM OSGi service that contains Java logic that sends a request and handles the response.

KrisgumAuthor
Level 4
June 20, 2017

Thanks Scott.

I'm aware of osgi way of invoking services or javascript but i'm after the way to effectively leverage AEM forms.

Being a consumer of third party rest api , dont have swagger file to create a Form data model.

Wondering if there is any other mechanism in AEM forms apart from using plain javascript in code editor of rules section ?

cheers

DarrenBiz
Level 6
June 23, 2017

Thanks Darren .

Yes defnitely looks like one of the options.

However just thinking loud , effort to put in to create a swagger file , host it and then keeling them in sync seems to be huge when compred to invoking it with few lines of javascript code from code editor.

On different lines though as you had mentioned , if the approach of swagger file is taken it would give super authors power to use it in forms and invoke it which is nice.


Yes totally agree - its a tradeoff depending on who will be authoring the forms.

Also be aware of a limitation currently in Data Integrations where you can't inspect the response messages from the server after a REST/SOAP/JDBC service call. You can't tell the difference if the server returns an empty result set or if an error has been thrown by the underlying service call using the UI. You just get no response object. I have identified this with Adobe and hopefully there will be a fix in a later feature pack to allow this use case.