Bug 1105773

Summary: Going to /api/v2 should show me all apis for plugins and main foreman server
Product: Red Hat Satellite Reporter: Bryan Kearney <bkearney>
Component: APIAssignee: Mike McCune <mmccune>
Status: CLOSED ERRATA QA Contact: sthirugn <sthirugn>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.4CC: bbuckingham, cwelton, jfenal, jmontleo, mmccune, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7054
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:09:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
api endpoints none

Description Bryan Kearney 2014-06-07 12:35:11 UTC
If I go to /api/v2 in a fortello install, I do not see all the endpoints for katello in there. What I see listed is:

    "links": {
        "List all authsource ldaps": "/api/auth_source_ldaps",
        "List all media": "/api/media",
        "List of subnets": "/api/subnets",
        "List roles": "/api/roles",
        "List all hosts": "/api/hosts",
        "List all users": "/api/users",
        "List all ptables": "/api/ptables",
        "List all lookup_keys": "/api/lookup_keys",
        "List all architectures": "/api/architectures",
        "List templates": "/api/config_templates",
        "List all compute resources": "/api/compute_resources",
        "List all settings": "/api/settings",
        "List all audits": "/api/audits",
        "List all fact values": "/api/fact_values",
        "List all smart_proxies": "/api/smart_proxies",
        "List all models": "/api/models",
        "List all puppetclasses": "/api/puppetclasses",
        "Show available links": "/api",
        "List all operating systems": "/api/operatingsystems",
        "List all common parameters": "/api/common_parameters",
        "Get Dashboard results": "/api/dashboard",
        "List all usergroups": "/api/usergroups",
        "List all reports": "/api/reports",
        "List of domains": "/api/domains",
        "Get statistics": "/api/statistics",
        "List all bookmarks": "/api/bookmarks",
        "List all images for compute resource": "/api/compute_resources/:compute_resource_id/images",
        "List all autosign": "/api/smart_proxies/smart_proxy_id/autosign",
        "List all template kinds": "/api/template_kinds",
        "List all environments": "/api/environments",
        "List all hostgroups": "/api/hostgroups",
        "List custom info": "/katello/api/custom_info/:informable_type/:informable_id",
        "List distributors in environment": "/katello/api/environments/:environment_id/distributors",
        "List permissions for a role": "/katello/api/roles/:role_id/permissions",
        "Shows status of system and it's subcomponents": "/katello/api/about",
        "List LDAP groups associated with the role": "/katello/api/roles/:role_id/ldap_groups",
        "Get list of errata associated with the host collection": "/katello/api/organizations/:organization_id/host_collections/:host_collection_id/errata",
        "Show status": "/api/status"
    }

Comment 2 Walden Raines 2014-07-30 15:16:14 UTC
It looks like the routing for /api/v2 is incorrectly routing to /api/v1 (or at least pointing to v1 apipie docs instead of v2):

