Undocumented: OCI Pricelist API

By | January 22, 2020

I am working on a project that needs to know the prices of the OCI Services. After some digging (thank you Google), I stumbled on this webpage: https://www.oracle.com/cloud/ucpricing.html

This page gives a great overview of all the services and the prices (list prices, without special discounts). I noticed the page loads the prices, so thru some reverse AJEX engineering I came across the webservice responsible for providing the data. The below examples return JSON data!

Pricing details on a single Service

To request the pricing information for a single service, you can use the service partNumer. For example partnumber B88514 is for Compute – Virtual Machine Standard – X7. https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products?partNumber=B88514

besides using the service partnumber, you can also use the product ID if you know it:
https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products/10089

Pricing details on all services

You can use the parentProductPartNumber to get pricing details on all services. Below the example using the B88206 product group for universal credits.

https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products?parentProductPartNumber=B88206&limit=500

Specifying the currency

If you want to be able to control the currency of the reported prices, you have to provide a special header field in the request, example:

X-Oracle-Accept-CurrencyCode: USD
or
X-Oracle-Accept-CurrencyCode: EUR

Example in python:

import requests

url = "https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products?parentProductPartNumber=B88206&limit=300"
resp = requests.get(url, headers={'X-Oracle-Accept-CurrencyCode': 'EUR'})

for item in resp.json()['items']:
print ("{} - {}".format(item["displayName"], item["prices"]))

2 thoughts on “Undocumented: OCI Pricelist API

  1. Jon-Eric Eliker

    Hi Richard. I wonder if you have found an API call for a Cloud Account that includes SKUs? I have been searching for this finding that the usage report APIs include SKUs but I hope to find one related to entitlements. After all, the usage report only shows the usage and SKU if you have actually used a portion of the resource—I would like to report on what SKUs _might_ get used. Thank you for your thoughts.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.