Bug 1532200 - service dialogs api calls create and edit inconsistency - cfme version 5.8.2.3
Summary: service dialogs api calls create and edit inconsistency - cfme version 5.8.2.3
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.10.0
Assignee: abellott
QA Contact: Niyaz Akhtar Ansari
URL:
Whiteboard:
Depends On:
Blocks: 1543119 1543121
TreeView+ depends on / blocked
 
Reported: 2018-01-08 10:55 UTC by Jiri Snopek
Modified: 2021-06-10 14:07 UTC (History)
6 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1543119 1543121 (view as bug list)
Environment:
Last Closed: 2019-02-11 14:05:31 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jiri Snopek 2018-01-08 10:55:27 UTC
Description of problem:
We found inconsistency in API during automating cfme customisation. API call for create expect slightly different input format ten edit call. We made a patch which accept same content as create call. Pull request is here: https://github.com/ManageIQ/manageiq/pull/16747

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

How reproducible:
HTTP POST to https://CMFE_IP/api/service_dialogs/55000000000002
for create working fine:
{
  "action" : "create",
  "resource" : {
    "label" : "updated_label",

      "dialog_tabs" : [
        "id" : 11,
        "label" : "updated_tab_label",
        "dialogs_groups" : [
          {
            "id" : 31,
            "dialog_fields" : [
               { "id" : 41 }
            ]
          }
        ]
      ]

  }
}

But for edit same thing with action: edit failing. There is necessary to add '"content" : {' before dialog_tabs.

{
  "action" : "edit",
  "resource" : {
    "label" : "updated_label",
    "content" : {
      "dialog_tabs" : [
        "id" : 11,
        "label" : "updated_tab_label",
        "dialogs_groups" : [
          {
            "id" : 31,
            "dialog_fields" : [
               { "id" : 41 }
            ]
          }
        ]
      ]
    }
  }
}




Steps to Reproduce:
1. HTTP POST to https://CMFE_IP/api/service_dialogs/55000000000002
{
  "action" : "create",
  "resource" : {
    "label" : "updated_label",

      "dialog_tabs" : [
        "id" : 11,
        "label" : "updated_tab_label",
        "dialogs_groups" : [
          {
            "id" : 31,
            "dialog_fields" : [
               { "id" : 41 }
            ]
          }
        ]
      ]

  }
}



2.HTTP POST to https://CMFE_IP/api/service_dialogs/55000000000002
{
  "action" : "edit",
  "resource" : {
    "label" : "updated_label",

      "dialog_tabs" : [
        "id" : 11,
        "label" : "updated_tab_label",
        "dialogs_groups" : [
          {
            "id" : 31,
            "dialog_fields" : [
               { "id" : 41 }
            ]
          }
        ]
      ]

  }
}


Actual results:
{
    "error": {
        "kind": "bad_request",
        "message": "Failed to update service dialog - DialogTab(#72444840) expected, got Hash(#15946100)",
        "klass": "Api::BadRequestError"
    }
}

Expected results:
{
    "href": "https://CFME_IP/api/service_dialogs/55000000000002",
    "id": 55000000000002,
    "description": "",
    "buttons": "submit,cancel",
    "label": "updated_label",
    "created_at": "2017-10-26T22:57:12Z",
    "updated_at": "2018-01-03T15:07:40Z"
}

Additional info:

Comment 2 Dave Johnson 2018-01-08 11:04:05 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 3 Jiri Snopek 2018-01-08 22:39:27 UTC
It's medium severity. It's non critical, but it really complicates api usage for unified administration via api.

Comment 4 Dave Johnson 2018-01-31 04:45:08 UTC
Increasing priority since there is a PR already, which dev took and re-worked to PR https://github.com/ManageIQ/manageiq-api/pull/285 .  Looks like this is going to miss 5.8.3 but could certainly go for 5.9.1 & 5.8.4.

Comment 7 Niyaz Akhtar Ansari 2018-11-13 12:43:17 UTC
Verified in Version 5.10.0.23.20181106165157_92dd189


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