Description of problem: During an API request to order a service catalog, a required dynamic dialog is causing the order to fail. A bad request response is returned. This is a generic service that has a service dialog with 2 elements named 'Input' and 'Text Box'. 'Input' is a statically populated drop down and 'Text Box' is a dynamically populated text box. The 'Input' dialog is supposed to trigger a refresh on the 'Text Box' dialog. I have tested this service in the classic UI and SSUI, both behave normally. However via the API, if the dialog 'Text Box' is set to be required and refreshed by dialog "Input", I can not order the service. This is a fresh 5.9.4.7 appliance. ************************************************************************************************ **1** WHEN ORDERING SERVICE VIA API AND USING ACTIONS {"order" and then "refresh_dialog_fields"} ************************************************************************************************ root@dhcp153-198 log]# curl -u admin:smartvm -k -H "Accept: application/json" --request POST --data '{ "action": "order", "resource": {"href":"https://localhost:3000/api/service_templates/1000000000001","input_dropdown":"One"}, "action": "refresh_dialog_fields", "resource" : { "href" : "http://localhost:3000/api/service_templates/1000000000001", "dialog_fields" : { "input_dropdown": "One"}, "fields" : ["text_box"]}}' https://10.13.153.198/api/service_catalogs/1000000000001/service_templates {"results":[{"success":true,"message":"Refreshing dialog fields for Service Template id:1000000000001 name:'API_Test'","result":{"text_box":{"name":"text_box","description":"","display":"edit","display_method_options":{},"required":true,"required_method_options":{},"default_value":"","values_method_options":{},"options":{"protected":false},"label":"Text Box","position":1,"reconfigurable":false,"dynamic":true,"show_refresh_button":false,"load_values_on_init":false,"read_only":false,"auto_refresh":false,"trigger_auto_refresh":false,"visible":true,"type":"DialogFieldTextBox","resource_action":{"resource_type":"DialogField","ae_namespace":"Dialogs","ae_class":"Methods","ae_instance":"Text_Box","ae_attributes":{}},"dialog_field_responders":[],"values":"TB Ping Pong"}},"service_template_id":"1000000000001","service_template_href":"https://10.13.153.198/api/service_templates/1000000000001","href":"https://10.13.153.198/api/service_catalogs/1000000000001"}]} *********************************************************************************************** **2** WHEN ORDERING SERVICE VIA API AND USING ACTIONS {"refresh_dialog_fields" and then "order" *********************************************************************************************** [root@dhcp153-198 log]# curl -u admin:smartvm -k -H "Accept: application/json" --request POST --data '{ "action": "refresh_dialog_fields", "resource" : { "href" : "http://localhost:3000/api/service_templates/1000000000001", "dialog_fields" : { "input_dropdown": "One"}, "fields" : ["text_box"]}, "action": "order", "resource": {"href":"https://localhost:3000/api/service_templates/1000000000001","input_dropdown":"One"}}' https://10.13.153.198/api/service_catalogs/1000000000001/service_templates {"error":{"kind":"bad_request","message":"Failed to order Service Template id:1000000000001 name:'API_Test' - New tab/New section/Text Box is required","klass":"Api::BadRequestError"}} **************************************************************************************** **3** WHEN ORDERING SERVICE VIA API USING ACTION "order" and REQUIRED FLAG IS TURNED OFF **************************************************************************************** [root@dhcp153-198 log]# curl -u admin:smartvm -k -H "Accept: application/json" --request POST --data '{"action": "order", "resource": {"href":"https://localhost:3000/api/service_templates/1000000000001","input_dropdown":"One"}}' https://10.13.153.198/api/service_catalogs/1000000000001/service_templates {"results":[{"href":"https://10.13.153.198/api/service_requests/1000000000009","id":"1000000000009","description":"Provisioning Service [API_Test] from [API_Test]","approval_state":"pending_approval","type":"ServiceTemplateProvisionRequest","created_on":"2018-09-07T17:11:37Z","updated_on":"2018-09-07T17:11:37Z","requester_id":"1000000000001","requester_name":"Administrator","request_type":"clone_to_service","request_state":"pending","message":"Service_Template_Provisioning - Request Created","status":"Ok","options":{"dialog":{"dialog_input_dropdown":"One"},"workflow_settings":{"resource_action_id":"1000000000015","dialog_id":"1000000000002"},"src_id":"1000000000001","request_options":{"submit_workflow":true},"cart_state":"ordered","requester_group":"EvmGroup-super_administrator"},"userid":"admin","source_id":"1000000000001","source_type":"ServiceTemplate","tenant_id":"1000000000001","service_order_id":"1000000000007","process":true}]} Of the 3 examples above, the first 2 do no generate a service request, only the last curl request generates a valid service request (this only works because the required flag was removed from the Text Box dialog). The service is provisioned successfully. Ordering the service with just the "order" action and the required flag is turned on produces the same results as #2 above. Version: CFEM 5.9.4.7 How reproducible: always Steps to Reproduce: 1. Create a service dialog with 2 elements named Input (statically populated dropdown) and Text Box (dynamically populated text box) 2. Text Box is set to be required, and is refreshed whenever Input changes values 3. Create a Generic service that uses the service dialog created in step 1 3. Order the generic service via the API with curl command Actual results: The service catalog is not ordered Expected results: The service catalog is ordered Additional info: Reproducer on 10.13.153.198 admin:smartvm Service Catalog : Yoder => API_Test Service Dialog : API_Required_Test
Yoder, We looked (me, Julian and Brandon) at this and noticed that example **2** can't work because action is specified twice in the parameters. One action "order" or "refresh_dialog_fields" will overwrite the other. We tried to do this in 2 requests, refresh_dialog_fields followed by order. That seems to work - Refresh: curl -u admin:smartvm -k -H "Accept: application/json" --request POST --data '{ "action": "refresh_dialog_fields", "resource" : { "href" : "http://localhost:3000/api/service_templates/1000000000001", "dialog_fields" : { "input_dropdown": "One"}, "fields" : ["text_box"]}}' https://10.13.153.198/api/service_catalogs/1000000000001/service_templates {"results":[{"success":true,"message":"Refreshing dialog fields for Service Template id:1000000000001 name:'API_Test'","result":{"text_box":{"name":"text_box","description":"","display":"edit","display_method_options":{},"required":true,"required_method_options":{},"default_value":"","values_method_options":{},"options":{"protected":false},"label":"Text Box","position":1,"reconfigurable":false,"dynamic":true,"show_refresh_button":false,"load_values_on_init":false,"read_only":false,"auto_refresh":false,"trigger_auto_refresh":false,"visible":true,"type":"DialogFieldTextBox","resource_action":{"resource_type":"DialogField","ae_namespace":"Dialogs","ae_class":"Methods","ae_instance":"Text_Box","ae_attributes":{}},"dialog_field_responders":[],"values":"TB Ping Pong"}},"service_template_id":"1000000000001","service_template_href":"https://10.13.153.198/api/service_templates/1000000000001","href":"https://10.13.153.198/api/service_catalogs/1000000000001"}]} Followed by oder, taking the value of "text_box" that was returned from the refresh and plugging it in - curl -u admin:smartvm -k -H "Accept: application/json" --request POST --data '{ "action": "order", "resource" : { "href" : "http://localhost:3000/api/service_templates/1000000000001", "input_dropdown": "One", "text_box": "TB Ping Pong"}}' https://10.13.153.198/api/service_catalogs/1000000000001/service_templates {"results":[{"href":"https://10.13.153.198/api/service_requests/1000000000013","id":"1000000000013","description":"Provisioning Service [API_Test] from [API_Test]","approval_state":"pending_approval","type":"ServiceTemplateProvisionRequest","created_on":"2018-09-21T14:15:57Z","updated_on":"2018-09-21T14:15:57Z","requester_id":"1000000000001","requester_name":"Administrator","request_type":"clone_to_service","request_state":"pending","message":"Service_Template_Provisioning - Request Created","status":"Ok","options":{"dialog":{"dialog_input_dropdown":"One","dialog_text_box":"TB Ping Pong"},"workflow_settings":{"resource_action_id":"1000000000015","dialog_id":"1000000000002"},"src_id":"1000000000001","request_options":{"submit_workflow":true},"cart_state":"ordered","requester_group":"EvmGroup-super_administrator"},"userid":"admin","source_id":"1000000000001","source_type":"ServiceTemplate","tenant_id":"1000000000001","service_order_id":"1000000000011","process":true}]} We're not sure how the customer was doing this when it was successful in 5.9.3. Were they able to do this in a single request? If so, can we get that request? For reference, here's the API doc - http://manageiq.org/docs/reference/latest/api/reference/services#service-templates, Look for "Ordering Services Service Templates"
*** This bug has been marked as a duplicate of bug 1635673 ***