Red Hat Product Life Cycle Data API

Red Hat Product Life Cycle Data API 1.0

API Documentation

Customer Portal Labs

Abstract

The API exposes a list of endpoints to query Red Hat Product Life Cycle data with certain parameters easily.

Chapter 1. Overview

The API exposes a list of endpoints to query Red Hat Product Life Cycle data with certain parameters. This is the 1.0 version.

Base URL

https://access.redhat.com/product-life-cycles/api/v1/

Supported Formats

The API supports JSON format.

Chapter 2. Products

2.1. List Product Life Cycle

Abstract

List all up-to-date product life cycle data when no parameter is passed. Returns a convenience object as response with all attributes.

JSON

GET /products

2.2. Parameters

NameDescriptionExampleDefault

name

Index of products filter. Multi product names seperated by comma(,) is suppported.

name=Red Hat Enterprise Linux,Openshift Container Platform 4

all

Chapter 3. Legacy Support

3.1. Legacy /lifecycle endpoint support

Abstract

Support legacy API endpoint /lifecycle.

JSON

GET /plccapi/lifecycle.json

XML

GET /plccapi/lifecycle.xml

3.2. Parameters

NameDescriptionExampleDefault

products

Index of products filter. Multi-products seperated by comma(,) is suppported.

products=Red%20Hat%20Enterprise%20Linux,Openshift%20Container%20Platform

all

all_versions

Index of all versions including ones that are out of Red Hat service.

all_versions=false

true

Chapter 4. Example Script

#!/usr/bin/env python
from __future__ import print_function
import sys
import requests
from datetime import datetime, timedelta

API_HOST = 'https://access.redhat.com/product-life-cycles/api/v1'


def get_data(query):

    full_query = API_HOST + query
    r = requests.get(full_query)

    if r.status_code != 200:
        print('ERROR: Invalid request; returned {} for the following '
              'query:\n{}'.format(r.status_code, full_query))
        sys.exit(1)

    if not r.json():
        print('No data returned with the following query:')
        print(full_query)
        sys.exit(0)

    return r.json()

# Get RHEL and Openshift Container Platform 4 life cycle data
endpoint = '/products'
params = 'name=Red Hat Enterprise Linux,Openshift Container Platform 4'

data = get_data(endpoint + '?' + params)
products = data['data']

for product in products:
    print(product)

# Get RHEL and Openshift Container Platform 4 life cycle data using legacy JSON endpoint
endpoint = '/plccapi/lifecycle.json'
params = 'products=Red Hat Enterprise Linux,Openshift Container Platform 4'

data = get_data(endpoint + '?' + params)

for product in data:
    print(product)

print('-----')