sending post data from Iphone - post

I want to send post data from Iphone.
I have to send a dictionary(K-V pairs) with 8 k-v pairs.
What is the best way to post all these 8 K-V pairs from Iphone.
I want that i should pass only Id(one of K-V pair)in the URL & remaining K-V pairs should be sent via post.
if there is something like that??

I wrote a couple blog posts using NSURLConnection. One was specifically for sending POST data. Check them out. You can't send some data with GET and some data with POST. You have to commit to all one way.
Sending POST DATA
Using NSURLConnection
HTH

The HTTP protocol doesn't work like that. Pick POST or GET.
This library makes web requests easy, including file upload: http://allseeing-i.com/ASIHTTPRequest/

Related

REST API support by survey monkey

I am planning to do a survey using survey monkey. I will require API support to automatically pull responses from your datasource. I looked into https://developer.surveymonkey.com/docs/methods/get_responses/ and it looks like I need to use services like curl to extract data. It also looks like I can extract data in json format. And the data that is extracted using get_responses api, returns only ids.
So my questions are:
1. Do you support REST APIs to download data?
2. Can I download data in csv format?
3. Can I download actual responses with questions and not just ids? What APIs will be return survey, questions asked and user responses?
3. Can you send me an example format of how data will look when downloaded using the APIs?
5. Finally, with $26/month subscription for one month, will I get API support? Is the API support available for free subscription?
Thanks!!
SurveyMonkey does have a REST API
You can get all responses (just ids) doing:
GET /surveys/{survey_id}/responses
See: https://developer.surveymonkey.com/api/v3/#surveys-id-responses
You can get the details and all answers to questions for a specific response by ID doing:
GET /responses/{response_id}/details
See: https://developer.surveymonkey.com/api/v3/#responses-id
Or you can do this all at once by doing
GET /surveys/{id}/responses/bulk
See: https://developer.surveymonkey.com/api/v3/#surveys-id-responses-bulk
Answered by akand074.
We only support JSON at this time.
You'll have to make a separate GET to /v3/surveys/{survey_id}/details to get the survey details, and then map it to the response data.
The format, along with response data examples can be found here.
You'll have to contact api-support#surveymonkey.com to find out.

Get data from server in iOS

I have a script that takes hours and outputs if it is open or closed and I want to run this on my server, and then from my iOS app get if a certain place is open or closed. And I was wondering how I could do this without generating an JSON file and then parsing that as I would to frequently re-generate the file as the things change from open to closed and such. So is there a way I could make a call to the server and just get the data that I want?
Im not entirely sure whether you are asking specifically for an iOS framework for requests and responses or server side. So I figure I will try to answer both. Here are some swift projects you might be interested in. I'm not incredibly familiar with objective c yet but these resources might prove useful.
Alamofire
This will help you send and receive http requests.
Swifty JSON
This will help with JSON parsing
However if your question is more regarding server side issues. You could look into a REST api and that way you could only request certain entities that you are interested in instead of just sending back the entire batch of information with all of your data, and searching through it on the iOS device.
Hopefully this is somewhat helpful.
If you are only planning on GET-ing some content from the web you can use the NSURL class. NSURL *lru = [NSURL URLWithString:#"http:mywebserver.com"] and then create a new string object from the url with [NSString stringWithContentsOfURL:lru], or any data you would like. If you are trying to hold a session or having more control over the request, I would suggest looking into the NSURLSession class.

JSON GET and POST

I am learning iOS app development.
I have JSON data coming from one of the sites in the form of Dictionary within an Array and within that Dictionary I have another Array and that contains another Dictionary.
for ex ,
Now I want to deserialize it and use it in my iOS app and also I have to post some data like a comment back to the server.The comment by teacher will be a POST to the server.
I hope the question makes sense.
I am stuck on how to deserialize this and use POST to server.
Any help is appreciated. Thanks in advance.
There are a couple of parts to your question:
1) To get the JSON data into a format which can easily be manipulated by your program, it's easiest to take an existing open-source JSON parser library and integrate it into your app. I like SBJSON. If you go to that site, it has instructions on including and using the library in your project.
2) To post a reply to the server, you need to know what format it expects the data in. Is your app interacting with an existing website (where a user could go to a page and fill out a form), or is it talking to an API?

objc POST file and string parameters

I am trying to POST a file, and some string params to a .ashx page on my server from my iPad app using objc.
I have found lots of tutorials on how to post a file using objc, and I already have code to post strings. But I cant work out how to combine the two, so I can send multiple values in a single POST?
Could anyone help me out with an example or two? I am trying to avoid using 3rd party frameworks, so something using NSURLRequest would be preferred.
Thanks,
Mike
You need to use a multipart submission, with boundary strings, etc. Here's some helper code: https://github.com/Goles/SimpleHttpRequest from the answer to this question: Sending multipart POST from iOS and reading parameters in PHP $_POST?

asidownloadcache for post request?

In my iOS app,I'm sending a post request using the asihttprequest methods and receiving json data.
i want to be able to cache the parsed json data if possible (so that i can directly extract and display in the tableview).
asidownloadcache is helpful only if i'm using GET method. So, i'd like to know my options(along with an example if possible)
Thanks a ton for the help, in advance..

Resources