I need to pass the Date format variable data from Bean shell processor to http request body
Below is my code and json where I passed variable data but it is not working
import java.text.SimpleDateFormat;
import java.util.Date;
Date enrolmentDate = new Date();
enrolmentDate.setDate(enrolmentDate.getDate());//+ ${__Random(1,50,)});
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm");
String formattedDate = df.format(enrolmentDate);
vars.put("StartDate",formattedDate);
log.info("########################"+formattedDate);
Below is the Http Request Body data
{
"articleId":""${ArticleId}",
"startDate":"${formattedDate}",
"endDate":"${Carttodates}"
}
When i run it Start date and end date is shown as ${formattedDate}, what will be the solution?
and in my JSON body data i want to send Start and End Date like "27/05/2019 14:34 "
Below is the Request I got
PUT data:
{
"articleId":"7694b207-936b-40b9-9c80-4b8097e67da1",
"startDate":"${formattedDate}",
"endDate":"${Carttodates}"
}