Bug 1329748 - API Doc for content view publishing is wrong
Summary: API Doc for content view publishing is wrong
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API - Content
Version: 6.1.8
Hardware: All
OS: Linux
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact: Nikhil Kathole
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-22 20:14 UTC by Erinn Looney-Triggs
Modified: 2020-09-10 09:36 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1480316 (view as bug list)
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:


Attachments (Terms of Use)
API call to publish content view supplying id parameter (1.36 KB, text/plain)
2017-08-03 19:32 UTC, Christine Fouant
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20471 0 None None None 2017-08-10 17:01:15 UTC

Description Erinn Looney-Triggs 2016-04-22 20:14:54 UTC
Description of problem:
The generated API documentation for content views, specifically the POST for publish is incorrect. It states:
POST /katello/api/content_views/:id/publish 
Publish a content view

Params

Param name	Description
id 
required	
Content view identifier


Value: string from 2 to 128 characters containting only alphanumeric characters, space, '_', '-' with no leading or trailing space..
description 
optional	
Description for the new published content view version


Value: String

If you actually pass the id as a parameter, the content view will not publish. It makes sense as the ID is already in the path, but the documentation is simply wrong. 

Using hammer in debug mode you can see the same:
[ INFO 2016-04-22 12:56:23 API] POST /katello/api/content_views/35/publish
[DEBUG 2016-04-22 12:56:23 API] Params: {}
[DEBUG 2016-04-22 12:56:23 API] Headers: {}

So the doc needs to be fixed. Note again this is in the autogenerated apidoc, I have no idea what is in the docs hosted by red hat.

-Erinn

Comment 1 Stephen Wadeley 2017-01-03 14:34:15 UTC
This bug is for the builtin API reference doc, not the API Guide.

We need to change the Bugzilla component to API as "Docs API Guide" means the guide on the customer portal.


Thank you

Comment 4 Christine Fouant 2017-08-03 19:32:55 UTC
Created attachment 1308864 [details]
API call to publish content view supplying id parameter

In 6.3.0, the API call POST /katello/api/content_views/:id/publish is able to publish with or without the id parameter passed in.

Comment 5 Nikhil Kathole 2017-11-17 11:58:21 UTC
Version Tested:
Satellite 6.3 beta

As per comment #4, It seems that id parameter is optional for publishing content view.But I can see doc https://satellite/apidoc/v2/content_views.html is showing id parameter as required. Should it be mentioned as "optional" in doc?

 and when I tried using id parameter, publishing content view started.But it shows warning as Invalid URL

curl -s -X POST -k -u admin:<passwd> id '{"id":'2'}' https://satellite/katello/api/content_views/2/publish --header "Content-Type:application/json"

<HTML><HEAD>
<TITLE>Invalid URL</TITLE>
</HEAD><BODY>
<H1>Invalid URL</H1>
The requested URL "&#91;no&#32;URL&#93;", is invalid.<p>
Reference&#32;&#35;9&#46;527c4117&#46;1510919022&#46;e36070c
</BODY></HTML>

  {"id":"f48f7b25-30c6-472a-b797-fe5363fed3ae","label":"Actions::Katello::ContentView::Publish","pending":true,"username":"admin","started_at":"2017-11-17 11:43:43 UTC","ended_at":null,"state":"planned","result":"pending","progress":0.0,"input":{"content_view":{"id":2,"name":"capsule","label":"capsule"},"organization":{"id":1,"name":"Default Organization","label":"Default_Organization"},"services_checked":["pulp","pulp_auth","candlepin","candlepin_auth"],"history_id":6,"content_view_id":2,"environment_id":1,"user_id":3,"current_user_id":3},"output":{},"humanized":{"action":"Publish","input":[["content_view",{"text":"content view 'capsule'","link":"#/content_views/2/versions"}],["organization",{"text":"organization 'Default Organization'","link":"/organizations/1/edit"}]],"output":"","errors":[]},"cli_example":null}

Am I missing something here?

Comment 6 Nikhil Kathole 2018-01-22 12:14:27 UTC
Moving this to VERIFIED

In comment #5, warning showed due to typo in curl request (id in place of -d)

Version tested :
Satellite 6.3 snap 33

curl -s -X POST -k -u admin:pass https://sat/katello/api/content_views/5/publish --header "Content-Type:application/json"
  {"id":"4636976e-e422-4b90-a8ba-aa27b3cb9d89","label":"Actions::Katello::ContentView::Publish","pending":true,"username":"admin","started_at":"2018-01-22 12:09:07 UTC","ended_at":null,"state":"planned","result":"pending","progress":0.0,"input":{"content_view":{"id":5,"name":"test_CV","label":"test_CV"},"organization":{"id":1,"name":"Default Organization","label":"Default_Organization"},"history_id":16,"content_view_id":5,"environment_id":1,"user_id":3,"current_user_id":3},"output":{},"humanized":{"action":"Publish","input":[["content_view",{"text":"content view 'test_CV'","link":"#/content_views/5/versions"}],["organization",{"text":"organization 'Default Organization'","link":"/organizations/1/edit"}]],"output":"","errors":[]},"cli_example":null}


curl -s -X POST -k -u admin:pass -d '{"id":'5'}' https://sat/katello/api/content_views/5/publish --header "Content-Type:application/json"
  {"id":"62fd092e-577b-417e-834c-ccf225c956a4","label":"Actions::Katello::ContentView::Publish","pending":true,"username":"admin","started_at":"2018-01-22 12:08:21 UTC","ended_at":null,"state":"planned","result":"pending","progress":0.0,"input":{"content_view":{"id":5,"name":"test_CV","label":"test_CV"},"organization":{"id":1,"name":"Default Organization","label":"Default_Organization"},"history_id":15,"content_view_id":5,"environment_id":1,"user_id":3,"current_user_id":3},"output":{},"humanized":{"action":"Publish","input":[["content_view",{"text":"content view 'test_CV'","link":"#/content_views/5/versions"}],["organization",{"text":"organization 'Default Organization'","link":"/organizations/1/edit"}]],"output":"","errors":[]},"cli_example":null}

Found able to publish with or without the id parameter in request.

Comment 8 Satellite Program 2018-02-21 16:54:37 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-2018:0336


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