RESTful Services enable the declarative specification of RESTful services used to access the database. These services work with the Oracle Application Express Listener to enable the consumption of these services. This section describes how to create, edit and delete RESTful Services.
Note:
If the instance administrator has disabled RESTful Services for this Application Express instance, RESTful Services are not available for this instance and the RESTful Services icon does not display. See "Configuring SQL Workshop" in Oracle Application Express Administration Guide.Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. A service is described as RESTful when it conforms to the tenets of REST. Although a full discussion of REST is outside the scope of this document, a RESTful Service has the following characteristics:
Data is modelled as a set of resources. Resources are identified by URLs.
A small set of operations are used to manipulate resources (for example, PUT, POST, GET, DELETE).
A resource can have multiple representations (for example, a blog might have a HTML representation and a RSS representation).
Services are stateless and since it is likely that the client wants to access related resources, these should be identified in the representation returned, typically by providing hypertext links.
RESTful Services enable an application to publish Web services that are accessed by other applications to exchange data. For example, you can configure a RESTful Service to return all employee names for a particular department. The data exchange for a RESTful Service follows the Representational State Transfer (REST) architectural style.
For each Web service you want your application to provide, you must configure a RESTful Service Module. This module is a grouping of common templates, known as resource templates under a common Universal Resource Identifier (URI) prefix. For each method associated with the same resource template prefix that you want to expose through this Web service, you must define a resource handler. For instance, if you want to provide a method to return data and another to store data, you must define a resource handler for each operation.
When you create a RESTful Service, you supply the necessary information about the structure of the request, response and operation to be performed including:
A URI Template identifying the set of resources the service provides
One or more HTTP methods that the service supports along with the SQL query or PL/SQL block to be performed. There are four HTTP methods including GET, DELETE, POST and PUT. Only one hadler per HTTP method is permitted. For example, the empinfo
resource handler can only have one resrouce handler using GET, and only one using PUT.
HTTP Header values that should be bound to parameters of the query block
Parameters expected by the Web service
Type of input expected by the Web service
The format of the response
See Also:
For an example RESTful Web Service Module, see "About the Example RESTful Service Module (oracle.example.hr)"This section describes how to configure RESTful Services. If you want your application to use a Web service, you must configure RESTful Web References. See Implementing Web Services in Oracle Application Express Application Builder User's Guide.
In order for the RESTful Service utility to be available and function properly, the following requirements must be met:
The instance administrator must enable RESTful Services for this Application Express instance. See Oracle Application Express Administration Guide.
The Oracle Application Express Listener version 2.0 or higher must be used. The Oracle XML DB HTTP Server with the embedded PL/SQL gateway and Oracle HTTP Server with mod_plsql
do not support this functionality. See Oracle Application Express Listener Installation and Developer Guide.
To access RESTful Services:
Log in to the Workspace home page.
Click SQL Workshop.
Click RESTful Services.
The RESTful Services home page displays.
Your Application Express Workspace by default has an example RESTful Service Module, oracle.example.hr
. This module provides example resource templates and resource handlers that implement several different methods to retrieve and display employee information from the emp
table. To access the oracle.example.hr
module, see "Accessing RESTful Services".
See Also:
For additional RESTful Service examples, go to the Learning Library. Search for free online training content, including Oracle by Example (OBE), demos, and tutorials. To access the Oracle Learning Library, go to:The oracle.example.hr
module consists of several resource templates. Each resource template demonstrates a different way of retrieving information and formatting the returned results.
The following results are expected for each oracle.example.hr
resource template when the respective GET resource handler is invoked:
empinfo/
- Employee information from the employees emp
table is returned in CSV format. See "Returning the Result Set in CSV Format (empinfo/
)".
employees/{id}
- Employee information from the employees emp
table for a specified id
is returned. The curly bracket identifies the parameter sent as part of the URI. See "Retrieving Data Based on a Parameter (employees/{id}
)".
employees/
- Employee information from the employees emp
table is displayed in JSON format with Pagination Size set to 7. A first, previous and next link is provided to page through the results. See "Returning the Result Set in JSON Format with Pagination Set (employees/
)".
employeesfeed
/ - Employee information from the employees emp
table is displayed as a feed. See "Returning the Result Set as a Feed (employeesfeed
/)".
employeesfeed/{id}
- Employee information from the employees emp
table for a specified id
is displayed as a feed. The curly bracket identifies the parameter sent as part of the URI. See also "Retrieving Data Based on a Parameter (employees/{id}
)" and "Returning the Result Set as a Feed (employeesfeed
/)".
empsec/{empname}
- Employee information for a specified employee name, empname
, is returned and displayed in JSON. The curly bracket identifies the parameter sent as part of the URI. See also "Retrieving Data Based on a Parameter (employees/{id}
)".
empsecformat/{empname}
- Employee information for a specified employee name, empname
, is returned and formatted based on the execution of a PL/SQL block. The curly bracket identifies the parameter sent as part of the URI. See "Returning the Result Set Based on a PL/SQL Block (empsecformat/{empname}
)".
empinfo/
)The oracle.example.hr
module includes the empinfo/
resource template to demonstrate a RESTful Service that returns data in CSV format. In this example, all the employee data from the emp
table is returned by using a SQL Query.
To build and test your own example RESTful Service Module that retrieves data in CSV format:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click Create.
For Name, enter my.example.demo
.
For URI, enter demo/
. This is the base of the Uniform Resrouce Identifier (URI) that is used to access this RESTful Service.
Under Add a Resource Template, for URI Template enter empinfo/
.
Under Add a Resource Handler, for Method select GET.
The Resource Handler settings appear.
Make the following selections and entries:
Source Type - Select Query. Executes a SQL Query and transforms the result set into either a JavaScript Object Notation (JSON) or CSV representation, depending on the format selected. This option is only available when the HTTP method GET has been selected
Format - Select CSV.
Source - Enter the following:
select * from emp
Click Create Module.
The RESTful Service Module page displays.
Under empinfo
/, click the GET resource handler.
Click Test.
An Opening dialog appears, allowing you to open or save the CSV file containing the results of executing the resource handler source SQL query.
Select Save File and click OK.
Open the saved file in Microsoft Excel or another editor to view the contents of the CSV file.
All data from the emp
table is included in the CSV file.
Note:
If your results are not correct, compare yourempinfo
GET resource handler with the oracle.example.hr
empinfo
GET resource handler.Click Apply Changes.
employees/{id}
)The oracle.example.hr
module includes the employees/{id}
resource template to demonstrate a RESTful Service that returns one row of data in JSON format based on the specified id
.
For other example resource templates that return results based on a specified parameter see the employeesfeed/{id}
, empsec/{empname}
and empsecformat/{empname}
resource templates for the oracle.example.hr
Service Module.
To add and test your own resource template that retrieves employee data based on a parameter:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service Module you want to add the resource template to.
The RESTful Service Module page appears.
At the bottom of the left panel, click Create Template.
The Resource Template options appear on the right.
For URI Template, enter employees/{id}
.
Click Create.
The employees{id}
resource template displays on the left panel.
Under the employees{id}
resource template, click Create Handler.
The Resource Handler options appear.
Make the following selections and entries:
Method - select GET.
Source Type - select Query One Row. Executes a SQL Query returning one row of data into a JSON representation. This option is only available when the HTTP method GET has been selected
Requires Secure Access - select No.
Pagination Size - Enter blank
. In this case, there's no need to set pagination since only one record is retrieved.
Source - enter the following:
select * from emp where empno = :id
Click Create.
The GET Handler appears under the employees/{id}
resource template on the left panel.
Click Set Bind Variables.
For Bind Variable Value, enter 7876
.
Click Test.
A dialog appears showing the results for the employee record with an employee id of 7876 displays.
Note:
If your results are not correct, compare youremployees/{id}
GET resource handler with the oracle.example.hr
employees/{id}
GET resource handler.employees/
)The oracle.example.hr
module includes the employees/
resource template to demonstrate a RESTful Service that returns data in JSON format. This example demonstrates pagination by setting the pagination to a value smaller than the number of rows returned in the result.
For other example resource templates that return results in JSON format see the empsec/{empname}
resource template for the oracle.example.hr
Service Module.
To add and test your own resource template that retrieves data in JSON format and demonstrates pagination:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service Module you want to add the resource template to.
The RESTful Service Module page appears.
At the bottom of the left panel, click Create Template.
The Resource Template options appear on the right.
For URI Template, enter employees/
.
Click Create.
The employees/
resource template displays on the left panel.
Under the employees/
resource template, click Create Handler.
The Resource Handler options appear.
Make the following selections and entries:
Method - Select GET.
Source Type - Select Query.
Format - Select JSON.
Requires Secure Access - Select No.
Pagination Size - Enter 7
.
Source - Enter the following:
select empno "$uri", empno, ename from ( select emp.* , row_number() over (order by empno) rn from emp ) tmp where rn between :row_offset and :row_count
Click Create.
The GET Handler appears under the employees/
resource template on the left panel.
Click Test.
The JSON results display. Notice the uri:{$ref}
for each item invokes the employees/{id}
RESTful Service for the id specified in the link.
Note:
If your results are not correct, compare youremployees/
GET resource handler with the oracle.example.hr
employees
GET resource handler.Click the first uri:{$ref}
link in the link for empno
7369.
The individual employee record for 7369 displays.
Click the Back button in your browser.
The original JSON results appear listing 7 employees.
Click the next{$ref}
link to navigate to the next page of data.
The next 7 rows display with links to the first, previous and the next page.
employeesfeed
/)The oracle.example.hr
module includes the employeesfeed/
resource template to demonstrate a RESTful Service that returns empno
and ename
values from the emp
table and displays them as a feed.
A feed resource handler executes a SQL query and transforms the results into a JSON Feed representation. Each item in the feed contains a summary of a resource and a hyperlink to a full representation of the resource. The first column in each row in the result set must be a unique identifier for the row and is used to form a hyperlink of the form: path/to/feed/{id}, with the value of the first column being used as the value for {id}. The other columns in the row are assumed to summarize the resource and are included in the feed. A separate resource template for the full representation of the resource should also be defined.
For other example resource templates that return results as a feed, see the employeesfeed/{id}
resource template for the oracle.example.hr
Service Module.
To add and test your own resource template that displays return data as a feed:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service Module you want to add the resource template to.
The RESTful Service Module page appears.
At the bottom of the left panel, click Create Template.
The Resource Template options appear on the right.
For URI Template, enter employeesfeed/
.
Click Create.
The employeesfeed/
resource template displays on the left panel.
Under the employees resource template, click Create Handler.
The Resource Handler options appear.
Make the following selections and entries:
Method - select GET.
Source Type - select Feed.
Requires Secure Access - select No.
Pagination Size - enter 25
.
Source - enter the following:
select empno, ename from emp order by deptno, ename
Click Create.
The GET resource handler appears under the employeesfeed/
resource template on the left panel.
Click Test.
The results display a feed for each employee in the emp
table.
Note:
If your results are not correct, compare youremployeesfeed/
GET resource handler with the oracle.example.hr
employeesfeed
GET resource handler.empsecformat/{empname}
)The oracle.example.hr
module includes the empsecformat/{empname}
resource template to demonstrate a RESTful Service that returns the results of an SQL Query formatted by a PL/SQL block.
To add and test your own resource template that uses a PL/SQL block to format results:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service Module you want to add the resource template to.
The RESTful Service Module page appears.
At the bottom of the left panel, click Create Template.
The Resource Template options appear on the right.
For URI Template, enter empsecformat/{empname}
.
Click Create.
The empsecformat/{empname}
resource template displays on the left panel.
Under the empsecformat/{empname}
resource template, click Create Handler.
The Resource Handler options appear.
Make the following selections and entries:
Method - Select GET.
Source Type - Select PL/SQL.
Requires Secure Access - Select No.
Pagination Size - Enter blank
.
Source - enter the following:
DECLARE prevdeptno number; deptloc varchar2(30); deptname varchar2(30); CURSOR getemps IS select * from emp where ((select job from emp where ename = :empname) IN ('PRESIDENT', 'MANAGER')) or deptno = (select deptno from emp where ename = :empname) order by deptno, ename; BEGIN sys.htp.htmlopen; sys.htp.headopen; sys.htp.title('Departments'); sys.htp.headclose; sys.htp.bodyopen; for emprecs in getemps loop if emprecs.deptno != prevdeptno or prevdeptno is null then select dname, loc into deptname, deptloc from dept where deptno = (select deptno from emp where ename = emprecs.ename); if prevdeptno is not null then sys.htp.print('</ul>'); end if; sys.htp.print('Department ' || deptname || ' located in ' || deptloc || '<p/>'); sys.htp.print('<ul>'); end if; sys.htp.print('<li>' || emprecs.ename || ', ' || emprecs.job || ', ' || emprecs.sal || '</li>'); prevdeptno := emprecs.deptno; end loop; sys.htp.print('</ul>'); sys.htp.bodyclose; sys.htp.htmlclose; END;
Click Create.
The GET resource handler appears under the empsecformat/
{empname}
resource template on the left panel.
Click Set Bind Variables.
For the empname
parameter, enter ADAMS
.
Click Test.
The results display formatted results for Adams.
Note:
If your results are not correct, compare yourempsecformat/{empname}
GET resource handler with the oracle.example.hr
empsecformat/{empname}
GET resource handler.A RESTful Service Module is a grouping of common templates, known as resource templates, under a common Uniform Resource Identifiers (URI) prefix. The specification of a URI prefix is optional. If defined for the RESTful Service Module, it is prepended to all resource templates. A priority value is used to choose between resource templates when their patterns both match a single request URI. In such cases, the resource template with the highest priority value is chosen.
To create a RESTful Service Module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click Create.
Fill in the appropriate fields and select the appropriate options. Mandatory fields are marked with a red asterisk (*). To learn more about a specific option, see the item Help for that option.
Specify the following RESTful Service Module settings:
Name (required) - Specify the RESTful Service Module name.
URI Prefix - Specify the URI template prefix.
Origins Allowed - Specify a comma-separated list of origins that are permitted to access the resource template.
Status - Select Published to make this service available for use, otherwise select Not Published.
Pagination Size - Specify the size of the pagination window. For database queries, this is the number of rows to return.
Required Privilege - Select the user privilege required to access this service module.
To add a resource template to this module, specify the following under Add a Resource Template:
URI Template - Enter the URI template to identify your Uniform Resource Identifiers. A URI template is simple syntax for describing URIs, for example:
example/{id}
Priority - Specify the resource template's evaluation order. Higher numbers are evaluated first.
Entity Tag - Specify how the ETag HTTP Header for the resource is generated. See item Help for further details.
Entity Tag Query - Specify the SQL SELECT statement that returns one column and one row that is to be used to generate a custom entity tag. This option is only visible when the user selects Query for the Entity Tag.
If you want to add a resource handler to the resource template, specify the following under Add a Resource Handler:
Method - Specify the HTTP method to be used for the resource handler. Options include: GET, DELETE, POST, PUT. See item Help for further details.
Source Type - Select the source implementation for the selected HTTP method. Options include: Query, Query One Row, PL/SQL, Feed, Media Resource.
Format - Define how results are returned. Options include: JSON, CSV.
Source - Specify the SQL query or PL/SQL block responsible for handling the selected HTTP method.
Note:
To define additional resource handlers, complete the Resource Handler Creation wizard and then edit the created resource handler.Click Create.
The RESTful Service Module page appears.
A RESTful Service Module can have associated resource templates and resource handlers. During the edit process for a particular RESTful Service Module, you can make changes to any of the associated resource templates and resource handlers.
To edit a RESTful Service Module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the module you want to edit.
The RESTful Service Module edit page appears.
Note:
Use the RESTful Service tree on the left pane to view, edit and create resource templates and resource handlers.To edit RESTful Service Module settings, make changes to the fields on the right pane under RESTful Services Module. See "Creating a RESTful Service Module" for further details.
To edit a resource template:
Select the resource template you want to edit on the RESTful Service tree on the left panel. The resource template options appear on the right panel.
Make your changes. See"Adding a Resource Template" for further details.
Click Apply Changes.
To edit a resource handler:
Select the resource handler you want to edit on the RESTful Service tree. The resource handler options appear on the right panel.
Make your changes. See "Adding a Resource Handler" for further details.
Click Apply Changes.
Click Apply Changes
Deleting a RESTful service module removes the module along with all resource templates and resource handlers associated with this module.
To delete a RESTful Service Module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the module you want to delete.
The RESTful Service Module page appears.
Click Delete.
Click OK to confirm.
The RESTful Services home page appears.
Privileges to access RESTful Web Service Modules can be restricted to Application Express users that belong to an Application Express user group.
To protect RESTful Service Modules by assigning RESTful Service Privileges:
Define an Application Express user group using Application Express Administration. See Using Groups to Manage Application Express Users in Oracle Application Express Administration Guide.
Create a RESTful Service Privilege based on one or more user groups. See "Creating a RESTful Service Privilege".
Specify which RESTful Web Service Modules are protected by this privilege. See "Assigning Privileges to RESTful Web Service Modules".
There are a couple of ways to assign privileges to RESTful Web Service Modules:
During the creation or editing of a RESTful Web Service Module, you can specify the privilege for the module. See "Creating a RESTful Service Module" and "Editing a RESTful Service Module".
During the creation or editing of a RESTful Service Privilege, you can specify the module or modules protected by this privilege. See"Creating a RESTful Service Privilege" and "Editing a RESTful Service Privilege".
Note:
After a RESTful Service Privilege is deleted, all RESTful Service Modules protected by that privilege are unprotected. See "Deleting a RESTful Service Privilege".You can create a RESTful Service Privilege to restrict access to specified users for one or more RESTful Web Service modules. A RESTful Service Privilege can include users belonging to one or more user groups. RESTful Web Service modules protected by this privilege display the privilege name for Required Privilege on the RESTful Service Module page.
To create a RESTful Service Privilege:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Under Tasks, click the RESTful Services Privileges link.
The RESTful Service Privileges page appears.
Click Create.
The RESTful Service Privileges Details page appears.
For Name, enter a name to identify the privilege.
For Label, enter a label value to identify the privilege.
For Assigned Groups, select the user groups this privilege is assigned to.
For Description, enter a description of this privilege.
For Protected Modules, use the arrows to select the modules this privilege is assigned to.
Click Create.
The RESTful Service Privileges page appears.
To verify the privilege has been assigned to the appropriate modules:
Click RESTful Services in the breadcrumb.
The RESTful Services page appears.
Click the protected RESTful Service Module.
The RESTful Service Module page appears.
Make sure the Required Privilege displays the created RESTful Service Privilege.
Repeat these verification steps to ensure all modules assigned to this privilege are protected.
You can modify a RESTful Service Privilege. Changes to the specified Protected Modules will be reflected in the Required Privilege setting on the RESTful Service Module page for affected modules.
To edit a RESTful Service Privilege:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Under Tasks, click the RESTful Services Privileges link.
The RESTful Service Privileges page appears.
Click a RESTful Service Privilege.
The RESTful Service Privileges Details page appears.
Make modifications.
Click Apply Changes.
The RESTful Service Privileges page appears.
You can remove a RESTful Service Privilege. After deleting the privilege, any RESTful Service Modules that were protected by this privilege will be unprotected until reassigned another privilege.
To delete a RESTful Service Privilege:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Under Tasks, click the RESTful Services Privileges link.
The RESTful Service Privileges page appears.
Click a RESTful Service Privilege.
The RESTful Service Privileges Details page appears.
Click Delete.
The RESTful Service Privileges page appears.
RESTful Service Module meta data can be exported to a file in SQL script format. The exported file can be imported on the same instance or another compatible instance of Application Express. See "Importing a RESTful Service Module".
To export a RESTful Service module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Under Tasks, click the Export link.
The Export RESTful Services page appears.
For RESTful Service, perform one of the following:
To export one module, select the module name.
To export all modules, select All Services.
Click Export.
The Opening dialog appears.
Select export options.
Click OK.
RESTful Service Module meta data that has been exported to a file in SQL script format can be imported. The imported module must have been exported on the same instance or another compatible instance of Application Express. See "Exporting a RESTful Service Module".
Note:
If the imported module contains a RESTful Service name that exists in this workspace, the existing RESTful Service is deleted and replaced with the definition from the imported module.To import a RESTful Service module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Under Tasks, click the Import link.
The Import RESTful Services page appears.
For Import File, browse to and select the import file.
For File Character Set, select the character set used by the import file.
Click Import.
The RESTful Services page appears.
Resource templates are a means of grouping URIs and associating them with a particular RESTful Service Module. Resource templates can have one or more resource handlers. Only one resource handler per HTTP method is permitted. For example, a resource template can have only one GET method, only one DELETE method and so on.
To add a resource template to a RESTful Service Module:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service for which you want to create a resource template.
On the RESTful Service tree, click Create Template.
The resource template settings appear on the right panel.
Fill in the appropriate fields and select the appropriate options. Mandatory fields are marked with a red asterisk (*). To learn more about a specific option, see the item Help for that option.
Specify the following:
URI Template - Enter the URI template to identify your Uniform Resource Identifiers. A URI template is simple syntax for describing URIs, for example:
example/{id}
Priority - Specify the template's evaluation order. Higher numbers are evaluated first.
Entity Tag - Specify how the ETag HTTP Header for the resource is generated. See item Help for further details.
Entity Tag Query - Specify the SQL SELECT statement that returns one column and one row that is to be used to generate a custom entity tag. This option is only visible when the user selects Query for the Entity Tag.
Click Create.
To edit a resource template:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the module the resource template you want to edit belongs to.
The RESTful Service Module page appears.
On the RESTful Service tree, click the resource template you want to edit.
The selected resource template is highlighted on the RESTful Service tree and the corresponding resource template settings appear on the right panel.
Make the changes you want. See "Adding a Resource Template" for further details.
Click Apply Changes.
Deleting a resource template removes the template along with all resource handlers associated with this template.
To delete a resource template:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the module you want to update.
The RESTful Service Module page appears.
On the RESTful Service tree, click the resource template you want to delete.
The resource template settings appear on the right panel.
Click Delete.
Click OK to confirm.
The RESTful Service Module appears.
A resource handler is a query or an anonymous PL/SQL block responsible for handling a particular HTTP method. Multiple resource handlers can be defined for a resource template, however only one resource handler can be defined for a HTTP method.
Parameters to a resource handler can be manually defined to bind HTTP headers to the resource handler, or to cast a URI template parameter to a specific data type. Parameters declared in the URI template are implicitly passed to the resource handler. For example, a resource handler might need to know the value of the HTTP Accept-Language header in order to localize the generated representation.
To add a resource handler to a resource template:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the RESTful Service you want to add a resource handler to.
The RESTful Service Module page appears.
On the left panel, under the associated resource template, click Create Handler.
The resource handler settings appear on the right panel.
Fill in the appropriate fields and select the appropriate options. Mandatory fields are marked with a red asterisk (*). To learn more about a specific option, see the item Help for that option.
Under Resource Handler, specify the following:
Method - Specify the HTTP method to be used for the resource handler. See item Help for further details.
Source Type - Identify the strategy type used to generate the resource. See item help for further information.
Requires Secure Access - Identify whether the resource should be accessed over a secure channel, for example, HTTPS. Set to Yes if secure access is required
Pagination Size - Identify the size of the pagination window. For database queries, this is the number of rows to return.
Under Source, enter the SQL query or PL/SQL block responsible for handling the selected HTTP method. Click Example at the bottom of the page for further details.
To test the behavior of the resource handler:
Click Apply Changes.
If you have bind variables in your SQL query or PL/SQL block, click Set Bind Variables and define the bind variables before testing.
Click Test.
A new window appears displaying the JSON result of executing the RESTful Service. The URL used in the test is composed of the value of the URI prefix and URI Template, along with any parameters.
Note:
To make the test results easier to read, the installation of a JSON Viewer in your browser is recommended.Click Create.
The RESTful Services Module page appears.
To add parameters to the resource handler:
Click Create Parameter.
The parameter settings appear on the Resource Handler Parameter panel.
For Name, enter the identifying parameter name.
For Bind Variable Name, enter the parameter bind variable name used within the SQL query or PL/SQL block.
For Access Method, select the HTTP method. Options include IN, IN/OUT, or OUT. URI Template parameters can only be IN. A value of IN for a header parameter implies the header will be present in the HTTP request. A value of IN/OUT indicates the value will be present in both the HTTP request and response. A value of OUT indicates the value will only be present in the HTTP response.
For Source Type, select the parameter source type.
For Parameter Type, select the data type of the parameter.
Click Create.
The resource handler page appears with the added parameter included under Parameters at the bottom of the right panel.
For each parameter you want to add, repeat the above steps in this subsection.
To edit a resource handler:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the Resource Service Module the resource handler belongs to.
The RESTful Service Module page appears.
On the RESTful Service tree, click the resource handler you want to edit.
The resource handler settings appears on the right panel.
Make the changes you want. See "Adding a Resource Handler" for further details.
Click Apply Changes.
The RESTful Service Module page appears.
To delete a resource handler:
On the Workspace home page, click SQL Workshop and then RESTful Services.
The RESTful Services home page appears.
Click the name of the module the resource handler belongs to.
The RESTful Service Module page appears.
On the RESTful Service tree, click the resource handler you want to delete.
The resource handler settings appear on the right panel.
Click Delete.
Click OK to confirm.
The RESTful Service Module appears.