[walden@[redacted] katello (6828)]$ diff -dbu <(curl -s http://admin:changeme@[redacted]/api/v1) <(curl -s http://admin:changeme@[redacted]/api/v2)
[walden@[redacted] katello (6828)]$

So I'm moving this over to the foreman team.

Comment 3 Dominic Cleal 2014-07-30 16:13:45 UTC
Created redmine issue http://projects.theforeman.org/issues/6844 from this bug

Comment 4 jaudet 2014-08-04 17:17:05 UTC
Created a GitHub issue to track progress on testing this issue. See: https://github.com/omaciel/robottelo/issues/1127

Comment 5 Bryan Kearney 2014-08-05 12:02:55 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6844 has been closed
-------------
dustin tsang
Applied in changeset commit:06bbfc35fec892e6d3c077fe1eb9f3410ab510f7.

Comment 8 sthirugn@redhat.com 2014-08-11 19:23:04 UTC
This is what I got by a simple GET of https:sat6host.redhat.com/api/v2
{
  "links": {
    "List all discovered hosts": "/api/discovered_hosts",
    "Get list of errata associated with the host collection": "/katello/api/organizations/:organization_id/host_collections/:host_collection_id/errata",
    "List activation keys": "/katello/api/activation_keys",
    "List all smart_proxies": "/api/smart_proxies",
    "List all capsules": "/katello/api/capsules",
    "List filter rules": "/katello/api/content_view_filters/:content_view_filter_id/rules",
    "List filters": "/katello/api/content_views/:content_view_id/filters",
    "List content view puppet modules": "/katello/api/content_views/:content_view_id/content_view_puppet_modules",
    "List content view versions": "/katello/api/content_view_versions",
    "List content views": "/katello/api/organizations/:organization_id/content_views",
    "List distributions": "/katello/api/repositories/:repository_id/distributions",
    "List environments in an organization": "/katello/api/environments",
    "List errata": "/katello/api/errata",
    "List gpg keys": "/katello/api/gpg_keys",
    "List host collections": "/katello/api/host_collections",
    "List all organizations": "/katello/api/organizations",
    "List package groups": "/katello/api/package_groups",
    "List packages": "/katello/api/repositories/:repository_id/packages",
    "Shows status of system and it's subcomponents": "/katello/api/ping",
    "List products": "/katello/api/products",
    "List puppet modules": "/katello/api/puppet_modules",
    "List of enabled repositories": "/katello/api/repositories",
    "List repository sets for a product": "/katello/api/products/:product_id/repository_sets",
    "List organization subscriptions": "/katello/api/organizations/:organization_id/subscriptions",
    "Get status of repo synchronisation for given product": "/katello/api/organizations/:organization_id/products/:product_id/sync",
    "List sync plans": "/katello/api/organizations/:organization_id/sync_plans",
    "List content hosts": "/katello/api/systems",
    "List all tasks for a given orchestration event": "/katello/api/orchestration/:id/tasks",
    "List all users": "/api/users",
    "List all architectures": "/api/architectures",
    "List all audits": "/api/audits",
    "List all authsource ldaps": "/api/auth_source_ldaps",
    "List all autosign": "/api/smart_proxies/smart_proxy_id/autosign",
    "List all bookmarks": "/api/bookmarks",
    "List all common parameters": "/api/common_parameters",
    "List of compute profiles": "/api/compute_profiles",
    "List all compute resources": "/api/compute_resources",
    "List of config groups": "/api/config_groups",
    "List templates": "/api/config_templates",
    "Get Dashboard results": "/api/dashboard",
    "List of domains": "/api/domains",
    "List all environments": "/api/environments",
    "List all fact values": "/api/fact_values",
    "List all filters": "/api/filters",
    "Show available links": "/api",
    "List all puppetclass id's for host": "/api/hosts/:host_id/puppetclass_ids",
    "List all puppetclass id's for hostgroup": "/api/hostgroups/:hostgroup_id/puppetclass_ids",
    "List all hostgroups": "/api/hostgroups",
    "List all hosts": "/api/hosts",
    "List all images for compute resource": "/api/compute_resources/:compute_resource_id/images",
    "List all interfaces for host": "/api/hosts/:host_id/interfaces",
    "List all locations": "/api/locations",
    "List all media": "/api/media",
    "List all models": "/api/models",
    "List all operating systems": "/api/operatingsystems",
    "List os default templates for operating system": "/api/operatingsystems/:operatingsystem_id/os_default_templates",
    "List of override values for a specific smart_variable": "/api/smart_variables/:smart_variable_id/override_values",
    "List all parameters for host": "/api/hosts/:host_id/parameters",
    "List all permissions": "/api/permissions",
    "List of installed plugins": "/api/plugins",
    "List all ptables": "/api/ptables",
    "List all puppetclasses": "/api/puppetclasses",
    "List of realms": "/api/realms",
    "List all reports": "/api/reports",
    "List all roles": "/api/roles",
    "List all settings": "/api/settings",
    "List all smart class parameters": "/api/smart_class_parameters",
    "List all smart variables": "/api/smart_variables",
    "Get statistics": "/api/statistics",
    "List of subnets": "/api/subnets",
    "List Template Combination": "/api/config_templates/:config_template_id/template_combinations",
    "List all template kinds": "/api/template_kinds",
    "List all user groups": "/api/usergroups",
    "Show status": "/api/status"
  }
}

Comment 9 sthirugn@redhat.com 2014-08-11 19:49:48 UTC
Failed. When I reviewed Comment 8, I dont see the following yet:
foreman tasks - https://$host/apidoc/v2/foreman_tasks
Home - https://$host/apidoc/v2/home
Host collection packages - https://$host/apidoc/v2/host_collection_packages
System errata - https://$host/apidoc/v2/system_errata
Tasks - https://$host/apidoc/v2/tasks

Version Tested:
GA Snap 4 - Satellite-6.0.4-RHEL-6-20140806.0

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.19-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.19-1.el6_5.noarch
* candlepin-tomcat6-0.9.19-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.38-1.el6sat.noarch
* foreman-compute-1.6.0.38-1.el6sat.noarch
* foreman-gce-1.6.0.38-1.el6sat.noarch
* foreman-libvirt-1.6.0.38-1.el6sat.noarch
* foreman-ovirt-1.6.0.38-1.el6sat.noarch
* foreman-postgresql-1.6.0.38-1.el6sat.noarch
* foreman-proxy-1.6.0.23-1.el6sat.noarch
* foreman-selinux-1.6.0.4-1.el6sat.noarch
* foreman-vmware-1.6.0.38-1.el6sat.noarch
* katello-1.5.0-28.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.57-1.el6sat.noarch
* openldap-2.4.23-34.el6_5.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
* pulp-server-2.4.0-0.30.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch
* sssd-ldap-1.11.5.1-3.el6.x86_64

Comment 10 Dustin Tsang 2014-08-13 16:34:34 UTC
new redmine issue created; display all routes not just the ones with an index action.

Comment 11 sthirugn@redhat.com 2014-10-10 20:06:37 UTC
*** This bug is verified in upstream.  This fix should eventually land in future downstream builds ***

See the attached 'endpoints' to see the list of endpoints now.

Version Tested:
Nightly Oct 10, 2014
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.32-1.el6.noarch
* candlepin-common-1.0.8-1.el6.noarch
* candlepin-selinux-0.9.32-1.el6.noarch
* candlepin-tomcat6-0.9.32-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-compute-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-gce-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-libvirt-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-ovirt-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-postgresql-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-proxy-1.7.0-0.develop.201410081229git52f0bac.el6.noarch
* foreman-release-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* foreman-selinux-1.7.0-0.develop.201409301113git2f345de.el6.noarch
* foreman-vmware-1.7.0-0.develop.201410091913git35b6fb9.el6.noarch
* katello-2.1.0-1.201410091751gitc9c45c1.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201410021645git304e036.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el6.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el6.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-selinux-2.5.0-0.7.beta.el6.noarch
* pulp-server-2.5.0-0.7.beta.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.1-1.el6.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
* ruby193-rubygem-runcible-1.2.0-1.el6.noarch

Comment 12 sthirugn@redhat.com 2014-10-10 20:07:00 UTC
Created attachment 945810 [details]
api endpoints

Comment 14 Bryan Kearney 2015-08-11 13:27:45 UTC
This bug is slated to be released with Satellite 6.1.

Comment 15 errata-xmlrpc 2015-08-12 05:09:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592