Rajesh Om
Rajesh Om

Reputation: 518

unable to run rest api service in loadrunner?

i'm facing issue while running rest api service in loadrunner(VUGEN),in soap ui it is working fine.

My Data contains around 10 fields but while request it is breaking one parameter into two then i'm facing internal server error.

Please help and unable to continue in new line in case i want to write it in another line

Code is :

Action()
{

    web_custom_request("Calculate",
       "URL=http://sdfsdfsdfgsdfgsdfgsdfgsdfgsd/sdfgsdf/sdfgsd",
       "Method=POST",
       "Resource=0",
       "EncType=application/json",
       "Mode=HTTP", 
       "Body={\"program\":\"L002\",\"Number\":null,\"serviceNumber\":\"09000\",\"customerStateName\":\"{state}\",\"storeCode\":\"{store}\",\"Amount\":\"{amount}\",\"paymentDetails\":[{\"type\":\"{types}\",\"amount\":{amount}\"}]}",LAST);


    return 0;
}

Unable to write it in two lines of code ,in case i'm trying to write then it is giving syntax error like , is missing or " is missing.Unable to write please any one help.

Response coming as:

{"program":"L002","Number":null,"serviceNumber":"09000","customer
  StateName":"MAHARASHTRA","storeCode":"1111","invoiceAmount":"50","paymentDetails":[{"type"
 :"CASH","amount":50"}]}

Line is breaking i.e customerStateName into customer,StateName because of this i'm getting Bad Request in Response,Please help.

Upvotes: 0

Views: 1311

Answers (1)

Igor Markov
Igor Markov

Reputation: 11

Since LoadRunner 12.53, you have a new and easier way for making REST API calls, using the web_rest() API. See blog post about it.

Upvotes: 1

Related Questions