Bug 1418331

Summary: incorrect href keys for service and automation requests accessed through /api/requests
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Jillian Tullo <jtullo>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: high Docs Contact:
Priority: high    
Version: 5.7.0CC: cpelland, dajohnso, jhardy, jtullo, obarenbo
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1455933 (view as bug list) Environment:
Last Closed: 2018-03-06 15:21:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1455933    

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