Strange Network.request Issue

Really appreciate the help here - we are trying to read the JSOn response from this particular webservice which used to work earlier - but stopped working a couple of weeks ago. After a few hair wrinching hours - I am posting here for help.

Note: we are getting the same response in both build 894 (old public) as well as 971/972. I would want to try this with the latest daily build - but has network.request changed? The strange bit is that other pages are returning fine with this call.

any help appreciate. tks

[lua]
local function networkListener( event )
if ( event.isError ) then
myText.text = “Network error!”
else
myText.text = “See Corona Terminal for response”
print ( "RESPONSE "… event.response )

end
end

headers = {}

headers[“Content-Type”] = “application/json”

local params = {}
params.headers = headers

– without params

network.request( “http://api.theflightwas.com/v1/getOffers.json”, “GET”, networkListener)

– with params

–network.request( “http://api.theflightwas.com/v1/getOffers.json”, “GET”, networkListener, params)

[/lua]
 
 

Yes, the network.request() API did change in daily build 1043 in a not completely backward-compatible way, so that may be the source of your issue.

Here are some links you might find helpful:

   Latest stable build documentation: http://docs.coronalabs.com/api/library/network/request.html

   New API documentation (latest daily build): http://docs.coronalabs.com/daily/api/library/network/request.html

   Blog post: http://www.coronalabs.com/blog/2013/03/05/networking-2-0/

Hope this helps.

  • Andrew

Thanks - I am going to give this a try with the latest build. 

With 894 though when i call a page like www.yahoo.com the response is still a string and not a table object though. 

Yes, the network.request() API did change in daily build 1043 in a not completely backward-compatible way, so that may be the source of your issue.

Here are some links you might find helpful:

   Latest stable build documentation: http://docs.coronalabs.com/api/library/network/request.html

   New API documentation (latest daily build): http://docs.coronalabs.com/daily/api/library/network/request.html

   Blog post: http://www.coronalabs.com/blog/2013/03/05/networking-2-0/

Hope this helps.

  • Andrew

Thanks - I am going to give this a try with the latest build. 

With 894 though when i call a page like www.yahoo.com the response is still a string and not a table object though.