2016년 1월 9일 토요일

manageIQ REST API examples with cURL and Python 3

Recently at work I've been working with Redhat Cloudforms 4 (based off of the upstream opensource project manageIQ). A client has requested some customizations of Cloudforms which requires calling some info through the CFME/manageiq REST API.

Redhat Korea gave my company an API reference guide for Cloudforms v3 but it is quite incomplete. It is much better to just refer to the upstream manageiq docs on github:

https://github.com/ManageIQ/manageiq_docs/tree/master/api

Here are some examples of communicating with the v2.2 REST API.

Creating an openstack cloud provider using cURL:


Creating an openstack cloud provider using python 3:


Querying a list of cloud providers using cURL:


Querying a list of cloud providers (and get detailed info on each provider) using python 3:


Note that in when using both cURL and python requests, SSL verification must be turned OFF (using -k flag in cURL, and verify=False in requests) because the Cloudforms instance uses a private certificate that is unknown to Certificate Authorities.

댓글 없음:

댓글 쓰기