SlideShare a Scribd company logo
1 of 40
Download to read offline
All about
Oracle
REST Data Services
07-Jul-2018
aioug
2
Agenda
❖ REST Overview
❖ Introduction to ORDS
❖ ORDS Architecture
❖ ORDS APIs for PLSQL Developers
❖ Securing the REST APIs
❖ Use Cases with Demo
REST Overview
3
REST Overview
4
❖ REST stands for Representational State Transfer
● It is an architectural pattern for developing web services
as opposed to a specification.
● REST web services communicate over the HTTP specification.
● REST uses HTTP vocabulary:
❏ Methods (GET, POST, PUT, DELETE, etc.,)
❏ HTTP URI syntax (paths, parameters, etc.,)
❏ Media types (xml, json, html, plain text, etc.,)
❏ HTTP Response codes (200, 404, 503 etc.,)
REST Overview
5
❖ Representational
● Clients possess the information necessary to identify,
modify, and/or delete a web resource.
❖ State
● All resource state information is stored on the client.
❖ Transfer
● Client state is passed from the client to the service through
HTTP.
[contd.,]
REST Overview
6
Standard HTTP Methods
❖ GET
● CRUD Operation : Retrieve
● Usage: Retrieving a resource
❖ PUT
● CRUD Operation : Update
● Usage: Creating or updating a resource at a known URI
❖ DELETE
● CRUD Operation : Delete
● Usage: Deleting a resource
❖ POST
● CRUD Operation : Create
● Usage: Creating a resource within a collection (URI set by server)
[contd.,]
ORDS Overview
7
Oracle REST Data Services
8
❖ Consistent data access with modern App Dev frameworks
● Mid tier application
● Can map standard http(s) RESTful requests to SQL
● Can declaratively returns results in JSON format
● JavaScript friendly and Highly scalable
● Can connect to Oracle NoSQL and Oracle container databases in Cloud
❖ Services
● Formally known as Oracle APEX Listener
● Access to Relational data over HTTP(s) without installing JDBC/ODBC drivers
● Oracle JSON collection based schema-less access
● Comes along with Oracle Database 12.1.0.2 and above
● New features supports CSV data and Batch load operations
● Supports Swagger based Open API integration
Architecture
❖ JSON from Database
● ORDS creates an URL for the SQL defined as REST api
● ORDS uses the UCP framework for database connectivity. This helps in mapping and
binding the URL with the SQL.
● ORDS uses Jackson libraries for converting SQL Resultset to JSON and vice-versa.
9
PublishDeployConfigureDownload
10
Download latest
version of ORDS
from OTN
Configure ORDS
parameters,
database accounts
and url mappings
Deploy ords.war to
the server or use
standalone mode
Use ORDS apis to
expose database
objects as REST
services
Implement ORDS
Download ORDS
http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html
11
Installation
● Unzip downloaded ORDS content into a folder. This path is referred as /<ORDS_BASE>
● Create a folder to store ORDS configurations - /<ORDS_BASE>/conf
● Update the ORDS parameter file - /<ORDS_BASE>/params/ords_params.properties
● Setup conf path as configuration directory, java -jar ords.war configdir c:myworkordsconf
● Run installation command, java -jar ords.war install advanced
12
Simple
ORDS installation with default parameters. This will reuse existing APEX installation and
metadata.
java -jar ords.war install simple
Advanced
ORDS installation with all necessary parameters. Options available for using APEX
installation and metadata.
java -jar ords.war install advanced
Standalone
Suitable for development use only, and is not supported for use in production deployments.
SQL Developer is used to install and manage ORDS Standalone application.
Post - Installation
13
❖ ORDS schema created,
● ORDS_METADATA - Stores the metadata about ORDS enabled schemas
● ORDS_PUBLIC_USER - Invoking RESTful services in ORDS enabled schemas
❖ Database Connection setup,
● Create Database connection,
java -jar ords.war setup --database <db_name>
● Setup URL mapping,
java -jar ords.war map-url --type base-path /<db_name> <db_name>
❖ Verify configuration files created under <ords_base>/conf directory
defaults.xml, url-mapping.xml
<db_name>.xml, <db_name>_pu.xml, <db_name>_al.xml, <db_name>_rt.xml
❖ Deploy ords.war file in Tomcat server
ords_params.properties
14
db.hostname=localhost
db.port=1521
db.servicename=orcl
db.username=ORDS_PUBLIC_USER
migrate.apex.rest=false
plsql.gateway.add=true
rest.services.apex.add=true
rest.services.ords.add=true
schema.tablespace.default=SYSAUX
schema.tablespace.temp=TEMP
standalone.http.port=8888
standalone.mode=true
standalone.use.https=false
user.apex.listener.password=@0588BF3B45D5497836A44AF3A3335B0D2AC30F2284C381888D
user.apex.restpublic.password=@056941E5E7725536B4D021C3DAC3BD9FFAE77983A1F1970F8F
user.public.password=@0539A9876E99F380D7CDA1B619920A81BD7F048D85D58C0751
user.tablespace.default=USERS
user.tablespace.temp=TEMP
ORDS - URL Structure
http://localhost:8888/ords/orcl/hr/payroll/dept/:dept_id
15
ORDS - URL Structure
21
http://localhost:8888/ords/orcl/hr/payroll/dept/:dept_id
base url / context / database / schema / module / template
Enable Schema & Define Module
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
);
ORDS.define_module
( p_module_name => 'payroll'
, p_base_path => 'payroll/'
, p_items_per_page => 10
);
COMMIT;
END; 22
ORDS Metadata:
ORDS_SCHEMAS
ORDS_URL_MAPPINGS
ORDS_MODULES
BEGIN
ORDS.define_template
( p_module_name => 'payroll'
, p_pattern => 'dept/'
);
ORDS.define_handler
( p_module_name => 'payroll'
, p_pattern => 'dept/'
, p_method => 'GET'
, p_source_type => ORDS.source_type_query
, p_source => 'SELECT * FROM departments'
, p_items_per_page => 5
);
COMMIT;
END;
Define SQL as REST service
23
http://localhost:8888/ords/orcl/hr/payroll/dept/
ORDS Metadata:
ORDS_TEMPLATES
ORDS_HANDLERS
BEGIN
ORDS.define_template
( p_module_name => 'payroll'
, p_pattern => 'getEmpName/:emp_id'
);
ORDS.define_handler
( p_module_name => 'payroll'
, p_pattern => 'getEmpName/:emp_id'
, p_method => 'GET'
, p_source_type => ORDS.source_type_plsql
, p_source => 'begin emp_pkg.get_emp_name(:emp_id); end;'
, p_items_per_page => 5
);
COMMIT;
END;
PLSQL as REST service
24
http://localhost:8888/ords/orcl/hr/payroll/getEmpName/:emp_id
Note:
OWA_UTIL, HTP apis are used inside
PLSQL procedure to return back to
the http request
BEGIN
ORDS.define_template
( p_module_name => 'payroll'
, p_pattern => 'createEmp/'
);
ORDS.define_handler
( p_module_name => 'payroll'
, p_pattern => 'createEmp/'
, p_method => 'POST'
, p_source_type => ORDS.source_type_plsql
, p_source => 'BEGIN emp_pkg.insert_emp ( p_emp_id => :emp_id, ... ); END;'
, p_items_per_page => 0
);
COMMIT;
END;
PLSQL with JSON
25
http://localhost:8888/ords/orcl/hr/payroll/createEmp/
Payload:
{"emp_id":300
,"fname":"Justin", "lname": "Michael Raj“
,"email":"justin@orcl.com"
,"phone":"9234567890","doj":"01-JAN-2010“
,"job":"SA_REP","sal":5000,"comm": 0.25
,"mgr_id":145,"dept_id":80
}
source_type_query - json/query
source_type_plsql - plsql/block
source_type_csv_query - csv/query
source_type_query_one_row - json/query;type=single
source_type_feed - json/query;type=feed
source_type_media - resource/lob
source_type_collection_feed - json/collection
source_type_collection_item - json/item
p_source_type
26
AutoREST
27
Enable AutoREST
28
BEGIN
ORDS.enable_object
( p_enabled => TRUE
, p_schema => 'HR'
, p_object => 'JOBS'
, p_object_type => 'TABLE'
, p_object_alias => 'jobs'
);
COMMIT;
END;
http://localhost:8888/ords/orcl/hr/metadata-catalog/jobs
ORDS Metadata:
ORDS_OBJECTS
AutoREST - SQL Operations
29
❖ SELECT
Method : GET
http://localhost:8888/ords/orcl/hr/jobs/AC_MGR
http://localhost:8888/ords/orcl/hr/jobs?q={“job_id”:”AC_MGR”}
http://../orcl/hr/jobs?q={"min_salary":{"$gte":1500}, "$orderby":{"job_id":"desc"}}
❖ INSERT
Method : POST
Post JSON content as RAW payload
http://localhost:8888/ords/orcl/hr/jobs
Payload:
{"job_id":"IT_CONS“
,"job_title":"IT Consultant“
,"min_salary":40000
,"max_salary":100000}
AutoREST - SQL Operations
30
❖ UPDATE
Method : PUT
Post JSON content as RAW payload
http://localhost:8888/ords/orcl/hr/jobs/IT_CONS
❖ DELETE
Method : DELETE
http://localhost:8888/ords/orcl/hr/jobs/IT_CONS
[contd.,]
Payload:
{"job_title":"IT Consultant“
,"min_salary":45000
,"max_salary":150000}
❖ Batchload enables loading CSV data into the AutoREST enabled tables.
❖ Only POST method is supported
❖ First line in the CSV should contain the Column names
❖ Date format in the csv data can be specified using the query parameter dateFormat
❖ Sample URL for batchload operation is,
http://localhost:8888/ords/orcl/hr/jobs/batchload?dateFormat="DD/MM/YYYY hh24:mi“
Payload:
job_id,job_title,min_salary,max_salary,created_date
IT_CONS1,Junior IT Consultant,1000,5000,01/01/2018 13:25
IT_CONS2,IT Consultant,3000,8000,02/01/2018 21:54
IT_CONS3,Senior IT Consultant,7000,12000,03/01/2018 09:15
AutoREST - Batchload
31
Security
32
API Security & Authentication
33
Types of Authentication supported by ORDS
❖ First Party Authentication or Basic Authentication
● Create ORDS user and assign roles and privileges to access the API
❖ OAuth 2.0
● Resource Owner Credentials
● Client Credentials
● Authorization Code
● Implicit Code
OAuth 2.0
❖ The OAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) defines flows to
provide conditional and limited access to a RESTful API.
❖ OAuth 2.0 Authentication Flow types,
● Authorization Code
❏ This is for web applications having its own web server where the client
credentials can be stored. The application can use a refresh token to extend
the period of access to the api.
● Client Credentials
❏ Gives an application direct access to a RESTful API without requiring a user to
approve access to the data managed by the RESTful API.
● Implicit Code
❏ This is suitable for Single Page Applications where client credentials cannot
be stored.
API Security & Authentication
34
[contd.,]
OAuth 2.0 – Authentication Flows
35
OAuth 2.0 – Authentication Flows
36
OAuth 2.0 – Authentication Flows
37
OAuth 2.0 – Authentication Flows
38
ORDS - Roles and Privileges
39
Role
Privileges
URL mapping
Register User in ORDS
Access the REST APIs
using this username
and password
User Client
Register client in ORDS
to generate CLIENT_ID
& CLIENT_SECRET
Use these to get Access
Token for accessing the
REST API
Basic Authentication OAuth 2.0
ORDS - Roles and Privileges
40
❖ Define ORDS Role
BEGIN
ORDS.create_role
( p_role_name => 'hrms_role' );
COMMIT;
END;
❖ Define Privilege
DECLARE
l_arr OWA.vc_arr;
BEGIN
l_arr(1) := 'hrms_role';
ORDS.define_privilege
( p_privilege_name => 'hrms_prv'
, p_roles => l_arr
, p_label => 'HRMS Privilege'
, p_description => 'Access to HRMS apis' );
COMMIT;
END;
ORDS Metadata:
SEC_ROLES
SEC_PRIVILEGES
SEC_PRIVILEGE_ROLES
USER_ORDS_ROLES
USER_ORDS_PRIVILEGES
USER_ORDS_PRIVILEGE_ROLES
[contd.,]
ORDS - Privilege mapped to URL
41
❖ Map the Privilege to an URL pattern
BEGIN
ORDS.create_privilege_mapping
( p_privilege_name => 'hrms_prv'
, p_pattern => '/hrms/*'
);
COMMIT;
END;
ORDS Metadata:
ORDS_PRIVILEGE_MAPPINGS
USER_ORDS_PRIVILEGE_MAPPINGS
ORDS - Basic Authentication
42
❖ Create ORDS user with password.
Execute this command from <ORDS_BASE> path.
java -jar ords.war user hrms_usr hrms_role
❖ Credentials file is created for Basic Authentication
/<ORDS_BASE>/conf/ords/credentials
Demo…
46
Questions ?
47
Thank You
Hariharaputhran & Justin Michael Raj
AIOUG Evangelists

