How to fetch list of childrens from a multi row variable using Rest API

Dhiman
Tera Contributor

Hi Community,

I am trying to order a Service Request using REST API. The Service Request has a bunch of variables and out of those some of them are multirow variable sets. I am using the below Curl to fetch details of that Service Request

 

curl --location 'https://<masked_for_security_reason>/api/sn_sc/servicecatalog/items/e56a7ffe41011300964ff05369414ebd' \
--header 'Authorization: Basic <Masked_for_Security_Reason>' \

 

However, the above API response doesn't return the details of children for the multirow variable sets but does return children's details for the single-row variable set. Please find the JSON response

 

"variables":
            {
                "containerSplitId": null,
                "containerType": "one_to_many",
                "active": false,
                "label": "Multi Row Variable Set",
                "dynamic_value_field": "",
                "columnCount": 1,
                "type": "sc_multi_row",
                "mandatory": false,
                "displayvalue": "",
                "friendly_type": "sc_multi_row",
                "layout": "2across",
                "render_label": false,
                "read_only": false,
                "children": [],
                "name": "multi_row_variable_set",
                "attributes": "edge_encryption_enabled=true",
                "hasSplit": false,
                "containerEndId": null,
                "id": "a5d98a4497bab1106359f911f053af78",
                "value": null,
                "dynamic_value_dot_walk_path": "",
                "help_text": "",
                "max_length": 0,
                "order": -1
            },
            {
                "containerSplitId": null,
                "containerType": "one_to_one",
                "active": false,
                "label": "Single Row Variable Set",
                "dynamic_value_field": "",
                "columnCount": 1,
                "type": 0,
                "mandatory": false,
                "displayvalue": "",
                "friendly_type": "container_start",
                "layout": "normal",
                "render_label": false,
                "read_only": false,
                "children": [
                    {
                        "active": true,
                        "label": "Variable2 Single row variable set",
                        "dynamic_value_field": "",
                        "type": 6,
                        "mandatory": false,
                        "displayvalue": "",
                        "friendly_type": "single_line_text",
                        "display_type": "Single Line Text",
                        "render_label": true,
                        "read_only": false,
                        "name": "variable2_single_row_variable_set",
                        "attributes": "edge_encryption_enabled=true",
                        "id": "5bbb8a8497bab1106359f911f053afe4",
                        "value": "",
                        "dynamic_value_dot_walk_path": "",
                        "help_text": "",
                        "max_length": 0,
                        "order": -1
                    },
                    {
                        "active": true,
                        "label": "A variable for Single row Variable Set",
                        "dynamic_value_field": "",
                        "type": 6,
                        "mandatory": false,
                        "displayvalue": "",
                        "friendly_type": "single_line_text",
                        "display_type": "Single Line Text",
                        "render_label": true,
                        "read_only": false,
                        "name": "a_variable_for_single_row_variable_set",
                        "attributes": "edge_encryption_enabled=true",
                        "id": "c0974e0c977ab1106359f911f053afe1",
                        "value": "",
                        "dynamic_value_dot_walk_path": "",
                        "help_text": "",
                        "max_length": 0,
                        "order": -1
                    }
                ],
                "name": "single_row_variable_set",
                "attributes": "edge_encryption_enabled=true",
                "hasSplit": false,
                "containerEndId": null,
                "id": "f23742c097bab1106359f911f053af4c",
                "value": null,
                "dynamic_value_dot_walk_path": "",
                "help_text": "",
                "max_length": 0,
                "order": -1
            }
            {
                "active": true,
                "label": "Business Justification",
                "dynamic_value_field": "",
                "type": 2,
                "mandatory": true,
                "displayvalue": "",
                "friendly_type": "multi_line_text",
                "display_type": "Multi Line Text",
                "render_label": true,
                "read_only": false,
                "name": "business_justification",
                "attributes": "edge_encryption_enabled=true",
                "id": "b7ef3b7241411300964ff05369414ed8",
                "value": "",
                "dynamic_value_dot_walk_path": "",
                "help_text": "",
                "max_length": 0,
                "order": 200
            },
            {
                "containerSplitId": null,
                "containerType": "one_to_many",
                "active": false,
                "label": "Mobile Devices Set",
                "dynamic_value_field": "",
                "columnCount": 1,
                "type": "sc_multi_row",
                "mandatory": false,
                "displayvalue": "",
                "friendly_type": "sc_multi_row",
                "layout": "2down",
                "render_label": true,
                "read_only": false,
                "children": [],
                "name": "mobile_devices_set",
                "attributes": "edge_encryption_enabled=true",
                "hasSplit": false,
                "containerEndId": null,
                "id": "e84d3f3241411300964ff05369414e3e",
                "value": null,
                "dynamic_value_dot_walk_path": "",
                "help_text": "",
                "max_length": 0,
                "order": -1
            }
        ]

 

 Can somebody help me to get the list of children for multirow variable set

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Dhiman 

I think you are using wrong HTTP method

check this link

Submit catalog request using Service catalog API 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Vinod Kondagad1
Tera Contributor

Hi @Dhiman ,

Did you manage to get child variables details for Multirow variable set values?