SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Downloaden Sie, um offline zu lesen
MICHIGAN ORACLE USERS SUMMIT 2022
WEDNESDAY OCTOBER 26,2022
1:15PM @W210C
AUTOMATING CLOUD OPERATIONS
EverythingYou Needed to Know about REST and cURL
PRESENTER NAME: AHMED ABOULNAGA
PRESENTERTITLE: TECHNICAL DIRECTOR
TABLE OF CONTENTS
Introduction 3
REST and Cloud 6
Introduction to REST 9
Introduction to cURL 23
Creating an Oracle Autonomous Database 30
Figuring Out Authentication and Headers 41
Demo 56
INTRODUCTION
ABOUT ME
Ahmed Aboulnaga
 Master’s degree in Computer Science from George Mason University
 Recent emphasis on cloud,DevOps,middleware,security in current projects
 OracleACE Pro, OCE, OCA
 Author, Blogger,Presenter
 @Ahmed_Aboulnaga
REST AND CLOUD
CLOUD APIS
 All cloud vendors provide some type of API to their services
 This allows for programmatic access to cloud services
 A basic understanding of cURL, REST, and JSON is helpful
 Most cloud providers use the REST architectural style for their APIs
Client REST API Cloud Service
JSON / XML
GET / POST / PUT / DELETE
GOAL OFTHIS PRESENTATION
 Better understanding of REST and JSON
 Understand and interpret REST API documentation
 Familiarization with authorization when calling REST APIs
 Become capable of automating your cloud operations through REST APIs
Target
Audience
https://globalacademy-eg.com/training-courses/oracle-dba.htm
MY STORY
MY USE CASE
What I was trying to do?
 Create an Identity Domain in Oracle
Access Manager
 OAM 12.2.1.3 had a web-based console
for all OAuth configuration
MY USE CASE
What was my challenge?
 OAM 12.2.1.4 provided no web-
based interface and only supported
a RESTAPI
https://docs.oracle.com/en/middleware/idm/access-manager/12.2.1.3/oroau/op-oam-services-rest-ssa-api-v1-oauthpolicyadmin-oauthidentitydomain-post.html
STARTWITHTHE DOCUMENTATION
Was the documentation helpful?
 Not all RESTAPI documentation is
created equally
 Fortunately,the OAM REST API
documentation provided an example
request and example response
PREPARINGTO LOGIN
What did I do first?
 Passwords can be passed as a
“username:password” combination or
encoded
 Encoding converts literal text to a humanly
unreadable format
 Used online to encode“weblogic:welcome1”
Authentication Options:
curl -u 'weblogic':'welcome1'
curl -H 'Authorization:Basic d2VibG9naWM6d2VsY29tZTE='
https://www.base64encode.org
DID ITWORK?
 Initial invocation failed command:
curl -H 'Content-Type: application/x-www-form-urlencoded'
-H 'Authorization:Basic d1VibG9naWM6d2VsY29tZTE='
--request POST
http://soadev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauth
policyadmin/oauthidentitydomain
-d ' {
"name" : "AhmedWebGateDomain",
"identityProvider" : "AhmedOUDStore",
"description" : "Ahmed OIDC Domain"
} '
 Output:
Mandatory param not found. Entity - IdentityDomain, paramName - name
 The documentation states that only “name” is mandatory
So what’s the problem?
WHATWASTHE SUCCESSFUL OUTCOME?
 Final successful command:
