Switch branches/tags
Nothing to show
Find file History
thatjeffsmith adding 13 files for ords examples
adding examples for using parameters in your RESTful Services
Latest commit fdf66f2 Jan 30, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Parameters adding 13 files for ords examples Jan 30, 2018
rest-sql Changed Examples Sep 13, 2017
READme.md adding 13 files for ords examples Jan 30, 2018
swagger.png adding 13 files for ords examples Jan 30, 2018

READme.md

ords-sql-examples

Scripts that demonstrate RESTful Services with Oracle REST Data Services (ORDS).

We also have a set of examples for the REST Enabled SQL feature here.

Prerequisites

You will need at least a browser to work with the simple GET examples. You will also need a REST client such as Postman or cURL.

Download from OTN: ORDS & Oracle SQL Developer

Required: Download ORDS

Required: Download SQLDev

Required: Install ORDS, configure for an Oracle Database (11gR2 or higher), REST enable a schema.

REST Enabling a Schema

RESTful Services are defined in the schema from which the services will run. For example, a service mapped to /ords/hr/ will run as the HR user, therefore inheriting the privileges defined for that Oracle user account.

This code sample will REST enable the HR schema, therefore allowing RESTful Services to be defined in the HR schema, and for those said services to be executed as the HR user.

BEGIN
 ORDS.ENABLE_SCHEMA(p_enabled => TRUE,
                   p_schema => 'HR',
                   p_url_mapping_type => 'BASE_PATH',
                   p_url_mapping_pattern => 'hr',
                   p_auto_rest_auth => FALSE);

 commit; 
END;

To access services on this REST enabled schema, you would use this URI pattern to get started:

https://host:port/ords/hr -- where 'hr' is the p_url_mapping_pattern value.

To access a list of the available services on a schema, use the /metadata-catalog/ endpoint:

https://host:port:/ords/hr/metadata-catalog/

This endpoint returns a JSON document. Each RESTful Services module also includes a /open-api-catalog/ endpoint which supports the Open API 2.0 (Swagger) Spec.

On Security

For simplicity, many of the examples here are presented unsecured. This is not recommended for production deployments. ORDS supports many authentication schemes, including OAuth2 and first party auth, and we plan on delivering example scenarios to showcase securing your services specifically.