API is not working

API is not working

I was create a function in creator script. This function is getting the data from Reporter.
Function was working fine before few day.
Bur when i am running today then raise the following error :-

Execution Failed
Error details:
Error occured while executing the script.
In the subString function start index should be less than end index
Log messages:

There is a function details :-

void special.ramesh_test()
{
ticketDetails = getUrl(("https://accounts.zoho.com/login?servicename=ZohoReports&FROM_AGENT=true&LOGIN_ID=&PASSWORD=
info ticketDetails;
ticket = (ticketDetails.toString()).subString(((ticketDetails).indexOf("TICKET=") + 7),((ticketDetails).indexOf("RESULT") - 1));
info ticket;
query = "SELECT * from DailyRx";
url = "http://reports.zoho.com/api/&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=XML&ZOHO_API_KEY=&ticket=" + ticket + "&ZOHO_API_VERSION=1.0&ZOHO_SQLQUERY=" + query;
response = getUrl(url);
tempthisprod = response.executeXPath("/root/response/result/rows/text()");
info tempthisprod;
}