# Posting and Reading XML data via DCKAP Integrator

In order to be able to send and receive XML data via DCKAP Integrator, the steps below must be followed in both the POST and GET requests.

## POST API

### Steps:&#x20;

* Open the DCKAP Integrator API Manager.&#x20;
* DCKAP Integrator will allow data manipulation only in JSON format. So create the request in JSON format (expected: XML format).&#x20;
* If the API header contains 'Content-Type' as 'application/xml or text/xml'.
* DCKAP Integrator will convert the input JSON format into XML format internally and send it to the respective APIs.

![DCKAP Integrator API Manager screen](/files/VQ5L7tiNXhVVV8QtuhAG)

* Next, go to the DCKAP Integrator Flows which consists of this particular API request.&#x20;
* In the Flow edit page, add the necessary handlers to consider the XML request as required by the business logic.&#x20;
* A few examples are explained below:&#x20;

  **1.Example 1 Adding namespace:**&#x20;

  * If namespace needs to be added in the request payload, add it in JSON format itself.&#x20;
  * If the namespace is not added then DCKAP Integrator will assign a default namespace.&#x20;
  * If namespace is not needed, assign the request payload to the 'plain\_request' tag.&#x20;
    * Note: Some systems will not use namespaces. For those systems, assign the JSON request payload to 'plain\_request' tag before sending it to API.

```
Example: 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.b2boptic.com/b2boptic_lensorder_v1.6.3.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:GetHeaderDetailsRequest>
         <customersOrderId>13</customersOrderId>
      </sch:GetHeaderDetailsRequest>
   </soapenv:Body>
</soapenv:Envelope>
```

**2. Example 2 Using the Formatter Handler:**&#x20;

* The formatter handler is used to stringify/dump the JSON.

![Adding namespace and using the Formatter handler](/files/oNaJiMspI6FRueZo3e1m)

Available Options&#x20;

* JSON Dumps - the output might include white-spaces.&#x20;
* JSON Dumps with separators - Eliminate white-space. To get the most compact JSON representation.

![](/files/EOEQq5mucZ3F2cz43IUp)

**3. Example 3 GET API Call and Formatter :**&#x20;

* To convert XML response to JSON

![](/files/SCdxcKOTzFD4toHrtZXR)

## GET API&#x20;

### Steps

* In order to be able to read an XML input, use the Formatter Handler and select 'Convert XML to JSON' from the dropdown list.&#x20;
* Assign the input to a variable in the Handler

![Using the Formatter handler to convert XML to JSON](/files/gvct8vEHpizKnLHEWKZd)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dckapintegrator.com/api/posting-and-reading-xml-data-via-dckap-integrator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
