In this article I am going to show you how to connect and query a REST Data Source. To begin with I have created a REST web service on Oracle 11g XE (Express Edition). Follow this LINK to create a REST web service in Oracle 11g.
After you have created the REST web service you would end up with REST-Style URL's like this
REST URL:
1. http://test:test@localhost:8080/xml_demo/rest-ws/emp
2. http://test:test@localhost:8080/xml_demo/rest-ws/emp/7900
The first URL consists of three parts
1.1 USERNAME:PASSWORD - test/test
1.2 BASE URL - http://localhost:8080
1.3 OPERATION URL - xml_demo/rest-ws/emp
The second URL consists of four parts
2.1 USERNAME:PASSWORD - test/test
2.2 BASE URL - http://localhost:8080
2.3 OPERATION URL - xml_demo/rest-ws/emp
2.4 URL_PARAMETERS - this parameter is an employee id and this value can be substituted at run time.
Let's see how to add a REST data source and get data from the REST data source.
1. LOGIN into Composite Studio with a user who has ACCESS_TOOLS Right.
2. Right-Click on a folder and from the drop-down list select 'New Data Source'
3. It opens up a pop-up window where you select the Data Source adapter. Select the REST adapter and click Next.
4. After you click Next you will have to provide the following information for the new Data Source:
Data Source Name - Provide any name you like
Base URL - http://localhost:8080
Login - test
Password - test
Click on Operations '+' tab
After you click on '+' another pop-up will appear where you enter the operation name (each Base URL can have any number of operations)
Enter the Operation URL:
For the first operation enter: xml_demo/rest-ws/emp and
For the second operation enter: xml_demo/rest-ws/emp/{emp_id} where emp_id is an input parameter
For the Second URL after you enter the operations URL hit Parse and it will update the URL Parameters tab.
Click the Create & Close tab which creates the Data Source and two operations.
These two operations can now be used to create views and can also be used in SQL Scripts (procedures).
1. http://test:test@localhost:8080/xml_demo/rest-ws/emp
2. http://test:test@localhost:8080/xml_demo/rest-ws/emp/7900
The first URL consists of three parts
1.1 USERNAME:PASSWORD - test/test
1.2 BASE URL - http://localhost:8080
1.3 OPERATION URL - xml_demo/rest-ws/emp
The second URL consists of four parts
2.1 USERNAME:PASSWORD - test/test
2.2 BASE URL - http://localhost:8080
2.3 OPERATION URL - xml_demo/rest-ws/emp
2.4 URL_PARAMETERS - this parameter is an employee id and this value can be substituted at run time.
Let's see how to add a REST data source and get data from the REST data source.
1. LOGIN into Composite Studio with a user who has ACCESS_TOOLS Right.
2. Right-Click on a folder and from the drop-down list select 'New Data Source'
3. It opens up a pop-up window where you select the Data Source adapter. Select the REST adapter and click Next.
4. After you click Next you will have to provide the following information for the new Data Source:
Data Source Name - Provide any name you like
Base URL - http://localhost:8080
Login - test
Password - test
Click on Operations '+' tab
After you click on '+' another pop-up will appear where you enter the operation name (each Base URL can have any number of operations)
Enter the Operation URL:
For the first operation enter: xml_demo/rest-ws/emp and
For the second operation enter: xml_demo/rest-ws/emp/{emp_id} where emp_id is an input parameter
For the Second URL after you enter the operations URL hit Parse and it will update the URL Parameters tab.
Click the Create & Close tab which creates the Data Source and two operations.
These two operations can now be used to create views and can also be used in SQL Scripts (procedures).
7 comments:
Can you provide an example with some public REST api?
HI,
Please check this article "http://composite-training.blogspot.in/2015/07/connecting-to-public-rest-api-in-cis.html"
Thanks,
Rajesh
I have created Rest Webservices connection with parameters enabled. can you please let me know how do i call in CIS SQL Script?
Hi,
As simple as this:
PROCEDURE GOOGLE_REST_API_SCRIPT( OUT OUTPUT_GOOGLE_API LONGVARCHAR)
BEGIN
CALL /users/admin/GOOGLE_REST_API/GOOGLE_API_OP('San Diego', OUTPUT_GOOGLE_API);
END
Data Source Name: GOOGLE_REST_API
Operation Name: GOOGLE_API_OP
INPUT Parameter: San Diego
OUTPUT Parameter: OUTPUT_GOOGLE_API
For more information on connecting to PUBLIC Available API Please see this Post Titled "Connecting to a Public REST API in CIS"
Thanks,
Rajesh
thank's info
nice thanks for share.
regard
from your followers
I think this is a very descriptive blog post about SQL and REST API.
Powerbi Read Rest
Post a Comment