> This page is for API Reference & Tools.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.moveworks.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.moveworks.com/_mcp/server.

# Examples: Sending an XML Request

> **Note**
>
> **Scenario**: An API returns data in XML format, which Moveworks automatically parses into JSON. You need to modify one of the objects in that API by constructing and sending an XML request payload.

You receive a JSON payload like:

**`json`**

```json json
{
  "data": {
    "side_dishes": [
      { "display_name": "corn", "value": "corn" },
      { "display_name": "fries", "value": "fries" }
    ]
  }
}
```

You want to generate this XML to send as a payload to a subsequent call

```xml
<sides><side>corn</side><side>fries</side></sides>
```

> **Info**
>
> This page covers list-shaped XML built from an array. To omit optional elements at runtime or render a fixed SOAP envelope with `RENDER()`, see [Dynamic XML and SOAP Request Bodies](/tool-studio/actions/http-actions/dynamic-xml-and-soap-request-bodies).

## **Option 1: Build an XML string with DSL**

Using DSL you can construct your payload as needed into a single string to send as an XML body.

```
xml_body: >
  $CONCAT([
    "<sides>",
    data.side_dishes
      .$MAP((val) => $CONCAT(["<side>", $TEXT(val.value), "</side>"]))
      .$CONCAT(""),
    "</sides>"
  ])
```

\


---

## Option 2: Build an XML string with Python Scripts

Create a **[Script Action](/tool-studio/actions/script-actions)** (standalone or inside a Compound Action) and configure:

* **output_key**: where the script result will be stored
* **input_args**:`side_dishes: data.side_dishes`
* **code**: the python code that returns the XML string

**Python code: JSON → XML (stdlib-only)**

Paste the following into the Script Action **code** field.

```python
from xml.etree import ElementTree as ET


def build_sides_xml(side_dishes):
    root = ET.Element("sides")

    for dish in side_dishes or []:
        side = ET.SubElement(root, "side")
        side.text = str(dish.get("value", ""))

    return ET.tostring(root, encoding="unicode")


# -------------------------
# Main logic (returned value)
# -------------------------

xml_output = build_sides_xml(side_dishes)
xml_output
```

\
\