Implement RESTful Web Services with Oracle SQL Developer
Oracle SQL Developer is a free graphical tool that enhances productivity and simplifies database development tasks. Oracle REST Data Services (ORDS) is bundled with SQL Developer. You can use SQL Developer to implement RESTful web services in your Oracle Database Exadata Express Cloud Service.
Hands on Lab: AutoREST Enable Database Objects
Hands on Lab: REST Development using Oracle SQL Developer
Topics
To learn more about implementing RESTful Data Services using Oracle SQL Developer, see SQL Developer User’s Guide.
Install and Administering REST Data Services
Oracle REST Data Services (ORDS) is installed and configured for all the users in the Oracle Database Exadata Express Cloud Service by default.
As ORDS is installed and configured in the Exadata Express service, all the users for this service can directly start with developing RESTful web services without performing any kind of set up. The ORDS Administration features are restricted or unavailable for Exadata Express Cloud Service users, by default.
Auto REST Enabling Database Objects with Oracle SQL Developer
AUTO Rest enable allows you to make CRUD operations via REST on your tables and views. You can use a REST API to access, change, or delete data from your tables and views, without writing any code. You simply need to turn this on by REST enabling the schema and then, the desired tables and views. The ORDS service will then honor REST calls to the database objects, returning expected responses in a JSON format to the application or website. Once you REST enable a table, you can even use a series of predicates to do filtering and sorting on that table or view.
Auto REST enable a schema
Follow these steps to enable Auto REST on your schema in the Exadata Express service:
-
Using Oracle SQL Developer, connect to your Oracle Database Exadata Express Cloud Service. See Connect SQL Developer.
Note:
Connect to a development schema on your Exadata Express service database, for Auto REST Enabling it. -
Under Connections, right click your Exadata Express connection.
-
Click REST Services and select Enable REST Services.
The RESTful Services Wizard will appear.
-
Make the following selections, and click Next.
-
Select the check-box against Enable Schema.
-
Provide a value for Schema alias. This prevents from exposing your schema name to the ORDS consumers.
-
Select check-box against Authorization required. This helps you in securing your services, and preventing unauthorized access to your services.
-
-
Click Finish.
Auto REST enable a table
Follow these steps to enable Auto REST a table on your schema in the Exadata Express :
-
Using Oracle SQL Developer, connect to your Oracle Database Exadata Express Cloud Service. See Connect SQL Developer.
-
Under Connections, expand your Exadata Express connection.
-
Expand the tables in your connection, and right-click the table for which you want to enable Auto REST.
-
Select Enable REST Service.
The RESTful Services Wizard appears.
-
The RESTful Services Wizard will appear. Make the following selections, and click Next.
-
Select the check-box against Enable Object.
-
Provide a value for Object alias. This will be the name that is used in the Auto Rest URL to access this object. Therefore, this prevents exposing your object name to the ORDS consumers.
-
Select check-box against Authorization required. This helps you in ensuring that only authenticated users with the correct role can access this object.
-
-
Click Finish.
Develop RESTful Web Services with Oracle SQL Developer
The REST Data Services Development panel provides a graphical user interface for writing, testing, and publishing RESTful Services to Oracle REST Data Services. REST endpoints can be defined along with basic operations including create, query, update and delete. More complex SQL and PL/SQL operations can be defined and mapped. The ORDS service will then honor REST calls, returning expected responses in a JSON format to the application or website.
Perform the below tasks, to develop RESTful services with Oracle SQL Developer in your Oracle Database Exadata Express Cloud Service:
Note:
The steps outlined below are applicable to Oracle SQL Developer version 4.1.5. They might vary while working with any other versions above 4.1.5.-
Using Oracle SQL Developer, connect to your Oracle Database Exadata Express Cloud Service. See Connect SQL Developer.
-
Create a REST development connection from Oracle SQL Developer.
These are some of the important parameters to be entered as part of creating REST development connection for your database on Exadata Express service:-
Connection Name: Enter any name for your new connection. The name that you provide that uniquely identifies your connection.
-
Username: The ORDS development user name. This is the user you created while setting up your service.
-
Select
https
to specify that you will be using secure socket layer. -
Hostname: Service Console URL. You can get it from the service details on the Dashboard.
-
Port: 443 (Default port for
https
protocol. -
Server Path:
/apex
. This is the context root where ORDS is deployed. -
Schema/Workspace:
/<development schema name>/
. Enter the development schema within two forward slashes. This Schema must be REST enabled before using for REST Development.
-
-
Define Resource Module, Resource Template, and Resource Handler.
-
Add a query to the Resource Handler.
-
Upload Resource Module so that the RESTful services definition is updated on the server.
See Hands on Lab : REST Development using Oracle SQL Developer in Getting Started with Oracle REST Data Services Series on Oracle Learning Library.