Bug 1418331 - incorrect href keys for service and automation requests accessed through /api/requests
Summary: incorrect href keys for service and automation requests accessed through /api...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: Jillian Tullo
QA Contact: Martin Kourim
URL:
Whiteboard: api:rest
Depends On:
Blocks: 1455933
TreeView+ depends on / blocked
 
Reported: 2017-02-01 15:05 UTC by Martin Kourim
Modified: 2018-03-06 15:21 UTC (History)
5 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1455933 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:21:08 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:


Attachments (Terms of Use)

Description Martin Kourim 2017-02-01 15:05:40 UTC
Description of problem:
For provision, service and automation requests, the same resource can be accessed through /api/requests or through /api/{provision,service,automation}_requests.

Provision requests have "href" keys pointing to /api/requests collection when accessed through /api/requests and to /api/provision_requests collection when accessed through /api/provision_requests:
GET /api/requests/:id
{
  "href": "https://<address>/api/requests/<id>",
  ...
}
and
GET /api/provision_requests/:id
{
  "href": "https://<address>/api/provision_requests/<id>",
  ...
}

This is not the case for service and automation requests. Even when accessed through /api/requests, "href" keys point to /api/service_requests or /api/automation_requests:
GET /api/requests/:id
{
  "href": "https://<address>/api/service_requests/<id>",
  ...
}


This is problem especially for "actions". Under /api/requests/:id, "edit" action is present. Under /api/{provision,service,automation}_requests/:id, "edit" action is not present. I.e. "href" corresponding to "edit" action points to collection where the action is not actually supported:

GET /api/requests/:id
...
"actions": [
    {
      "name": "edit",
      "method": "post",
      "href": "https://<address>/api/service_requests/<id>" <== not valid, no "edit" action here
    },


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


How reproducible:
100%


Steps to Reproduce:
1. create provision, service and automation request
2. access each request through /api/requests and through /api/{provision,service,automation}_requests


Actual results:
For service and automation requests "href" points to /api/{service,automation}_requests/:id instead of to /api/requests/:id when accessed through /api/requests/:id


Expected results:
For service and automation requests "href" points to /api/requests/:id when accessed through /api/requests/:id

Comment 2 Jillian Tullo 2017-04-06 15:35:27 UTC
https://github.com/ManageIQ/manageiq/pull/14549

Comment 4 Martin Kourim 2017-10-19 08:28:01 UTC
Verified for service and automation requests that the "href" keys point to /api/requests when accessed through /api/requests


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