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"]))

4 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
  2. Jon-Eric Eliker

    Not exactly. Probably closer to this https://docs.oracle.com/en/cloud/get-started/subscriptions-cloud/meter/op-api-v1-usagecost-accountid-get.html and this https://docs.oracle.com/en/cloud/get-started/subscriptions-cloud/meter/op-api-v1-checkquota-accountid-get.html together. 🙂

    You’ll see in those examples where gsiProductId is part of the usage cost results and the full list of services/resources/quantities is available from the quota quota results. I’m hoping to find something to report all “product IDs” available in a quota whereas the default result has only resource “names” (e.g. I want B90425 not just PIC_COMPUTE_STANDARD_E2).

    Thank you for your reply!

    Reply
  3. Pingback: OCI Rate Card Utility – Oracle Cloud Blog

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.