Page 1 of 1

Incorrect Format for response data

Posted: Tue Jan 29, 2013 12:58 pm
by Lewis Johnson

I'm currently initiating a service call to a URL to extract the following structured details (details extracted direct from Chrome when URl called). The structure isn't JSON or XML and i'm just wondering how i could parse data in this format in order to then use it within my app?

If i try to 'Automatically Create Service Response' it fails with an incorrect format which i was expecting once i saw the output.

I'm sure there is a way to process the data but i'm bit of a Java Script newbie and at the moment wouldn't know where to start or if the data could be parsed using jQuery. Any help would be greatly received!

Regards

Lewis

GetPaidAtWaveNumber("**************","*********","60","2013-01-29 05:41:29 PDT","","8345")
OK, "6CEBCK"
"Plate","State","StallNumber","VendorStallNumber","StartDateTime","EndDateTime"
"LB05OJZ","","","","2013-01-29 12:13:27 GMT","2013-01-29 13:43:27 GMT"
"LN12UNG","","","","2013-01-29 11:56:16 GMT","2013-01-29 11:57:16 GMT"
"S287SNF","","","","2013-01-29 11:08:13 GMT","2013-01-29 13:08:13 GMT"
"LD10JWX","","","","2013-01-29 10:51:19 GMT","2013-01-29 13:51:19 GMT"


Incorrect Format for response data

Posted: Tue Jan 29, 2013 1:08 pm
by Maryna Brodina

Hello! Could you post service URL, service settings and request parameters you use to define the service?


Incorrect Format for response data

Posted: Tue Jan 29, 2013 2:13 pm
by Lewis Johnson

https://westminster.verrus.com/ParkEn...

This is the full string
user=westminsterPatrol
password=P4tr0lUp0uRz
GraceMinutes=60
method=GetPaidAtWaveNumber
WaveNumber=8345

The last parameter can change


Incorrect Format for response data

Posted: Tue Jan 29, 2013 2:15 pm
by Maryna Brodina

Thank you. We'll test


Incorrect Format for response data

Posted: Tue Jan 29, 2013 2:17 pm
by Lewis Johnson

many thanks


Incorrect Format for response data

Posted: Tue Jan 29, 2013 3:08 pm
by Maryna Brodina

On service Complete event run next JS:

var answer = jqXHR.responseText;
alert(answer);

You can parse data only manually, mapping won't work because structure isn't JSON or XML

Image


Incorrect Format for response data

Posted: Tue Jan 29, 2013 4:32 pm
by Lewis Johnson

Marina

Thanks for your response. I can see that the response is parsed to the Answer variable but how would i handle stripping out the header details and then handling each field of data from the separate rows?

I guess it would be with Java script to create an array for each response line? If i can do that would I be able to then map the data to some of the apps components, such as a grid?

Thanks

Lewis


Incorrect Format for response data

Posted: Tue Jan 29, 2013 5:09 pm
by Kateryna Grynko

Hello Lewis!

Tiggzi provides JSON or XML data only (http://docs.tiggzi.com/documentation/...). You can export CSV data to Database.


Incorrect Format for response data

Posted: Tue Jan 29, 2013 6:16 pm
by Lewis Johnson

OK, but if i can capture the returned data into a javascript variable could i just then use a text field to show the response in?


Incorrect Format for response data

Posted: Tue Jan 29, 2013 7:09 pm
by Kateryna Grynko

As I mentioned before, Tiggzi works with JSON or XML data only. But you can try to convert your own CSV in XML using Yahoo pipes.

You should create rest service with following parameters:
URL: http://query.yahooapis.com/v1/public/yql
DataType:XML
and two Request parameters:
q: select * From csv where url="https://westminster.verrus.com/ParkEn..."
diagnostics: false

You would get this:
Image
You can use such Rest Service in Tiggzi.