This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1275960 - Inconsistent and Duplicate API for attaching subscriptions to activation keys
Inconsistent and Duplicate API for attaching subscriptions to activation keys
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: Unspecified
: --
Assigned To: satellite6-bugs
Katello QA List
: Triaged
Depends On:
Blocks: 1122832
  Show dependency treegraph
Reported: 2015-10-28 04:15 EDT by Peter Vreman
Modified: 2016-12-01 08:00 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-12-01 08:00:18 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Vreman 2015-10-28 04:15:04 EDT
Description of problem:
The API is inconsistent regrading attaching subscriptions:
 1. add_subscriptions in the acitvation keys controller vs the susbcription controller that is generic
 2. activation keys controller has add_susbcriptions and remove_subscriptions, but the systems does not have it
 3. The wording Add vs Attach

    api :POST, "/systems/:system_id/subscriptions", N_("Add a subscription to a system"), :deprecated => true
    api :POST, "/activation_keys/:activation_key_id/subscriptions", N_("Add a subscription to an activation key")

    api :DELETE, "/systems/:system_id/subscriptions/:id", N_("Unattach a subscription"), :deprecated => true
    api :DELETE, "/activation_keys/:activation_key_id/subscriptions/:id", N_("Unattach a subscription")


    api :PUT, "/activation_keys/:id/add_subscriptions", N_("Attach a subscription")
    api :PUT, "/activation_keys/:id/remove_subscriptions", N_("Unattach a subscription")

- Remove the add_subscriptions and remove_subscriptions from the activation keys controller. The add_ and remove_ prefixes are inconsistent with other parts of the API. Secondly yt is not available in the systems controller. Third it is not really RESTful with having PUT for adding and deleting
- Change the wording of Add to Attach in the subscriptions controller

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:
Consistent API for adding subscriptions, see proposal above

Additional info:
Comment 1 Peter Vreman 2015-10-28 11:36:55 EDT
Another issue with the DELETE, in the apidoc is lists the the :id shall be part of the URL _and_ it shall also be provided in a subscriptions[] array. this is duplicate information.

DELETE /katello/api/systems/:system_id/subscriptions/:id DEPRECATED
Unattach a subscription
DELETE /katello/api/activation_keys/:activation_key_id/subscriptions/:id
Unattach a subscription
Param name 	Description

Subscription ID

Value: String

UUID of the system

Value: String

activation key ID

Value: String

Array of subscriptions to add

Value: Must be an Array of nested elements

Subscription Pool uuid

Value: String
Comment 2 Bryan Kearney 2016-07-26 15:10:46 EDT
Moving 6.2 bugs out to sat-backlog.
Comment 3 Peter Vreman 2016-12-01 08:00:18 EST
Closing this is now consistent in Sat6.2 with the non-deprecated API calls:

PUT /katello/api/activation_keys/:id/add_subscriptions
PUT /katello/api/activation_keys/:id/remove_subscriptions

PUT /api/hosts/:host_id/subscriptions/remove_subscriptions 	
PUT /api/hosts/:host_id/subscriptions/add_subscriptions

Note You need to log in before you can comment on or make changes to this bug.