How can I send XML to create a document from an inbound content mapping?
Summary
I have an inbound content pipeline mapping for an XML content source. To use that mapping, I need to send raw XML, but the Migration Center API expects a JSON string. How should I format the raw XML so that I can send documents through the Migration Center API and allow the inbound content mapping to work?
Procedure
When sending XML or JSON source documents through the Migration Center API, the entire XML document needs to be escaped into a single string.
Take the escaped XML or JSON and enter it as the value of the Migration Center JSON key
sourceContent
.As the
sourceContent
key accepts a string, make sure that the escaped XML is surrounded in its entirety by a single set of quotes.Reference the inbound content tool mapping id in the JSON key
sourceAdditionalProperties.transform.mapId
.The request will then be ready to POST to the Migration Center API's
/content/source
endpoint.

More Information
There are online tools that allow you to copy and paste the XML into an interface and will reformat reserved JSON characters within to be escaped using backslashes (\). There are also software libraries that will allow you to do the same programmatically from with your custom scripts.
Stay away from tools or libraries that will "stringify" the XML. This gives a different level of special character escaping that will not be compatible with the Migration Center API, and the source document will not be ingested successfully. If the tool or library turns these characters into their ASCII equivalents (from < to <e;) it is not the correct tool to use.
Following is an example of properly escaped XML generated from an external online tool https://www.freeformatter.com/json-escape.html