Document URL: https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/6.1/html/API_Guide/chap-Red_Hat_Satellite-API_Guide-Examples.html Section Number and Name: Chapter 4. Examples, all Sections Describe the issue: Currently the examples show how to talk to the API using "plain" Ruby and Python. While this is good and should be definitely kept, I think we also should add some higher level examples. Suggestions for improvement: For Ruby I can think adding Apipie Bindings would be great. Apipie Bindings (rubygem-apipie-bindings in sat6-tools, upstream: https://github.com/Apipie/apipie-bindings) allows to fetch the API definition from the Satellite directly and then generates proper calls on demand. e.g. to fetch the Orgs from Satellite: require 'apipie-bindings' url = 'https://satellite6.example.com/api/' username = 'admin' password = 'changeme' api = ApipieBindings::API.new({:uri => url, :username => username, :password => password, :api_version => '2'}) req = api.resource(:organizations).call(:index) # do something with req['results'] For Python NailGun (https://github.com/SatelliteQE/nailgun, not packaged in RHEL yet) could be a great addition (in the future). There are a couple of good examples at https://nailgun.readthedocs.org/en/latest/examples.html Additional information: Plain Ruby/Python examples should be kept as they can run "everywhere" and have no dependencies.
Upstream docs are going to have this too: http://projects.theforeman.org/issues/17469 https://github.com/theforeman/theforeman.org/pull/754
And that's now live: https://theforeman.org/manuals/1.13/#5.1.9UsingApipie-Bindings
Hello Thank you for raising this bug
Hello Tomas As discussed in our meeting: Please provide some APIPIE examples to match the examples we currently have in the API guide[1] Thank you [1] https://access.redhat.com/documentation/en/red-hat-satellite/6.2/paged/api-guide/chapter-4-getting-started-with-the-red-hat-satellite-api#sect-API_Guide-API_Examples_Using_Curl
Created attachment 1239155 [details] Apipie bindings example Please find the apipie bindings examples attached.
Please note that the attached examples are intended to be used with sat 6.2. Let me know if 6.1 version is needed too. Btw I discovered the current examples in 6.2 docs are broken: https://bugzilla.redhat.com/show_bug.cgi?id=1411892
(In reply to Tomas Strachota from comment #6) > Please note that the attached examples are intended to be used with sat 6.2. Thank you very much Tomas > Let me know if 6.1 version is needed too. I don't think that will be necessary, thank you. > > Btw I discovered the current examples in 6.2 docs are broken: > https://bugzilla.redhat.com/show_bug.cgi?id=1411892 Thank you for noticing and for raising that bug.
Hello Tomas Please check this line is correct: prior_env_id = call_api(:lifecycle_environments, :create, {"name" => environment, "organization_id" => org_id, "prior_id" => prior_env_id, 'organization_id' => org_id })['id'] I ask because "organization_id" is duplicated. Than you
Nice catch, it should have been: prior_env_id = call_api(:lifecycle_environments, :create, {"name" => environment, "organization_id" => org_id, "prior_id" => prior_env_id })['id'] It doesn't break functionality but the second organization_id is redundant. Just remove it, please.
Thank you Tomas Another question; I want to change localhost in this bit: # Create an instance of apipie bindings @api = ApipieBindings::API.new({ :uri => 'https://localhost/', :username => 'admin', :password => 'changeme', :api_version => 2 }) To: https://satellite6.example.com or https://satellite6.example.com/katello/api/v2/ Thank you
https://satellite6.example.com the rest is auto-detected by apipie :)
(In reply to Evgeni Golov from comment #11) > https://satellite6.example.com > > the rest is auto-detected by apipie :) thank you
Stephen, the correct version would be: 'https://satellite6.example.com/' Localhost is remnant from my testing.
This content is now live on the Customer Portal. Closing.