Lab 5: Working with REST APIs

Similar documents
Lab 4: Configuring node.js apps with ATP

How to Architect and Implement Devops on ExaCS

Simplified CICD with Jenkins and Git on the ZeroStack Platform

Lab 5: Working with REST APIs

Lab 8: Building Microservices on Oracle Autonomous Transaction Processing Service

Bitnami Ruby for Huawei Enterprise Cloud

Lab 03 Finish and Deploy an Application. Lab 3-1: Add DELETE to the Spring Boot REST Application

PAS for OpenEdge Support for JWT and OAuth Samples -

MCR Connections to Oracle Cloud Infrastructure using FastConnect

Moving data to the cloud using the MoveToCloud script

Bitnami JRuby for Huawei Enterprise Cloud

Known Issues for Oracle Oracle Autonomous API Platform Cloud Service. Topics: Oracle Cloud

Getting Started Guide 6/5/2018

Oracle Cloud IaaS: Compute and Storage Fundamentals

OpenShift Dedicated 3 Release Notes

Identity and Access Management Level 200

Jenkins: A complete solution. From Continuous Integration to Continuous Delivery For HSBC

This tutorial provides a basic understanding of the infrastructure and fundamental concepts of managing an infrastructure using Chef.

Identity and Access Management Level 100

Securing VMware NSX-T J U N E 2018

SAS Event Stream Processing 4.2: Security

Bitnami MEAN for Huawei Enterprise Cloud

Let's Encrypt - Free SSL certificates for the masses. Pete Helgren Bible Study Fellowship International San Antonio, TX

Swift Web Applications on the AWS Cloud

Qualys Cloud Platform (VM, PC) v8.x Release Notes

How to go serverless with AWS Lambda

Getting Started Guide 6/1/2017

Asavie IoT Connect Cloud Service Connector Application Note

Bitnami Mantis for Huawei Enterprise Cloud

271 Waverley Oaks Rd. Telephone: Suite 206 Waltham, MA USA

Oracle 1Z Oracle Cloud Solutions Infrastructure Architect Associate.

At Course Completion Prepares you as per certification requirements for AWS Developer Associate.

Lab 2: Setting up secure access

Paperspace. Deployment Guide. Cloud VDI. 20 Jay St. Suite 312 Brooklyn, NY Technical Whitepaper

Professional Edition User Guide

PostgreSQL as REST API Server without coding. Priya

Bitnami ProcessMaker Community Edition for Huawei Enterprise Cloud

Security Improvements on Cast Iron

Securing Connections for IBM Traveler Apps. Bill Wimer STSM for IBM Collaboration Solutions December 13, 2016

Etanova Enterprise Solutions

Table of Contents 1.1. Install, Deploy, Maintain Infrastructure Installation Download Installer. Deployment Prerequisites

AWS Service Catalog. User Guide

PCS Cloud Solutions. Create highly-available, infinitely-scalable applications and APIs

Preparing Your Google Cloud VM for W4705

Back-end architecture

Installation Guide for antegma accallio OX Version 1.0

vcloud Director Administrator's Guide

Google GCP-Solution Architects Exam

Tutorial on How to Publish an OCI Image Listing

Andrew Pullin, Senior Software Designer, School of Computer Science / x4338 / HP5165 Last Updated: September 26, 2016

Application Container Cloud

Securing VMware NSX MAY 2014

VSP18 Venafi Security Professional

Google Cloud Platform for Systems Operations Professionals (CPO200) Course Agenda

SAS Event Stream Processing 4.3: Security

Question: 1 Which three methods can you use to manage Oracle Cloud Infrastructure services? (Choose three.)

RSA SecurID Access SAML Configuration for Kanban Tool

CogniFit Technical Security Details

271 Waverley Oaks Rd. Telephone: Suite 206 Waltham, MA USA

DCCKI Interface Design Specification. and. DCCKI Repository Interface Design Specification

oci Documentation Release Oracle

Qualys Integration with CyberArk Application Identity Manager (AIM)

CISE Research Infrastructure: Mid-Scale Infrastructure - NSFCloud (CRI: NSFCloud)

Serverless Microservices Are The New Black. Lorna Mitchell, IBM

Immersion Day. Getting Started with Linux on Amazon EC2

Build Meeting Room Management Website Using BaaS Framework : Usergrid

Oracle Database Cloud for Oracle DBAs Ed 3

Red Hat OpenShift Application Runtimes 0.1

Genesys Security Deployment Guide. What You Need

CPM. Quick Start Guide V2.4.0

Bitnami Piwik for Huawei Enterprise Cloud

Introduction to Cloudbreak

Paper Command-Line Administration in SAS Viya. Danny Hamrick, SAS

Integrating SAS Analytics into Your Web Page

Live Data Connection to SAP Universes

Simple Security for Startups. Mark Bate, AWS Solutions Architect

Rundeck. A smart software for lazy people. Claudio IMGT - IGH Montpellier BioInformatics Meeting

Immersion Day. Getting Started with Linux on Amazon EC2

DevOps examples on NonStop Tools Overview. Cor Geboers, ATC Consultant

Configuring the Cisco APIC-EM Settings

Red Hat JBoss Middleware for OpenShift 3

Microservices with Node.js

Create and Apply Clientless SSL VPN Policies for Accessing. Connection Profile Attributes for Clientless SSL VPN

VMware vcenter Server Appliance Management Programming Guide. Modified on 28 MAY 2018 vcenter Server 6.7 VMware ESXi 6.7

Automation with Meraki Provisioning API

Bitnami OSQA for Huawei Enterprise Cloud

Exercise 1. Bluemix and the Cloud Foundry command-line interface (CLI)

