Creating DataSource Configuration in AEM Forms

Last update: 2024-01-25
  • Created for:
  • Beginner
    Developer

In this part, we will create a REST backed data source. The following video walks thru the steps to create the data source.

 Transcript

In this video we will take a look at creating a RESTful data source. Every RESTful data source is backed by a Swagger file. A Swagger file, is nothing but a definition of the APIs that we’re gonna utilize. So this Swagger file defines the Host Name, the Base Path and the various operations, that are exposed through this Swagger file. For instance, there is an operation called get statement, which takes in parameter called id. Then the Swagger file defines the type of the parameter, how the parameter’s gonna be passed in, and what are the responses returned by their particular APIs. So, these are the various objects that are defined in the Swagger file here. For instance, we defined an object called balances and it’s properties. And there’s an object called user and it’s properties. So this is how a typical Swagger file would look like. So, once you have defined your Swagger file, the next step is to create a data source based on that particular Swagger file. So, we go into AEM, we navigate to the Tools option, click on Cloud Services.

Then click on the Data Source option here. You select the folder in which you want your data source to reside. So in this case, I’ve selected global as the folder. And click on Create.

So, provide a meaningful name and a title to our data source. In this case, it’s going to be RetirementAccountStatement. You select a Service Type. This case is going to be a RESTful service, and then click on Next. So like I mentioned, every RESTful data source is backed by a Swagger file and you can either provide a URL of the Swagger file, or the physical file. So in this case, we’re going to select the physical file here, and browse to the Swagger file, which is residing on my hard drive.

And the name of the first Swagger file is RetirementStatement, I click on open, and then it shows you the various schemes available. So these are coming from the Swagger file. So does my Swagger file define the scheme called http That’s why it’s showing that. Then there’s a Host Name, and then there’s a Base Path, and then there’s an Authentication Type. Since our REST API does not need any authentication, we have selected None. But, data source configuration does allow you to configure RESTful APIs which use OAuth, or Basic Authentication, or a API key, or a custom authentication. In our case it’s going to be None. And then we click on Create.

So this is how you would create your data source, which is backed by a Swagger file.

Please use the swagger file provided to you as part of the assets related to this tutorial. The assets are available in introduction of this tutorial.

Next Steps

Create Form Data Model based on the data source

On this page