Consuming Query and Path Parameter in REST DC
By Alex Mathew on Jan 15, 2014
In this blog I will explain on how to configure the REST DC when there are Query and Path Parameters present in the Service that is to be consumed.
The Query and Path parameters in the DC are exposed as method Input Parameters in the DC palette allowing the user for easy Drag and Drop.
JDeveloper Version : 12.1.2
Configuring Query Parameters
Service API Uri:
In this Uri ‘name’ is a Query Parameter which will be used to delete a specific record, to expose this follow the below steps
1. Invoke the Rest DC and create the connection
2. In the Resources tab, enter the remaining resource uri without providing the ‘?name=’ as shown below
3. In the Method Details tab select the delete method, and in the URL Parameters panel click on ‘+’ and enter the parameter details.
Provide an Default value which will be invoked whenever the service is loaded
Providing a Valid Default Value becomes crucial when there is a GET with Query Param for which you would like the XSD to be generated by the Jdeveloper itself.
Configuring Path Parameters
In the above case ‘7’ is an customer id value based on which the specific customer record will be fetched, so this customer id is dynamic so we will be discussing on how to expose this as an dynamic field in the REST DC
1. Invoke the Rest DC and create the Connection with Server details as mentioned in the Step 1 for the Query Parameter
2. In the Resources Tab, enter the resource url and select the Method type , provide an valid name for the method
Here we can observe that Instead of the Value 7 we have provided that field as ##CustomerId##, now click on Next.
3. In the Method Details page, the ##CustomerId## is exposed in the URL Attributes panel, provide the default value of the Customer Id , Click Next
4. Now In this case , I have not provided the Response XSD which will be auto generated by the Jdeveloper and the DC palette will look as shown below after completing the wizard