My Script is failing when i developed API testing manually in test case using Rest Request object builder and the same works properly when i user web service object.
Some how my script us failing at body content it is not at all reading.below is my code.
String body = ‘{ “name” : "’+NewBranchName+‘",“target” :{“hash” : "’+ParentBranchName+‘"}}’
Can you show the rest of the script?
Are you sending the request with something like WS.sendRequest(requestObject,[('NewBranchName'):NewBranchName, ('ParentBranchName'):ParentBranchName])?
Actually, (most probably) there is a problem with your request body, the request itself is sent successfully and you got the error from a server. You miss some key there.
You are trying to substitute some variables there, in the body, when you build it from script?
If so, don’t do it using single quotes (’’) but double quotes ("") to have the variable as GString, not plain java string.
And try not to use quotes inside the body, e.g “name” : “value” … I don’t know what the API you test is expecting so this last advise is just a guess.
Thank you all,
Actually i want to parameter everything in the webservice object but when i was building body i faced this issue.
Some how i had fixed it in below way.
Body i had maintained in web service object and in script i had modified web service object to parameter .