On iOS 5, how can I query a web service using a JSON object?
I’ve tried a bunch of different approaches and can’t get it to work. It appears that the AFNetworking or RestKit frameworks are the easiest routes, but I don’t have experience with either. I’m also new to iOS development.
Here’s an example query that works:
https://site.com/gis?QUERY={"ARGUMENTS":{"TO":{"OBJECT_TYPE":"BUILDING","OBJECT_ID":"1","TYPE":"IDENTIFIER"},"FROM":{"OBJECT_TYPE":"BUILDING","OBJECT_ID":"2","TYPE":"IDENTIFIER"},"PATHTYPES":["SIDEWALK"},"QUERYTYPE":"FINDPATH"}
Create a url request, see example below. This posts json data. In your case, your using a GET http method, so you shouldn’t need to post the json data, you can simply include it in the url. Note that some of my variable declarations are not shown.