Assign RequestContent for RestPutActivity for post call in Javelin
search cancel

Assign RequestContent for RestPutActivity for post call in Javelin

book

Article ID: 241370

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

I have a request body that I need to pass during an HTTP post call in the RequestContent section in restputactivity in Javelin.
When I am trying to assign it pre-defined string variable and use it. I am getting a compiler error.

How we can edit the request body so the tool can read properly read it.

Note: The body content we are trying to use is a JSON format and it is 1100 lines. 

Environment

Javelin 4.9.x 4.10.x

TDM 

Cause

the RequestConten in the Javelin RestPutActivity action type takes only a type STRING.
in this example, the JSON must be converted to a valid String in order to be accepted.

NOTE: A string can not have any charge returns or line feeds.

Resolution

below are the steps to do this conversation quickly.

1) Use the below link to convert the JSON to a single line:
Json to One Line Converter | Json Multiline to Single Line Converter (w3percentagecalculator.com)
2) Copy the results into notepad ++
3) do a replace all " with ""
4) add one double quote at the beginning and one at the end of the file.
5) copy this into your variable or content request.

Additional Information

Javelin flows are stored in XML so spaces tab and line feed or charge returns can not be stored in string variables