Multiline string in readable format for mediatype application/json
Hi,
Our Rest API request has json body and one of the values is a multiline String(XML), when I paste the json body in readyapi request editor and send, I get errors if the whole string is not in single line, for readability purpose am wondering if there is a way I could have this string value(which is a 100 tags XML) on multiple lines rather than having it in one huge single line ?
My JSON request example below and the key 'message' has a value in 'xml' format and type 'string'. I have only pasted few lines below but my xml string is more than 100 tags. All those 100 tags need to be in one line for the validation to be successful but that is making the string unreadable, so wondering if there is a way I can have each tag in a separate line so that the request can be easily readable.
{
"messageId": "123456",
"source": "messageReceiver",
"message": "<con:Control xmlns:con=\"http://www.gov.com/taxation/InternationalTrade/Common/ControlDocument\">
<con:MetaData>
<con:MessageId>00001733</con:MessageId>
<con:Source>ABC</con:Source>
</con:MetaData>
<con:OperationRequest>
<con:Parameters xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<con:Parameter Name=\"ExciseRegistrationNumber\">00467015</con:Parameter>
<con:Parameter Name=\"message\">
<![CDATA[<IA815 xmlns=\"urn:publicid:-:EC:DGTAXUD:PHASE4:IA815:V3.01\" xmlns:tms=\"urn:publicid:-:EC:DGTAXUD:PHASE4:TMS:V3.01\">
<Header>
<tms:MessageSender>NDA.AB</tms:MessageSender>
<tms:MessageIdentifier>902M57S53x1</tms:MessageIdentifier>
</Header>
<Body>
<SubmittedDraftOfEAD>
<Attributes>
<SubmissionMessageType>1</SubmissionMessageType>
<DeferredSubmissionFlag>0</DeferredSubmissionFlag>
</Attributes>
</SubmittedDraftOfEAD>
</Body>
</IA815>]]>
</con:Parameter>
</con:Parameters>
<con:ReturnData><con:Data Name=\"schema\"/></con:ReturnData>
</con:OperationRequest></con:Control>"
}
- Hey rajrao,
I dont think there is. Ive come across this myself a while back and the problem was the endpoint's validation didnt like the split....it wasnt a ReadyAPI issue.
Totally get what youre saying about the message pane window being tiny.....especially when exercising REST APIs (rather than say SOAP) where half the available screen is used up by the Request's API parms editable frame.
When i had this issue i found 2 options (dunno if the other forum members have any better ideas?)
You can either:
1. Externalise your data in .csv's enabling you to edit payloads in Excel or whatever, OR
2. There is a button with the alt-text help (immediately above the Smart Assertion button) "Toggles to tab based layout". This changes the view so rather than a vertical split in middle of screen splitting the request and response, it alters the view to show one in front of the other (extending the available screen space, doubling the visible horizontal width of the Request's payload input field.
Those are the only 2 options i found that would help.
Cheers,
Rich