Red Hat Insights API

Red Hat Insights API Cheat Sheet

Jerome Marc

Tags:

English

About

Red Hat Insights is a Software-as-a-Service offering that enables users to obtain actionable intelligence regarding their Red Hat Enterprise Linux environments, helping to identify and address operational and vulnerability risks before an issue results in downtime. This cheat sheet covers the use of  Red Hat Insights APIs to obtain system details and findings, as well as to interact with specific Insights applications. Examples using Python and Ansible are included.

This cheat sheet explains how to:

  • Authenticate with Insights API
  • Interact with the inventory
  • Obtain findings identified by Insights
  • Work with various Insights applications
  • Generate and execute remediations for existing issues
  • Get notifications and integrate with third party applications

Excerpt

Sample GET request using Python:

>>> import requests
>>> headers = {'Authorization': 'Basic <encoded_auth>'}
>>> insights_api_url = "https://console.redhat.com/api/inventory/v1/hosts"
>>> response = requests.get(insights_api_url, headers=headers)
>>> response.status_code
200
>>> response.json()
{'total': 1195, 'count': 50, 'page': 1, 'per_page': 50, 'results': [{'insights_id': '<uuid>', [...]

 

Related Cheat sheets