Manage Infrastructure with REST APIs from within the Oracle Database using UTL_HTTP

In this blog post I will share how the Oracle UTL_HTTP package can been used to enable full stack automation by calling external application and infrastructure REST APIs from within an Oracle 19c or 21c database.

For the purpose of this post I will be using an Oracle 21c database and a Pure Storage FlashBlade NFS server to demonstrate the use of the UTL_HTTP package. I will show how to call FlashBlade REST APIs to list and create file system snapshots directly from an Oracle database.


The Oracle UTL_HTTP package provides the ability to perform HyperText Transfer Protocol(Secure) HTTP(s) callouts from SQL and PL/SQL. This can be used to access data locally, over the Internet or call application and infrastructure APIs using HTTP(s).

Note: When the package fetches data from a Web site using HTTPS, it requires an Oracle Wallet which can be created by either Oracle Wallet Manager or the orapki utility. Non-HTTPS fetches do not require an Oracle wallet. 


REST APIs (also known as RESTful APIs) provide the ability to interact with applications and infrastructure. Today most modern solutions expose all, or some functionality to public APIs via HTTP(s) methods, for example:

  • GET – used to retrieve information from the given server using a given URI.
  • POST- used to send data to the server
  • PUT – used to update data on the server
  • DELETE – used to delete data on the sever
  • PATCH – modify specific fields of data on the server

File System Snapshots

The Pure Storage FlashBlade provides a comprehensive set of REST APIs to automate all the functionality provided by the WebUI.

For example, we can Create, Delete, Get and Update file system snapshot attributes using the FlashBlade REST APIs, using the below:

  • Create File System Snapshot
    • POST /1.12/file-system-snapshots
  • Delete File System Snapshot
    • DELETE /1.12/file-system-snapshots
  • Get File System Snapshot(s)
    • GET /1.12/file-system-snapshots
  • Update File System Snapshot attributes
    • PATCH /1.12/file-system-snapshots

All URIs are relative to https://purity_fb_server/api

Create NFS File System

I will start by creating a new file system called ora-test on the FlashBlade NFS server by logging on and navigating to Storage -> File System

Create File System

Now I have a new file system, I will mount the NFS exported file system and perform an ls -al to check for snapshots, for example.

Mount and Check Snapshot Status

# mount /mnt/ora-test -t nfs
# ls -al /mnt/ora-test/.snapshot
total 0
drwxr-xr-x. 1 root root 0 Aug 10 12:09 .
drwxrwxrwx. 2 root root 0 Aug 10 12:09 ..

Perform FlashBlade File System Snapshot

The Oracle fb_snapshot package use the UTL_HTTP POST and GET methods to Create and List FlashBlade File System Snapshots and takes 3 parameters URL, API Token and Filesystem Name

Note: as I will be using HTTPS, I have pre-configured an Oracle Wallet, I have previously shared how to create a Wallet, obtain a certificate and and install it, you can re-familiarise yourself here.

Once installed the database procedure can be run with exec fb_snapshot(<URL>,<API TOKEN>,<File System Name>)

SQL> exec fb_snapshot('','T-da03a759-bb3f-4995-9c6c-fee48d7c1a98','ora-test');
Create FlashBlade Session
Response status code: 200
Logon: {"username":"pureuser"}
x-auth-token: 75c16f38-f628-4888-b796-41663d1561a2
Perform FileSystem Snapshot of ora-test
Response status code: 200
List FileSystem Snapshots of ora-test
Response status code: 200

PL/SQL procedure successfully completed.

The procedure could be called from within code, with Oracle SQL Developer or SQL*Plus, and also run from RMAN block to perform a File System snapshot before and /or after a backup to create immutable snapshots.

Check File System Snapshot

From the OS we can now see the the database procedure has created a FlashBlade file system snapshot in the .snapshot directory

# ls -al /mnt/ora-test/.snapshot
total 0
drwxr-xr-x. 1 root root 0 Aug 10 13:56 .
drwxrwxrwx. 2 root root 0 Aug 10 12:09 ..
drwxrwxrwx. 2 root root 0 Aug 10 12:09 ora-test.2022_08_10_13_56

From the FlashBlade we can also see the file system snapshot.

File System Snapshots


In this post I have shared how the Oracle UTL_HTTP can be used to call external REST APIs to automate application and infrastructure tasks from within an Oracle database.

In my next post I will share how we can consume FlashArray REST APIs to take Volume snapshots.

If you want to learn ore the above example code is available in a GitHub repository

One thought on “Manage Infrastructure with REST APIs from within the Oracle Database using UTL_HTTP

Add yours

Leave a Reply

Create a website or blog at

Up ↑

%d bloggers like this: