Bug 1267933 - the chargebacks rest api lists the charges, not the reports
the chargebacks rest api lists the charges, not the reports
Status: CLOSED NOTABUG
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API (Show other bugs)
5.4.0
All All
high Severity medium
: GA
: 5.5.0
Assigned To: Tim Wade
Dave Johnson
:
Depends On:
Blocks: 1272547
  Show dependency treegraph
 
Reported: 2015-10-01 08:16 EDT by Felix Dewaleyne
Modified: 2015-11-04 13:25 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1272547 (view as bug list)
Environment:
Last Closed: 2015-11-04 13:25:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
sample.log (4.22 KB, text/plain)
2015-10-01 08:16 EDT, Felix Dewaleyne
no flags Details

  None (edit)
Description Felix Dewaleyne 2015-10-01 08:16:39 EDT
Created attachment 1079076 [details]
sample.log

Description of problem:
the chargebacks rest api lists the charges, not the reports

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

How reproducible:
all the time

Steps to Reproduce:
1. configure a report, queue it at least once
2.  curl --user admin:smartvm -i -X GET -H "Accept: application/json" --insecure https://vm-207.gsslab.fab.redhat.com/api/chargebacks
3. curl --user admin:smartvm -i -X GET -H "Accept: application/json" --insecure https://vm-207.gsslab.fab.redhat.com/api/chargebacks/1000000000002
4. curl --user admin:smartvm -i -X GET -H "Accept: application/json" --insecure https://vm-207.gsslab.fab.redhat.com/api/chargebacks/1000000000001

Actual results:
see logs attached

Expected results:
list of reports not charges.