curl -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization:Basic
d1VibG9naWM6d2VsY29tZTE='
'http://soadev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauthpolicyadmin/oauthidentitydomai
n' -d '{"name":"AhmedWebGateDomain", "identityProvider":"AhmedOUDStore", "description":"Ahmed
OIDC WebGate Domain",
"tokenSettings":[{"tokenType":"ACCESS_TOKEN","tokenExpiry":3600,"lifeCycleEnabled":false,"refres
hTokenEnabled":false,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false},
{"tokenType":"AUTHZ_CODE","tokenExpiry":3600,"lifeCycleEnabled":false,"refreshTokenEnabled":fals
e,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false},
{"tokenType":"SSO_LINK_TOKEN","tokenExpiry":3600,"lifeCycleEnabled":false,"refreshTokenEnabled":
false,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false}],
"errorPageURL":"/oam/pages/servererror.jsp", "consentPageURL":"/oam/pages/consent.jsp"}'
 Impossible to determine accurate command without support,examples,or thorough documentation
 Required Oracle Support assistance to get these details
INTRODUCTION TO REST
15
WHAT IS REST?
 REpresentational StateTransfer
 Architectural style for distributed hypermedia system
 Proposed in 2000 by Roy Fielding in his dissertation
 Web Service implemented with REST is called RESTful web service
 REST is not a protocol like SOAP.It is rather an architectural style
 REST services typically use HTTP/HTTPS,but can be implemented with other protocols like FTP
REST ARCHITECTURAL CONSIDERATIONS
Uniform interface: Easy to understand and readable results and can be
consumed by any client or programming language over basic protocols.
URI-based access: Using the same approach to a human browsing a
website where all resource are linked together.
Stateless communication: Extremely scalable since no client context is
stored on the server between requests.
REST METHODS
 The HTTP protocol provides multiple methods which you can utilize for RESTful web services
 The table maps the HTTP method to the typical REST operation
 Some firewalls may limit some HTTP methods for security reasons
HTTP Method REST Operation
GET Read
POST Create
PUT Update
DELETE Delete
OPTIONS List of available methods
HEAD Get version
PATCH Update property/attribute
Most common in
web applications
Most common in
REST to provide
CRUD functionality
RESOURCES
 Requests are sent to resources (i.e., URLs)
 Each resource represents an object which identified by a noun (e.g., employee,etc.)
 Each resource has a unique URL
 When performing a POST (create) or PUT (update),you must pass additional values
Resource HTTP Method REST Output
https://hostname/hr/employee GET Retrieve a list of all employees
https://hostname/hr/employee/12 GET Retrieve details for employee #12
https://hostname/hr/employee POST Create a new employee
https://hostname/hr/employee/12 PUT Update employee #12
https://hostname/hr/employee/12 DELETE Delete employee #12
https://hostname/hr/employee/12/address GET Retrieve address for employee #12
HTTP RESPONSE CODES
 HTTP response codes determine the overall response of the REST invocation
HTTP Code Status Description
2XX (200,201,204) OK Data was received and operation was performed
3XX (301,302) Redirect Request redirected to another URL
4XX (403,404) Client Error Resource not available to client
5XX (500) Server Error Server error
JSON
 JavaScript Object Notation
 Pronounced“Jason”
 An object surrounded by { }
 An array or ordered list
 REST can support both JSON and XML
 Less verbose than XML,but lacks metadata support
//JSON Object
{
"employee": {
"id": 12,
"name": "Kobe",
"location": "USA"
}
}
//JSON Array
{
"employees": [
{
"id": 12,
"name": "Kobe",
"location": "USA"
},
{
"id": 13,
"name": "Jordan",
"location": "Canada"
},
{
"id": 14,
"name": "Barkley",
"location": "USA"
}
]
}
INTRODUCTION TO CURL
WHAT IS CURL?
 Open-source command-line tool
 Supports more than 22 different protocols (e.g.,
HTTP,HTTPS,FTP,etc.)
 For HTTP,supports all methods (e.g., GET, POST,
PUT,DELETE, etc.)
 Very useful for testing RESTful web services
 Other advanced tools available include Postman,
SoapUI,Oracle SQL Developer,etc.
 Example service:
https://api.weather.gov/alerts/active?area=MI
VIEWING HEADER ATTRIBUTES
 Fetch the HTTP header attributes only using the -i or -I option:
AUTHENTICATION OPTIONS
 Many authentication options are supported;access token, bearer token, OAuth, basic auth,
username/password,client certificate,etc.
Authentication Examples:
curl -H 'token:T3jaD5aDHJLr3idjCma894DAWzk49opp'
curl -u 'weblogic':'welcome1'
curl -H 'Authorization:Basic d2VibG9naWM6d2VsY29tZTE='
Token-basedAuthentication:
POSTMAN
 PopularAPI client
 Free version available
www.postman.com
 Numerous features that include:
‒ Create API documentation
‒ Automated testing
‒ Design and mock APIs
‒ MonitorAPIs
‒ Etc.
BENEFITS OF CURL
 Free
 Command-line based tool
 Useful for non-interactive scripts
 Can pass HTTP headers,cookies,and authentication information
 Support for SSL, proxy,numerous protocols (e.g., LDAP, SMB,SCP,IMAP,FILE,TELNET,etc.), etc.
RECAP
 Recap of previous cURL request:
curl -H 'Content-Type: application/x-www-form-urlencoded'
-H 'Authorization:Basic d1VibG9naWM6d2VsY29tZTE='
-X POST
http://dev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauthpolicyadmin/oauthidentitydomain
-d '
{
"name" : "AhmedWebGateDomain",
"identityProvider" : "AhmedOUDStore",
"description" : "Ahmed OIDC Domain"
}
'
CREATING AN AUTONOMOUS DATABASE
MANUALLY CREATE AN AUTONOMOUS DATABASE (1 OF 4)
MANUALLY CREATE AN AUTONOMOUS DATABASE (2 OF 4)
MANUALLY CREATE AN AUTONOMOUS DATABASE (3 OF 4)
MANUALLY CREATE AN AUTONOMOUS DATABASE (4 OF 4)
NAVIGATETO DOCUMENTATION
 CreateAutonomousDatabase Reference
https://docs.cloud.oracle.com/en-us/iaas/api/#/en/database/20160918/AutonomousDatabase/CreateAutonomousDatabase
 Note:
‒ API reference
‒ CreateAutonomousD
atabase operation
‒ REST API endpoint
‒ API version
VIEW RESOURCE DETAILS AND EXAMPLE
 The resource details provides a
list of all required parameters,
often beyond what is
demonstrated in the example
 Use the example as a starting
point
{
"compartmentId" : "ocid1.tenancy.oc1..d6cpxn…dbx",
"displayName" : "MOUS DB 2020 Auto",
"dbName" : "MOUSDBAUTO",
"adminPassword" : "Kobe_24_24_24",
"cpuCoreCount" : 1,
"dataStorageSizeInTBs" : 1
}
FIRST ATTEMPT… FAILED!
 Unable to authenticate upon first try despite all parameters/settings correct per the documentation…
EXECUTE COMMAND
 Eventually got it working…
PROVISIONING…
AVAILABLE!
FIGURING OUT AUTHENTICATION & HEADERS
DISCOVERY IS PAINFUL
API References and Endpoints
https://docs.cloud.oracle.com/en-
us/iaas/api/#/en/database/20160918/
Oracle Cloud Infrastructure
Documentation
https://docs.cloud.oracle.com/en-
us/iaas/Content/API/Concepts/apisigningkey.htm#How
Managing Autonomous Data
Warehouse Using oci-curl
https://blogs.oracle.com/datawarehousing/managing-
autonomous-data-warehouse-using-oci-curl
Oracle Cloud Infrastructure
(OCI) REST call
walkthrough with curl
https://www.ateam-oracle.com/oracle-cloud-
infrastructure-oci-rest-call-walkthrough-with-curl
But why didn’t
the docs point me
to this?
Found this on my
own, has some
helpful info… I don’t want
to use “oci-
curl”!
This is
complicated!
Thank God they
have a script!
Blog?
Another
blog?
PIECING IT TOGETHER
 If you want to use cURL to invoke OCI REST APIs…
1. Get information from the OCI Console
a. Get theTenancy ID
b. Get the User ID
2. Generate and configure an API Signing Key
a. Create public/private key pair
b. Get the fingerprint of the key
c. Get the public key from the private key in PEM format
d. Add the API Key to the OCI user (by uploading the public key)
3. Prepare and execute script
a. Ensure private key is available
b. Create the JSON request
c. Update the custom script
d. Execute!
1A. GET THETENANCY ID
1B. GET THE USER ID
2A. CREATE PUBLIC/PRIVATE KEY PAIR
 Use ssh-keygen to create a public/private key pair
 The public key will be added as an “API Key” to your OCI account
 The private key will be used by your client (i.e., cURL)
2B. GET THE FINGERPRINT OFTHE KEY
 Use openssl to view the X.509 MD5 PEM certificate fingerprint
2C. GET PUBLIC KEY FROMTHE PRIVATE KEY IN PEM FORMAT
 OCI requires that the public key is imported in PEM format
 Use openssl to get the public key in PEM format
2D.ADDTHE API KEY TOTHE OCI USER
 The public key is added to the OCI user’sAPI Key
 Must be in PEM format
 Can be uploaded or pasted
3A. ENSURE PRIVATE KEY IS AVAILABLE
 The private key created earlier (and in PEM format) is used when invoking the REST service
3B. CREATE THE JSON REQUEST
 The payload is created in JSON format
3C. UPDATE CUSTOM SCRIPT
 The various elements (tenancy id, user id,
private key, key fingerprint,etc.) are
parameterized
 OCI’s REST API requires additional
calculated elements,all taken care of here
(oci-curl takes care of all of this for you)
 The cURL command is eventually called
using a combination of static and dynamic
values
3D. EXECUTE!
 The cURL command is
expanded
 The cURL command is
executed
 The HTTP status code is
observed to obtain the result
of the invocation
PROVISIONING…
AVAILABLE!
www.mous.us
THANKYOU
SAVE THE DATE
• ASCEND CONFERENCE 2023
June 11-14,2023
Caribe Royale Resort
Orlando,Florida
https://ascendusersconference.com
• MOUS 2023
October 25, 2023
Schoolcraft College -VisTaTech Center,
18600 Haggerty Rd, Livonia,MI
https://www.mous.us
www.mous.us
THANKYOU
SURVEYS
• Session Surveys
Please complete the session survey for this
session.
The survey will be provided to each
attendee.

Weitere ähnliche Inhalte

Ähnlich wie Automating Cloud Operations: Everything You Wanted to Know about cURL and REST

Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack APIKrunal Jain
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client ManagerDrupalDay
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIsJoe Cropper
 
Api security-eic-prabath
Api security-eic-prabathApi security-eic-prabath
Api security-eic-prabathWSO2
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsWSO2
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés RianchoCODE BLUE
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Maarten Mulders
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
Testwarez 2013 - Warsztat SoapUI
Testwarez 2013 - Warsztat SoapUI Testwarez 2013 - Warsztat SoapUI
Testwarez 2013 - Warsztat SoapUI Jacek Okrojek
 
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan VMware Tanzu
 
Design Summit - RESTful API Overview - John Hardy
Design Summit - RESTful API Overview - John HardyDesign Summit - RESTful API Overview - John Hardy
Design Summit - RESTful API Overview - John HardyManageIQ
 
iMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within MicroservicesiMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within MicroservicesErick Belluci Tedeschi
 
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...iMasters
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and PythonPiXeL16
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Puppet
 
Building an API Security Ecosystem
Building an API Security EcosystemBuilding an API Security Ecosystem
Building an API Security EcosystemPrabath Siriwardena
 

Ähnlich wie Automating Cloud Operations: Everything You Wanted to Know about cURL and REST (20)

Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIs
 
Api security-eic-prabath
Api security-eic-prabathApi security-eic-prabath
Api security-eic-prabath
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile Environments
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
MesosCon - Be a microservices hero
MesosCon - Be a microservices heroMesosCon - Be a microservices hero
MesosCon - Be a microservices hero
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
Testwarez 2013 - Warsztat SoapUI
Testwarez 2013 - Warsztat SoapUI Testwarez 2013 - Warsztat SoapUI
Testwarez 2013 - Warsztat SoapUI
 
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
 
Design Summit - RESTful API Overview - John Hardy
Design Summit - RESTful API Overview - John HardyDesign Summit - RESTful API Overview - John Hardy
Design Summit - RESTful API Overview - John Hardy
 
iMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within MicroservicesiMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within Microservices
 
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
 
Building an API Security Ecosystem
Building an API Security EcosystemBuilding an API Security Ecosystem
Building an API Security Ecosystem
 

Mehr von Revelation Technologies

Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudRevelation Technologies
 
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices Framework
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices FrameworkIntroducing the Oracle Cloud Infrastructure (OCI) Best Practices Framework
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices FrameworkRevelation Technologies
 
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Revelation Technologies
 
PTK Issue 72: Delivering a Platform on Demand
PTK Issue 72: Delivering a Platform on DemandPTK Issue 72: Delivering a Platform on Demand
PTK Issue 72: Delivering a Platform on DemandRevelation Technologies
 
PTK Issue 71: The Compute Cloud Performance Showdown
PTK Issue 71: The Compute Cloud Performance ShowdownPTK Issue 71: The Compute Cloud Performance Showdown
PTK Issue 71: The Compute Cloud Performance ShowdownRevelation Technologies
 
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Revelation Technologies
 
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Revelation Technologies
 
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Revelation Technologies
 
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to Know
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to KnowThe Microsoft Azure and Oracle Cloud Interconnect Everything You Need to Know
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to KnowRevelation Technologies
 
Compute Cloud Performance Showdown: Amazon Web Services, Oracle Cloud, IBM ...
Compute Cloud  Performance Showdown: Amazon Web Services, Oracle  Cloud, IBM ...Compute Cloud  Performance Showdown: Amazon Web Services, Oracle  Cloud, IBM ...
Compute Cloud Performance Showdown: Amazon Web Services, Oracle Cloud, IBM ...Revelation Technologies
 
Securing your Oracle Fusion Middleware Environment, On-Prem and in the Cloud
Securing your Oracle Fusion Middleware Environment, On-Prem and in the CloudSecuring your Oracle Fusion Middleware Environment, On-Prem and in the Cloud
Securing your Oracle Fusion Middleware Environment, On-Prem and in the CloudRevelation Technologies
 
Oracle BPM Suite Development: Getting Started
Oracle BPM Suite Development: Getting StartedOracle BPM Suite Development: Getting Started
Oracle BPM Suite Development: Getting StartedRevelation Technologies
 
Developing Web Services from Scratch - For DBAs and Database Developers
Developing Web Services from Scratch - For DBAs and Database DevelopersDeveloping Web Services from Scratch - For DBAs and Database Developers
Developing Web Services from Scratch - For DBAs and Database DevelopersRevelation Technologies
 
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...Revelation Technologies
 
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS InstanceOracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS InstanceRevelation Technologies
 
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...Revelation Technologies
 

Mehr von Revelation Technologies (20)

Operating System Security in the Cloud
Operating System Security in the CloudOperating System Security in the Cloud
Operating System Security in the Cloud
 
Getting Started with Terraform
Getting Started with TerraformGetting Started with Terraform
Getting Started with Terraform
 
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
 
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices Framework
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices FrameworkIntroducing the Oracle Cloud Infrastructure (OCI) Best Practices Framework
Introducing the Oracle Cloud Infrastructure (OCI) Best Practices Framework
 
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
 
PTK Issue 72: Delivering a Platform on Demand
PTK Issue 72: Delivering a Platform on DemandPTK Issue 72: Delivering a Platform on Demand
PTK Issue 72: Delivering a Platform on Demand
 
PTK Issue 71: The Compute Cloud Performance Showdown
PTK Issue 71: The Compute Cloud Performance ShowdownPTK Issue 71: The Compute Cloud Performance Showdown
PTK Issue 71: The Compute Cloud Performance Showdown
 
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
Everything You Need to Know About the Microsoft Azure and Oracle Cloud Interc...
 
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
 
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
Compute Cloud Performance Showdown: 18 Months Later (OCI, AWS, IBM Cloud, GCP...
 
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to Know
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to KnowThe Microsoft Azure and Oracle Cloud Interconnect Everything You Need to Know
The Microsoft Azure and Oracle Cloud Interconnect Everything You Need to Know
 
Cloud Integration Strategy
Cloud Integration StrategyCloud Integration Strategy
Cloud Integration Strategy
 
Compute Cloud Performance Showdown: Amazon Web Services, Oracle Cloud, IBM ...
Compute Cloud  Performance Showdown: Amazon Web Services, Oracle  Cloud, IBM ...Compute Cloud  Performance Showdown: Amazon Web Services, Oracle  Cloud, IBM ...
Compute Cloud Performance Showdown: Amazon Web Services, Oracle Cloud, IBM ...
 
Securing your Oracle Fusion Middleware Environment, On-Prem and in the Cloud
Securing your Oracle Fusion Middleware Environment, On-Prem and in the CloudSecuring your Oracle Fusion Middleware Environment, On-Prem and in the Cloud
Securing your Oracle Fusion Middleware Environment, On-Prem and in the Cloud
 
Hands-On with Oracle SOA Cloud Service
Hands-On with Oracle SOA Cloud ServiceHands-On with Oracle SOA Cloud Service
Hands-On with Oracle SOA Cloud Service
 
Oracle BPM Suite Development: Getting Started
Oracle BPM Suite Development: Getting StartedOracle BPM Suite Development: Getting Started
Oracle BPM Suite Development: Getting Started
 
Developing Web Services from Scratch - For DBAs and Database Developers
Developing Web Services from Scratch - For DBAs and Database DevelopersDeveloping Web Services from Scratch - For DBAs and Database Developers
Developing Web Services from Scratch - For DBAs and Database Developers
 
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...
Domain Partitions and Multitenancy in Oracle WebLogic Server 12c - Why It's U...
 
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS InstanceOracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
 
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...
Anyone Can Build a Site, Even You! Create a Microsite with Oracle Sites Cloud...
 

Kürzlich hochgeladen

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 

Kürzlich hochgeladen (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Automating Cloud Operations: Everything You Wanted to Know about cURL and REST

  • 1. MICHIGAN ORACLE USERS SUMMIT 2022 WEDNESDAY OCTOBER 26,2022 1:15PM @W210C AUTOMATING CLOUD OPERATIONS EverythingYou Needed to Know about REST and cURL PRESENTER NAME: AHMED ABOULNAGA PRESENTERTITLE: TECHNICAL DIRECTOR
  • 2. TABLE OF CONTENTS Introduction 3 REST and Cloud 6 Introduction to REST 9 Introduction to cURL 23 Creating an Oracle Autonomous Database 30 Figuring Out Authentication and Headers 41 Demo 56
  • 4. ABOUT ME Ahmed Aboulnaga  Master’s degree in Computer Science from George Mason University  Recent emphasis on cloud,DevOps,middleware,security in current projects  OracleACE Pro, OCE, OCA  Author, Blogger,Presenter  @Ahmed_Aboulnaga
  • 6. CLOUD APIS  All cloud vendors provide some type of API to their services  This allows for programmatic access to cloud services  A basic understanding of cURL, REST, and JSON is helpful  Most cloud providers use the REST architectural style for their APIs Client REST API Cloud Service JSON / XML GET / POST / PUT / DELETE
  • 7. GOAL OFTHIS PRESENTATION  Better understanding of REST and JSON  Understand and interpret REST API documentation  Familiarization with authorization when calling REST APIs  Become capable of automating your cloud operations through REST APIs Target Audience https://globalacademy-eg.com/training-courses/oracle-dba.htm
  • 9. MY USE CASE What I was trying to do?  Create an Identity Domain in Oracle Access Manager  OAM 12.2.1.3 had a web-based console for all OAuth configuration
  • 10. MY USE CASE What was my challenge?  OAM 12.2.1.4 provided no web- based interface and only supported a RESTAPI https://docs.oracle.com/en/middleware/idm/access-manager/12.2.1.3/oroau/op-oam-services-rest-ssa-api-v1-oauthpolicyadmin-oauthidentitydomain-post.html
  • 11. STARTWITHTHE DOCUMENTATION Was the documentation helpful?  Not all RESTAPI documentation is created equally  Fortunately,the OAM REST API documentation provided an example request and example response
  • 12. PREPARINGTO LOGIN What did I do first?  Passwords can be passed as a “username:password” combination or encoded  Encoding converts literal text to a humanly unreadable format  Used online to encode“weblogic:welcome1” Authentication Options: curl -u 'weblogic':'welcome1' curl -H 'Authorization:Basic d2VibG9naWM6d2VsY29tZTE=' https://www.base64encode.org
  • 13. DID ITWORK?  Initial invocation failed command: curl -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization:Basic d1VibG9naWM6d2VsY29tZTE=' --request POST http://soadev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauth policyadmin/oauthidentitydomain -d ' { "name" : "AhmedWebGateDomain", "identityProvider" : "AhmedOUDStore", "description" : "Ahmed OIDC Domain" } '  Output: Mandatory param not found. Entity - IdentityDomain, paramName - name  The documentation states that only “name” is mandatory So what’s the problem?
  • 14. WHATWASTHE SUCCESSFUL OUTCOME?  Final successful command: curl -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization:Basic d1VibG9naWM6d2VsY29tZTE=' 'http://soadev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauthpolicyadmin/oauthidentitydomai n' -d '{"name":"AhmedWebGateDomain", "identityProvider":"AhmedOUDStore", "description":"Ahmed OIDC WebGate Domain", "tokenSettings":[{"tokenType":"ACCESS_TOKEN","tokenExpiry":3600,"lifeCycleEnabled":false,"refres hTokenEnabled":false,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false}, {"tokenType":"AUTHZ_CODE","tokenExpiry":3600,"lifeCycleEnabled":false,"refreshTokenEnabled":fals e,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false}, {"tokenType":"SSO_LINK_TOKEN","tokenExpiry":3600,"lifeCycleEnabled":false,"refreshTokenEnabled": false,"refreshTokenExpiry":86400,"refreshTokenLifeCycleEnabled":false}], "errorPageURL":"/oam/pages/servererror.jsp", "consentPageURL":"/oam/pages/consent.jsp"}'  Impossible to determine accurate command without support,examples,or thorough documentation  Required Oracle Support assistance to get these details
  • 16. WHAT IS REST?  REpresentational StateTransfer  Architectural style for distributed hypermedia system  Proposed in 2000 by Roy Fielding in his dissertation  Web Service implemented with REST is called RESTful web service  REST is not a protocol like SOAP.It is rather an architectural style  REST services typically use HTTP/HTTPS,but can be implemented with other protocols like FTP
  • 17. REST ARCHITECTURAL CONSIDERATIONS Uniform interface: Easy to understand and readable results and can be consumed by any client or programming language over basic protocols. URI-based access: Using the same approach to a human browsing a website where all resource are linked together. Stateless communication: Extremely scalable since no client context is stored on the server between requests.
  • 18. REST METHODS  The HTTP protocol provides multiple methods which you can utilize for RESTful web services  The table maps the HTTP method to the typical REST operation  Some firewalls may limit some HTTP methods for security reasons HTTP Method REST Operation GET Read POST Create PUT Update DELETE Delete OPTIONS List of available methods HEAD Get version PATCH Update property/attribute Most common in web applications Most common in REST to provide CRUD functionality
  • 19. RESOURCES  Requests are sent to resources (i.e., URLs)  Each resource represents an object which identified by a noun (e.g., employee,etc.)  Each resource has a unique URL  When performing a POST (create) or PUT (update),you must pass additional values Resource HTTP Method REST Output https://hostname/hr/employee GET Retrieve a list of all employees https://hostname/hr/employee/12 GET Retrieve details for employee #12 https://hostname/hr/employee POST Create a new employee https://hostname/hr/employee/12 PUT Update employee #12 https://hostname/hr/employee/12 DELETE Delete employee #12 https://hostname/hr/employee/12/address GET Retrieve address for employee #12
  • 20. HTTP RESPONSE CODES  HTTP response codes determine the overall response of the REST invocation HTTP Code Status Description 2XX (200,201,204) OK Data was received and operation was performed 3XX (301,302) Redirect Request redirected to another URL 4XX (403,404) Client Error Resource not available to client 5XX (500) Server Error Server error
  • 21. JSON  JavaScript Object Notation  Pronounced“Jason”  An object surrounded by { }  An array or ordered list  REST can support both JSON and XML  Less verbose than XML,but lacks metadata support //JSON Object { "employee": { "id": 12, "name": "Kobe", "location": "USA" } } //JSON Array { "employees": [ { "id": 12, "name": "Kobe", "location": "USA" }, { "id": 13, "name": "Jordan", "location": "Canada" }, { "id": 14, "name": "Barkley", "location": "USA" } ] }
  • 23. WHAT IS CURL?  Open-source command-line tool  Supports more than 22 different protocols (e.g., HTTP,HTTPS,FTP,etc.)  For HTTP,supports all methods (e.g., GET, POST, PUT,DELETE, etc.)  Very useful for testing RESTful web services  Other advanced tools available include Postman, SoapUI,Oracle SQL Developer,etc.  Example service: https://api.weather.gov/alerts/active?area=MI
  • 24. VIEWING HEADER ATTRIBUTES  Fetch the HTTP header attributes only using the -i or -I option:
  • 25. AUTHENTICATION OPTIONS  Many authentication options are supported;access token, bearer token, OAuth, basic auth, username/password,client certificate,etc. Authentication Examples: curl -H 'token:T3jaD5aDHJLr3idjCma894DAWzk49opp' curl -u 'weblogic':'welcome1' curl -H 'Authorization:Basic d2VibG9naWM6d2VsY29tZTE=' Token-basedAuthentication:
  • 26. POSTMAN  PopularAPI client  Free version available www.postman.com  Numerous features that include: ‒ Create API documentation ‒ Automated testing ‒ Design and mock APIs ‒ MonitorAPIs ‒ Etc.
  • 27. BENEFITS OF CURL  Free  Command-line based tool  Useful for non-interactive scripts  Can pass HTTP headers,cookies,and authentication information  Support for SSL, proxy,numerous protocols (e.g., LDAP, SMB,SCP,IMAP,FILE,TELNET,etc.), etc.
  • 28. RECAP  Recap of previous cURL request: curl -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization:Basic d1VibG9naWM6d2VsY29tZTE=' -X POST http://dev.revtech.com:7701/oam/services/rest/ssa/api/v1/oauthpolicyadmin/oauthidentitydomain -d ' { "name" : "AhmedWebGateDomain", "identityProvider" : "AhmedOUDStore", "description" : "Ahmed OIDC Domain" } '
  • 30. MANUALLY CREATE AN AUTONOMOUS DATABASE (1 OF 4)
  • 31. MANUALLY CREATE AN AUTONOMOUS DATABASE (2 OF 4)
  • 32. MANUALLY CREATE AN AUTONOMOUS DATABASE (3 OF 4)
  • 33. MANUALLY CREATE AN AUTONOMOUS DATABASE (4 OF 4)
  • 34. NAVIGATETO DOCUMENTATION  CreateAutonomousDatabase Reference https://docs.cloud.oracle.com/en-us/iaas/api/#/en/database/20160918/AutonomousDatabase/CreateAutonomousDatabase  Note: ‒ API reference ‒ CreateAutonomousD atabase operation ‒ REST API endpoint ‒ API version
  • 35. VIEW RESOURCE DETAILS AND EXAMPLE  The resource details provides a list of all required parameters, often beyond what is demonstrated in the example  Use the example as a starting point { "compartmentId" : "ocid1.tenancy.oc1..d6cpxn…dbx", "displayName" : "MOUS DB 2020 Auto", "dbName" : "MOUSDBAUTO", "adminPassword" : "Kobe_24_24_24", "cpuCoreCount" : 1, "dataStorageSizeInTBs" : 1 }
  • 36. FIRST ATTEMPT… FAILED!  Unable to authenticate upon first try despite all parameters/settings correct per the documentation…
  • 37. EXECUTE COMMAND  Eventually got it working…
  • 41. DISCOVERY IS PAINFUL API References and Endpoints https://docs.cloud.oracle.com/en- us/iaas/api/#/en/database/20160918/ Oracle Cloud Infrastructure Documentation https://docs.cloud.oracle.com/en- us/iaas/Content/API/Concepts/apisigningkey.htm#How Managing Autonomous Data Warehouse Using oci-curl https://blogs.oracle.com/datawarehousing/managing- autonomous-data-warehouse-using-oci-curl Oracle Cloud Infrastructure (OCI) REST call walkthrough with curl https://www.ateam-oracle.com/oracle-cloud- infrastructure-oci-rest-call-walkthrough-with-curl But why didn’t the docs point me to this? Found this on my own, has some helpful info… I don’t want to use “oci- curl”! This is complicated! Thank God they have a script! Blog? Another blog?
  • 42. PIECING IT TOGETHER  If you want to use cURL to invoke OCI REST APIs… 1. Get information from the OCI Console a. Get theTenancy ID b. Get the User ID 2. Generate and configure an API Signing Key a. Create public/private key pair b. Get the fingerprint of the key c. Get the public key from the private key in PEM format d. Add the API Key to the OCI user (by uploading the public key) 3. Prepare and execute script a. Ensure private key is available b. Create the JSON request c. Update the custom script d. Execute!
  • 44. 1B. GET THE USER ID
  • 45. 2A. CREATE PUBLIC/PRIVATE KEY PAIR  Use ssh-keygen to create a public/private key pair  The public key will be added as an “API Key” to your OCI account  The private key will be used by your client (i.e., cURL)
  • 46. 2B. GET THE FINGERPRINT OFTHE KEY  Use openssl to view the X.509 MD5 PEM certificate fingerprint
  • 47. 2C. GET PUBLIC KEY FROMTHE PRIVATE KEY IN PEM FORMAT  OCI requires that the public key is imported in PEM format  Use openssl to get the public key in PEM format
  • 48. 2D.ADDTHE API KEY TOTHE OCI USER  The public key is added to the OCI user’sAPI Key  Must be in PEM format  Can be uploaded or pasted
  • 49. 3A. ENSURE PRIVATE KEY IS AVAILABLE  The private key created earlier (and in PEM format) is used when invoking the REST service
  • 50. 3B. CREATE THE JSON REQUEST  The payload is created in JSON format
  • 51. 3C. UPDATE CUSTOM SCRIPT  The various elements (tenancy id, user id, private key, key fingerprint,etc.) are parameterized  OCI’s REST API requires additional calculated elements,all taken care of here (oci-curl takes care of all of this for you)  The cURL command is eventually called using a combination of static and dynamic values
  • 52. 3D. EXECUTE!  The cURL command is expanded  The cURL command is executed  The HTTP status code is observed to obtain the result of the invocation
  • 55. www.mous.us THANKYOU SAVE THE DATE • ASCEND CONFERENCE 2023 June 11-14,2023 Caribe Royale Resort Orlando,Florida https://ascendusersconference.com • MOUS 2023 October 25, 2023 Schoolcraft College -VisTaTech Center, 18600 Haggerty Rd, Livonia,MI https://www.mous.us
  • 56. www.mous.us THANKYOU SURVEYS • Session Surveys Please complete the session survey for this session. The survey will be provided to each attendee.