Bug 1275960 - Inconsistent and Duplicate API for attaching subscriptions to activation keys
Summary: Inconsistent and Duplicate API for attaching subscriptions to activation keys
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.1.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2015-10-28 08:15 UTC by Peter Vreman
Modified: 2019-09-25 21:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-01 13:00:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Peter Vreman 2015-10-28 08:15:04 UTC
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")


vs.

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


Proposal:
- 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:
1.
2.
3.

Actual results:


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


Additional info:

Comment 1 Peter Vreman 2015-10-28 15:36:55 UTC
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
Params
Param name 	Description
id
optional 	

Subscription ID

Value: String
system_id
optional 	

UUID of the system

Value: String
activation_key_id
optional 	

activation key ID

Value: String
subscriptions
optional 	

Array of subscriptions to add

Value: Must be an Array of nested elements
subscriptions[id]
optional 	

Subscription Pool uuid

Value: String

Comment 2 Bryan Kearney 2016-07-26 19:10:46 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 3 Peter Vreman 2016-12-01 13:00:18 UTC
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.