Additional info:
see bz#123827 and bz#1245715 for the feature request into 5.4.2 and upstream
Comment 2 Tim Wade 2015-10-08 11:01:39 EDT
Felix: This looks correct to me. In order to access the reports you'll need to use the reports API
Comment 3 Felix Dewaleyne 2015-10-08 11:12:55 EDT
(In reply to Tim Wade from comment #2)
> Felix: This looks correct to me. In order to access the reports you'll need
> to use the reports API

that contradicts bz#123827's description of the feature and this is the output of the current release :

curl --user admin:smartvm -i -X GET -H "Accept: application/json" --insecure https://vm-207.gsslab.fab.redhat.com/api/reports
HTTP/1.1 400 Bad Request
Date: Thu, 08 Oct 2015 15:06:22 GMT
Server: thin 1.3.1 codename Triple Espresso
Strict-Transport-Security: max-age=631152000
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'self'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self' data:; media-src 'self'; object-src 'self'; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'; report-uri /dashboard/csp_report;
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Content-Type: application/json; charset=utf-8
Cache-Control: private
X-Rack-Cache: miss
X-UA-Compatible: IE=Edge,chrome=1

there does not seem to be a report api :

HTTP/1.1 200 OK
Date: Thu, 08 Oct 2015 15:08:12 GMT
Server: thin 1.3.1 codename Triple Espresso
Strict-Transport-Security: max-age=631152000
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'self'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self' data:; media-src 'self'; object-src 'self'; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'; report-uri /dashboard/csp_report;
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Content-Type: application/json; charset=utf-8
Cache-Control: private
X-Rack-Cache: miss
X-UA-Compatible: IE=Edge,chrome=1
ETag: "89bd4107227fd73814623ebdbe5a4bee"
X-Request-Id: d112fad7fe7feb5cdd19632b6153b160
X-Runtime: 0.145865
Set-Cookie: _vmdb_session=460ba83156ee6043546ca2c1489c3b29; path=/; secure; HttpOnly
Transfer-Encoding: chunked

{"name":"API","description":"REST API","version":"2.0.0","versions":[{"name":"2.0.0","href":"https://vm-207.gsslab.fab.redhat.com/api/v2.0.0"}],"collections":[{"name":"automation_requests","href":"https://vm-207.gsslab.fab.redhat.com/api/automation_requests","description":"Automation Requests"},{"name":"availability_zones","href":"https://vm-207.gsslab.fab.redhat.com/api/availability_zones","description":"Availability Zones"},{"name":"chargebacks","href":"https://vm-207.gsslab.fab.redhat.com/api/chargebacks","description":"Chargebacks"},{"name":"clusters","href":"https://vm-207.gsslab.fab.redhat.com/api/clusters","description":"Clusters"},{"name":"conditions","href":"https://vm-207.gsslab.fab.redhat.com/api/conditions","description":"Conditions"},{"name":"data_stores","href":"https://vm-207.gsslab.fab.redhat.com/api/data_stores","description":"Datastores"},{"name":"events","href":"https://vm-207.gsslab.fab.redhat.com/api/events","description":"Events"},{"name":"flavors","href":"https://vm-207.gsslab.fab.redhat.com/api/flavors","description":"Flavors"},{"name":"groups","href":"https://vm-207.gsslab.fab.redhat.com/api/groups","description":"Groups"},{"name":"hosts","href":"https://vm-207.gsslab.fab.redhat.com/api/hosts","description":"Hosts"},{"name":"policies","href":"https://vm-207.gsslab.fab.redhat.com/api/policies","description":"Policies"},{"name":"policy_actions","href":"https://vm-207.gsslab.fab.redhat.com/api/policy_actions","description":"Actions"},{"name":"policy_profiles","href":"https://vm-207.gsslab.fab.redhat.com/api/policy_profiles","description":"Policy Profiles"},{"name":"providers","href":"https://vm-207.gsslab.fab.redhat.com/api/providers","description":"Providers"},{"name":"provision_requests","href":"https://vm-207.gsslab.fab.redhat.com/api/provision_requests","description":"Provision Requests"},{"name":"request_tasks","href":"https://vm-207.gsslab.fab.redhat.com/api/request_tasks","description":"Request Tasks"},{"name":"requests","href":"https://vm-207.gsslab.fab.redhat.com/api/requests","description":"Requests"},{"name":"resource_pools","href":"https://vm-207.gsslab.fab.redhat.com/api/resource_pools","description":"Resource Pools"},{"name":"roles","href":"https://vm-207.gsslab.fab.redhat.com/api/roles","description":"Roles"},{"name":"security_groups","href":"https://vm-207.gsslab.fab.redhat.com/api/security_groups","description":"Security Groups"},{"name":"servers","href":"https://vm-207.gsslab.fab.redhat.com/api/servers","description":"EVM Servers"},{"name":"service_catalogs","href":"https://vm-207.gsslab.fab.redhat.com/api/service_catalogs","description":"Service Catalogs"},{"name":"service_requests","href":"https://vm-207.gsslab.fab.redhat.com/api/service_requests","description":"Service Requests"},{"name":"service_templates","href":"https://vm-207.gsslab.fab.redhat.com/api/service_templates","description":"Service Templates"},{"name":"services","href":"https://vm-207.gsslab.fab.redhat.com/api/services","description":"Services"},{"name":"tags","href":"https://vm-207.gsslab.fab.redhat.com/api/tags","description":"Tags"},{"name":"tasks","href":"https://vm-207.gsslab.fab.redhat.com/api/tasks","description":"Request Tasks"},{"name":"templates","href":"https://vm-207.gsslab.fab.redhat.com/api/templates","description":"Templates"},{"name":"users","href":"https://vm-207.gsslab.fab.redhat.com/api/users","description":"Users"},{"name":"vms","href":"https://vm-207.gsslab.fab.redhat.com/api/vms","description":"Virtual Machines"},{"name":"zones","href":"https://vm-207.gsslab.fab.redhat.com/api/zones","description":"Zones"}]}
X-Request-Id: cd597d4a8aa005305794ab18b7772fc2
X-Runtime: 0.143290
Set-Cookie: _vmdb_session=fe62f94021b8084d89568fd3b56d87e6; path=/; secure; HttpOnly
Connection: close
Transfer-Encoding: chunked

{"error":{"kind":"bad_request","message":"Unsupported Collection reports specified","klass":"ApiController::BadRequestError"}}%
Comment 4 Felix Dewaleyne 2015-10-08 11:14:51 EDT
made a typo with the bz number - I meant this one :

https://bugzilla.redhat.com/show_bug.cgi?id=1245715

it states "chargeback reports"
Comment 5 Felix Dewaleyne 2015-10-08 11:16:49 EDT
the 3rd update also points to the same path :

https://bugzilla.redhat.com/show_bug.cgi?id=1245715#c3
Comment 6 Tim Wade 2015-10-13 18:09:19 EDT
Felix,

Yes, it looks like the Chargebacks API (which is for managing rates) was backported to 5.4.2, but the Reports API (which is for running and retrieving reports, including chargeback reports) was not. It seems that the correct resolution of this would be to backport the Reports API to 5.4.2, which I will do ASAP.
Comment 9 Tim Wade 2015-11-02 18:19:00 EST
Felix,

I am going to leverage `gems/cfme_client/bin/rest_api.rb` for simplicity here.

1. List all the reports (which will include chargeback reports, if present):

tim@tim-thinkpad:~/src/manageiq/gems/cfme_client$ bundle exec bin/rest_api.rb get reports

2. Show a single report:

tim@tim-thinkpad:~/src/manageiq/gems/cfme_client$ be bin/rest_api.rb get reports/<id>

3. List a report's results:

tim@tim-thinkpad:~/src/manageiq/gems/cfme_client$ be bin/rest_api.rb get reports/<report id>/results

4. Show a one of the report's results:

tim@tim-thinkpad:~/src/manageiq/gems/cfme_client$ be bin/rest_api.rb get reports/<report id>/results/<id>

5. Run a report

tim@tim-thinkpad:~/src/manageiq/gems/cfme_client$ be bin/rest_api.rb post reports/<id>
Enter data to send with request:
Terminate with "" or "."
{"action": "run"}
Comment 10 Felix Dewaleyne 2015-11-03 07:36:55 EST
Tim, I've re-ran my tests against a 5.4.3.1 and now I can definitely find the reports api. I was previously using cfme-5.4.2 and so was the customer. as of 5.4.3 that does work.

I think the confusion was on the update level.
Comment 11 Tim Wade 2015-11-03 12:23:21 EST
Felix,

No problem. Is that sufficient to resolve this issue?
Comment 12 Felix Dewaleyne 2015-11-04 12:26:19 EST
that should be, I'll need the customer's confirmation but whatever they come back with, it'll have to be a new bz from my point of view as it'll be a bug against an existing api now.
Comment 13 Tim Wade 2015-11-04 13:25:36 EST
Thanks! I'll go ahead an close this

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