Hi,
I have a PUT request created and I need to pass JSON body to it. Use case is to update the JSON body runtime and then passing it to PUT request.
Here is my API request. I have added a variable jsonBody and same I am using in HTTPBody as shown below.
Here is the script I have -
String jsonContent = '{"name":"John", "age":30, "car":null}'
Map<String, String> prop = new HashMap<String, String>()
prop.put('jsonBody', jsonContent)
RequestObject requestObj = ((findTestObject('UpdateNoticeContent', prop)) as RequestObject)
ResponseObject respObj = ((WS.sendRequestAndVerify (requestObj)) as ResponseObject)
WS.verifyResponseStatusCode(respObj, 200)
Above script returns 500 error -
“status” : 500
Server error
Something went wrong
Please try again.
If I pass the jsonbody directly into the request like this, then it works fine. Can someone help to resolve this error?
Thanks,
Chandresh Parmar