HTTP request proxying vulnerability

Oracle Cloud Infrastructure Virtual Cloud Network Overview and Deployment Guide ORACLE WHITEPAPER JANUARY 2018 VERSION 1.0

Create OData API for Use With Salesforce Connect

How to use or not use the AWS API Gateway for Microservices

Bitnami Trac for Huawei Enterprise Cloud

EasyMorph Server Administrator Guide

Azure Highlights. Randy Pagels Sr. Developer Technology Specialist US DX Developer Tools - Central Region

Using SRP for TLS Authentication

1 Modular architecture

About 1. Chapter 1: Getting started with odata 2. Remarks 2. Examples 2. Installation or Setup 2. Odata- The Best way to Rest 2

Bitnami ERPNext for Huawei Enterprise Cloud

How to Enable Client Certificate Authentication on Avi

Bitnami Dolibarr for Huawei Enterprise Cloud

Transcription:

Lab 5: Working with REST APIs Oracle's Autonomous Transaction Processing cloud service provides all of the performance of the market-leading Oracle Database in an environment that is tuned and optimized for transaction processing workloads. Oracle Autonomous Transaction Processing ( or ATP ) service provisions in a few minutes and requires very little manual ongoing administration and is therefore ideal for developers to build and test their applications Often times, you would prefer to interact with your cloud services programmatically over REST rather than log into the cloud console and click through screens. Besides, by creating your own deployment and management scripts you can save and reuse your deployments, set gold standards and in fact store entire application infrastructure stacks as version controlled code. The Oracle Cloud Infrastructure APIs are typical REST APIs that use HTTPS requests and responses and support HTTPS and SSL protocol TLS 1.2, the most secure industry standards. Also, All Oracle Cloud Infrastructure API requests must be signed for authentication purposes. To create and sign your API requests, you must 1. Form the HTTPS request (SSL protocol TLS 1.2 is required). 2. Create the signing string, which is based on parts of the request. 3. Create the signature from the signing string, using your private key and the RSA- SHA256 algorithm. 4. Add the resulting signature and other required information to the Authorization header in the request While these seem like a lot of steps and can make your curl statements look sick, they are meant to avoid using username/passwords and are based on the draft-cavage-httpsignatures-08 specification for secure communication over the internet Let's take a look at how to generate REST calls to the Oracle Cloud Infrastructure using a popular scripting language, node.js. While we are using node.js to build some sample calls to create and list Autonomous Database services, you may use similar concepts to build scripts in Python, Golang, Ruby, Perl, Java, C#, bash or even curl if you dare! To make life easier, I've shared a set of modular scripts at this git repo. Download this repository to a local folder. You will also need to generate an ssh key pair in the pem format. Lets do that first. First generate a primary key using this command $ openssl genrsa -aes128 -out ~/oci_api_key.pem 2048 Change permission so only you have access to it $ chmod go-rwx ~/oci_api_key.pem

Then generate a public key using the private key you just created $ openssl rsa -pubout -in ~/oci_api_key.pem -out ~/oci_api_key_public.pem Upload the public key to your OCI account from the console. Once you login to Oracle Cloud Infrastructure, from top left hamburger menu, select Identity --> Users. Pick user from list of user and on the User page, click 'Add API Keys' button. You can then cut and paste your oci_api_key_public.pem key text. Note how the service generates a key Fingerprint. Save the fingerprint some where since you will need it to sign your API requests. Also make note of your user OCID and Tenant OCID besides the key fingerprint as shown below. These three artifacts along with a user s private key make up a unique signature that is used to sign the REST requests. Its extremely important that you do not share this with anyone or expose it over an unencrypted network.

To get started, 1. Make sure you have node.js installed. If not, follow download and installation instructions for your OS at https://nodejs.org/en/download/ 2. In the REST API scripts folder, install node package dependencies using a. $ npm install Now lets take a look at the code you downloaded from the git repository. It consists of, 1. auth.js This module has all the user auth information used to generate the signature and other header information including compartments. You will need to edit this file and change the tenancyid, authuserid, keyfingerprint, privatekeypath and compartments to match your.

Make sure the privatekeypath variable accurately points to the location of your private key file. Compartments are Oracle s way of providing isolation among users of a cloud account. Compartments can be created by users, departments, environment types etc and provide a clear separation among entities that share a single OCI account / tenant. Before you can create objects in your account, you would need to create a compartments and grant access to the user to that compartment by creating a suitable IAM policy. Refer to Oracle s IAM documentation to create and enable compartments. Once finished, update auth.js with the compartment OCIDs 2. regions.js This module lists all the API endpoints for OCI. You do not need to change anything here unless a new service is added or Oracle makes a change to the URLs (which is less likely) 3. headers.js

This module builds API signing keys and generates https headers required for your REST calls depending upon whether it s a GET, PUT, POST or DELETE call. You do not need to modify anything here. It also has an optional getuser method used in every REST call to get user info. from the Identity and Access Management service. You may use that example to generate other IAM REST calls 4. createautonomousdatabase.js, listautonomousdatabase.js, createvcn.js, getautonomousdatabase.js, deleteautonomousdatabase.js These are the scripts you would need to run. Make sure the variables in each of these scripts are set right before you run them. For eg, in the createautonomousdatabase.js script, replace compartmentid, displayname, dbname, adminpassword, cpucorecount and datastorageintbs to match your requirements. Run these scripts as, $ node <filename>.js Here s an example output of the listautonomousdatabase.js call

Explore the various scripts provided and build your own using the Oracle REST API documentation. You may build similar scripts using python, Java, golang, Perl, C#, bash and Curl.