HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Public api request.create getting response code of 500 but ticket is being created


#1

Im using the public request.create method via jsp and the ticket info is getting entered, but Im never getting my json file as a response. When I check the the repsonse, Im getting HttpStatus as 500.

Im a bit confused, as this code use to work, but no longer allows me to get a valid json repsonse with the accesss key. Is there anything on the server that the admin could have changed to not send a repsonse back via web api? My request.get is working perfect. So Im not sure what is going on.

[code]
String userid=request.getParameter(“sUserId”);
String note=request.getParameter(“tNote”);
String email=request.getParameter(“sEmail”);
String phone=request.getParameter(“sPhone”);
PostMethod method=null;
HttpClient client=new HttpClient();

method = new PostMethod(“http://[myserver]/helpspot/api/index.php?method=request.create”);
method.addParameter(“tNote”,note);
method.addParameter(“sUserId”,userid);
method.addParameter(“sEmail”,email);
method.addParameter(“sPhone”,phone);
method.addParameter(“output”, “json”);

response.setContentType(“application/json”);
response.setCharacterEncoding(“utf-8”);

int responseCode=client.executeMethod(method);
String res="";
if(responseCode == HttpStatus.SC_OK)
{
//res=method.getResponseBodyAsString();
res= “{[‘statusOK’:’” + responseCode +"’]}";
}
else{
res= “{[‘statusFailed’:’” + responseCode +"’]}";
//res=method.getResponseBodyAsString();

}

out.print(res);


#2

If you change it to XML do you get output? Check if there’s any output, could be an error.