More Related Content

What's hot

ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESLudovico Caldara
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceEnkitec
 
Understanding Oracle RAC 11g Release 2 Internals
Understanding Oracle RAC 11g Release 2 InternalsUnderstanding Oracle RAC 11g Release 2 Internals
Understanding Oracle RAC 11g Release 2 InternalsMarkus Michalewicz
 
Standard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & HowStandard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & HowMarkus Michalewicz
 
Service everywhere using oracle integration repository
Service everywhere using oracle integration repositoryService everywhere using oracle integration repository
Service everywhere using oracle integration repositoryPavan B
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Glen Hawkins
 
Oracle RAC 19c with Standard Edition (SE) 2 - Support Update
Oracle RAC 19c with Standard Edition (SE) 2 - Support UpdateOracle RAC 19c with Standard Edition (SE) 2 - Support Update
Oracle RAC 19c with Standard Edition (SE) 2 - Support UpdateMarkus Michalewicz
 
Preparing for EBS R12.2-upgrade-full
Preparing for EBS R12.2-upgrade-fullPreparing for EBS R12.2-upgrade-full
Preparing for EBS R12.2-upgrade-fullBerry Clemens
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Andrejs Prokopjevs
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationDimitri Gielis
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Ludovico Caldara
 
Oracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes ClusterOracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes Clustervasuballa
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionMarkus Michalewicz
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Understand oracle real application cluster
Understand oracle real application clusterUnderstand oracle real application cluster
Understand oracle real application clusterSatishbabu Gunukula
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperJeff Smith
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadatarehaniltifat
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasKyle Hailey
 
