i am trying to prepare script for API post request to login as follows
web_rest("POST: http://remote-data-dashboard-app.apps.eu01.cf.cano...",
"URL=http://remote-data-dashboard-app.apps.eu01.cf.canopy-cloud.com/login",
"Method=POST",
"EncType=raw",
"Snapshot=t700233.inf",
"Body={\n"
""username":"XXXX",\n"
""password":"XXXXX"\n"
"}",
HEADERS,
"Name=Accept", "Value=application/json", ENDHEADER,
"Name=Accept-Charset", "Value=UTF-8", ENDHEADER,
"Name=Content-Type", "Value=application/json", ENDHEADER,
LAST);
But it throws error saying 400 bad request(syntactical errors).But i have checked many times but it looks fine with the URL and parameters as i have used same for Jmeter and its working fine their. Help will be appreciated
I think you need to escape the "
web_rest("POST: http://remote-data-dashboard-app.apps.eu01.cf.cano...",
"URL=http://remote-data-dashboard-app.apps.eu01.cf.canopy-
cloud.com/login",
"Method=POST",
"EncType=raw",
"Snapshot=t700233.inf",
"Body={\n"
"\"username\":\"XXXX\",\n"
"\"password\":\"XXXXX\"\n"
"}",
HEADERS,
"Name=Accept", "Value=application/json", ENDHEADER,
"Name=Accept-Charset", "Value=UTF-8", ENDHEADER,
"Name=Content-Type", "Value=application/json", ENDHEADER,
LAST);