Calling SOAP and REST API's from PL/SQL
Calling SOAP and REST API's from PL/SQLCalling SOAP and REST API's from PL/SQL
Calling SOAP and REST API's from PL/SQLvenkata20k
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19cMaria Colgan
 

What's hot (20)

ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
Understanding Oracle RAC 11g Release 2 Internals
Understanding Oracle RAC 11g Release 2 InternalsUnderstanding Oracle RAC 11g Release 2 Internals
Understanding Oracle RAC 11g Release 2 Internals
 
Standard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & HowStandard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & How
 
Service everywhere using oracle integration repository
Service everywhere using oracle integration repositoryService everywhere using oracle integration repository
Service everywhere using oracle integration repository
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive
 
Oracle RAC 19c with Standard Edition (SE) 2 - Support Update
Oracle RAC 19c with Standard Edition (SE) 2 - Support UpdateOracle RAC 19c with Standard Edition (SE) 2 - Support Update
Oracle RAC 19c with Standard Edition (SE) 2 - Support Update
 
Preparing for EBS R12.2-upgrade-full
Preparing for EBS R12.2-upgrade-fullPreparing for EBS R12.2-upgrade-full
Preparing for EBS R12.2-upgrade-full
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integration
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?
 
Oracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes ClusterOracle E-Business Suite on Kubernetes Cluster
Oracle E-Business Suite on Kubernetes Cluster
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion Edition
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Understand oracle real application cluster
Understand oracle real application clusterUnderstand oracle real application cluster
Understand oracle real application cluster
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL Developer
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aas
 
Calling SOAP and REST API's from PL/SQL
Calling SOAP and REST API's from PL/SQLCalling SOAP and REST API's from PL/SQL
Calling SOAP and REST API's from PL/SQL
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 

Similar to ORDS - Oracle REST Data Services

REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...Ivanti
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemdelagoya
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
configuring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+serverconfiguring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+serverhunghtc83
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couchdelagoya
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSCosmin Mereuta
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...NomanKhalid56
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHPZoran Jeremic
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actionsAren Zomorodian
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
About REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары SoftengiAbout REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары SoftengiSoftengi
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011Shreedhar Ganapathy
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 

Similar to ORDS - Oracle REST Data Services (20)

REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problem
 
Rest
RestRest
Rest
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
configuring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+serverconfiguring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+server
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couch
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Oracle Cloud As Services
Oracle Cloud As ServicesOracle Cloud As Services
Oracle Cloud As Services
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Practical OData
Practical ODataPractical OData
Practical OData
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
About REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары SoftengiAbout REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары Softengi
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

ORDS - Oracle REST Data Services

  • 1. All about Oracle REST Data Services 07-Jul-2018 aioug
  • 2. 2 Agenda ❖ REST Overview ❖ Introduction to ORDS ❖ ORDS Architecture ❖ ORDS APIs for PLSQL Developers ❖ Securing the REST APIs ❖ Use Cases with Demo
  • 4. REST Overview 4 ❖ REST stands for Representational State Transfer ● It is an architectural pattern for developing web services as opposed to a specification. ● REST web services communicate over the HTTP specification. ● REST uses HTTP vocabulary: ❏ Methods (GET, POST, PUT, DELETE, etc.,) ❏ HTTP URI syntax (paths, parameters, etc.,) ❏ Media types (xml, json, html, plain text, etc.,) ❏ HTTP Response codes (200, 404, 503 etc.,)
  • 5. REST Overview 5 ❖ Representational ● Clients possess the information necessary to identify, modify, and/or delete a web resource. ❖ State ● All resource state information is stored on the client. ❖ Transfer ● Client state is passed from the client to the service through HTTP. [contd.,]
  • 6. REST Overview 6 Standard HTTP Methods ❖ GET ● CRUD Operation : Retrieve ● Usage: Retrieving a resource ❖ PUT ● CRUD Operation : Update ● Usage: Creating or updating a resource at a known URI ❖ DELETE ● CRUD Operation : Delete ● Usage: Deleting a resource ❖ POST ● CRUD Operation : Create ● Usage: Creating a resource within a collection (URI set by server) [contd.,]
  • 8. Oracle REST Data Services 8 ❖ Consistent data access with modern App Dev frameworks ● Mid tier application ● Can map standard http(s) RESTful requests to SQL ● Can declaratively returns results in JSON format ● JavaScript friendly and Highly scalable ● Can connect to Oracle NoSQL and Oracle container databases in Cloud ❖ Services ● Formally known as Oracle APEX Listener ● Access to Relational data over HTTP(s) without installing JDBC/ODBC drivers ● Oracle JSON collection based schema-less access ● Comes along with Oracle Database 12.1.0.2 and above ● New features supports CSV data and Batch load operations ● Supports Swagger based Open API integration
  • 9. Architecture ❖ JSON from Database ● ORDS creates an URL for the SQL defined as REST api ● ORDS uses the UCP framework for database connectivity. This helps in mapping and binding the URL with the SQL. ● ORDS uses Jackson libraries for converting SQL Resultset to JSON and vice-versa. 9
  • 10. PublishDeployConfigureDownload 10 Download latest version of ORDS from OTN Configure ORDS parameters, database accounts and url mappings Deploy ords.war to the server or use standalone mode Use ORDS apis to expose database objects as REST services Implement ORDS
  • 12. Installation ● Unzip downloaded ORDS content into a folder. This path is referred as /<ORDS_BASE> ● Create a folder to store ORDS configurations - /<ORDS_BASE>/conf ● Update the ORDS parameter file - /<ORDS_BASE>/params/ords_params.properties ● Setup conf path as configuration directory, java -jar ords.war configdir c:myworkordsconf ● Run installation command, java -jar ords.war install advanced 12 Simple ORDS installation with default parameters. This will reuse existing APEX installation and metadata. java -jar ords.war install simple Advanced ORDS installation with all necessary parameters. Options available for using APEX installation and metadata. java -jar ords.war install advanced Standalone Suitable for development use only, and is not supported for use in production deployments. SQL Developer is used to install and manage ORDS Standalone application.
  • 13. Post - Installation 13 ❖ ORDS schema created, ● ORDS_METADATA - Stores the metadata about ORDS enabled schemas ● ORDS_PUBLIC_USER - Invoking RESTful services in ORDS enabled schemas ❖ Database Connection setup, ● Create Database connection, java -jar ords.war setup --database <db_name> ● Setup URL mapping, java -jar ords.war map-url --type base-path /<db_name> <db_name> ❖ Verify configuration files created under <ords_base>/conf directory defaults.xml, url-mapping.xml <db_name>.xml, <db_name>_pu.xml, <db_name>_al.xml, <db_name>_rt.xml ❖ Deploy ords.war file in Tomcat server
  • 15. ORDS - URL Structure http://localhost:8888/ords/orcl/hr/payroll/dept/:dept_id 15
  • 16. ORDS - URL Structure 21 http://localhost:8888/ords/orcl/hr/payroll/dept/:dept_id base url / context / database / schema / module / template
  • 17. Enable Schema & Define Module 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 ); ORDS.define_module ( p_module_name => 'payroll' , p_base_path => 'payroll/' , p_items_per_page => 10 ); COMMIT; END; 22 ORDS Metadata: ORDS_SCHEMAS ORDS_URL_MAPPINGS ORDS_MODULES
  • 18. BEGIN ORDS.define_template ( p_module_name => 'payroll' , p_pattern => 'dept/' ); ORDS.define_handler ( p_module_name => 'payroll' , p_pattern => 'dept/' , p_method => 'GET' , p_source_type => ORDS.source_type_query , p_source => 'SELECT * FROM departments' , p_items_per_page => 5 ); COMMIT; END; Define SQL as REST service 23 http://localhost:8888/ords/orcl/hr/payroll/dept/ ORDS Metadata: ORDS_TEMPLATES ORDS_HANDLERS
  • 19. BEGIN ORDS.define_template ( p_module_name => 'payroll' , p_pattern => 'getEmpName/:emp_id' ); ORDS.define_handler ( p_module_name => 'payroll' , p_pattern => 'getEmpName/:emp_id' , p_method => 'GET' , p_source_type => ORDS.source_type_plsql , p_source => 'begin emp_pkg.get_emp_name(:emp_id); end;' , p_items_per_page => 5 ); COMMIT; END; PLSQL as REST service 24 http://localhost:8888/ords/orcl/hr/payroll/getEmpName/:emp_id Note: OWA_UTIL, HTP apis are used inside PLSQL procedure to return back to the http request
  • 20. BEGIN ORDS.define_template ( p_module_name => 'payroll' , p_pattern => 'createEmp/' ); ORDS.define_handler ( p_module_name => 'payroll' , p_pattern => 'createEmp/' , p_method => 'POST' , p_source_type => ORDS.source_type_plsql , p_source => 'BEGIN emp_pkg.insert_emp ( p_emp_id => :emp_id, ... ); END;' , p_items_per_page => 0 ); COMMIT; END; PLSQL with JSON 25 http://localhost:8888/ords/orcl/hr/payroll/createEmp/ Payload: {"emp_id":300 ,"fname":"Justin", "lname": "Michael Raj“ ,"email":"justin@orcl.com" ,"phone":"9234567890","doj":"01-JAN-2010“ ,"job":"SA_REP","sal":5000,"comm": 0.25 ,"mgr_id":145,"dept_id":80 }
  • 21. source_type_query - json/query source_type_plsql - plsql/block source_type_csv_query - csv/query source_type_query_one_row - json/query;type=single source_type_feed - json/query;type=feed source_type_media - resource/lob source_type_collection_feed - json/collection source_type_collection_item - json/item p_source_type 26
  • 23. Enable AutoREST 28 BEGIN ORDS.enable_object ( p_enabled => TRUE , p_schema => 'HR' , p_object => 'JOBS' , p_object_type => 'TABLE' , p_object_alias => 'jobs' ); COMMIT; END; http://localhost:8888/ords/orcl/hr/metadata-catalog/jobs ORDS Metadata: ORDS_OBJECTS
  • 24. AutoREST - SQL Operations 29 ❖ SELECT Method : GET http://localhost:8888/ords/orcl/hr/jobs/AC_MGR http://localhost:8888/ords/orcl/hr/jobs?q={“job_id”:”AC_MGR”} http://../orcl/hr/jobs?q={"min_salary":{"$gte":1500}, "$orderby":{"job_id":"desc"}} ❖ INSERT Method : POST Post JSON content as RAW payload http://localhost:8888/ords/orcl/hr/jobs Payload: {"job_id":"IT_CONS“ ,"job_title":"IT Consultant“ ,"min_salary":40000 ,"max_salary":100000}
  • 25. AutoREST - SQL Operations 30 ❖ UPDATE Method : PUT Post JSON content as RAW payload http://localhost:8888/ords/orcl/hr/jobs/IT_CONS ❖ DELETE Method : DELETE http://localhost:8888/ords/orcl/hr/jobs/IT_CONS [contd.,] Payload: {"job_title":"IT Consultant“ ,"min_salary":45000 ,"max_salary":150000}
  • 26. ❖ Batchload enables loading CSV data into the AutoREST enabled tables. ❖ Only POST method is supported ❖ First line in the CSV should contain the Column names ❖ Date format in the csv data can be specified using the query parameter dateFormat ❖ Sample URL for batchload operation is, http://localhost:8888/ords/orcl/hr/jobs/batchload?dateFormat="DD/MM/YYYY hh24:mi“ Payload: job_id,job_title,min_salary,max_salary,created_date IT_CONS1,Junior IT Consultant,1000,5000,01/01/2018 13:25 IT_CONS2,IT Consultant,3000,8000,02/01/2018 21:54 IT_CONS3,Senior IT Consultant,7000,12000,03/01/2018 09:15 AutoREST - Batchload 31
  • 28. API Security & Authentication 33 Types of Authentication supported by ORDS ❖ First Party Authentication or Basic Authentication ● Create ORDS user and assign roles and privileges to access the API ❖ OAuth 2.0 ● Resource Owner Credentials ● Client Credentials ● Authorization Code ● Implicit Code
  • 29. OAuth 2.0 ❖ The OAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) defines flows to provide conditional and limited access to a RESTful API. ❖ OAuth 2.0 Authentication Flow types, ● Authorization Code ❏ This is for web applications having its own web server where the client credentials can be stored. The application can use a refresh token to extend the period of access to the api. ● Client Credentials ❏ Gives an application direct access to a RESTful API without requiring a user to approve access to the data managed by the RESTful API. ● Implicit Code ❏ This is suitable for Single Page Applications where client credentials cannot be stored. API Security & Authentication 34 [contd.,]
  • 30. OAuth 2.0 – Authentication Flows 35
  • 31. OAuth 2.0 – Authentication Flows 36
  • 32. OAuth 2.0 – Authentication Flows 37
  • 33. OAuth 2.0 – Authentication Flows 38
  • 34. ORDS - Roles and Privileges 39 Role Privileges URL mapping Register User in ORDS Access the REST APIs using this username and password User Client Register client in ORDS to generate CLIENT_ID & CLIENT_SECRET Use these to get Access Token for accessing the REST API Basic Authentication OAuth 2.0
  • 35. ORDS - Roles and Privileges 40 ❖ Define ORDS Role BEGIN ORDS.create_role ( p_role_name => 'hrms_role' ); COMMIT; END; ❖ Define Privilege DECLARE l_arr OWA.vc_arr; BEGIN l_arr(1) := 'hrms_role'; ORDS.define_privilege ( p_privilege_name => 'hrms_prv' , p_roles => l_arr , p_label => 'HRMS Privilege' , p_description => 'Access to HRMS apis' ); COMMIT; END; ORDS Metadata: SEC_ROLES SEC_PRIVILEGES SEC_PRIVILEGE_ROLES USER_ORDS_ROLES USER_ORDS_PRIVILEGES USER_ORDS_PRIVILEGE_ROLES [contd.,]
  • 36. ORDS - Privilege mapped to URL 41 ❖ Map the Privilege to an URL pattern BEGIN ORDS.create_privilege_mapping ( p_privilege_name => 'hrms_prv' , p_pattern => '/hrms/*' ); COMMIT; END; ORDS Metadata: ORDS_PRIVILEGE_MAPPINGS USER_ORDS_PRIVILEGE_MAPPINGS
  • 37. ORDS - Basic Authentication 42 ❖ Create ORDS user with password. Execute this command from <ORDS_BASE> path. java -jar ords.war user hrms_usr hrms_role ❖ Credentials file is created for Basic Authentication /<ORDS_BASE>/conf/ords/credentials
  • 40. Thank You Hariharaputhran & Justin Michael Raj AIOUG Evangelists