Get JSON data from a specific URL in swift - ios

What Im trying to do is get the data from this specific url https://www.globalmoneyworld.com/global-media-blog
Once I get the JSON data, Im positive I know how to use it. Ive made several apps in class that touch on this, one was a weather app, the other pulled blog posts from the guardian. The guardian app was more of what I waned to learn than the weather app.
The problem Im running into is that I cannot figure out how to ask for the data. How to get this type of response
http://jsonplaceholder.typicode.com/users/1
this is the link I want to get the data from again
https://www.globalmoneyworld.com/global-media-blog
What kind of request do I need to type in using Alamofire to get JSON data from that specific url? And please guide me in the right direction if Im not asking the right question.

The website you linked returns HTML data, not JSON.
There is no type of request you can make using Alamofire that will give you JSON from an arbitrary URL. The only URLs that return JSON are from sites that allow queries that return JSON. The good news is that JSON is widely supported as a data exchange protocol.

Related

How can I pull and store data from a website?

My school recently got a new grade book software, and personally, I don't like the layout. I decided that I wanted to program my own, but my only snag is that I don't know how to pull my grades from the website. All I would need are my percentages (ints) in each subject. Once I had them stored I would be able to do the rest. Is there a way to do this in swift?
Thanks so much!!
You can not get website data without API call. You need an API giving data either in JSON or XML, then you have to call that service using Alamofire and there are number of methods to store data like realm database, NSDefaults etc.

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.

Using Car2go Api for iOS app

Hi I am trying to get the list of all car2go cars and use it for a test application, the only problem is I do not know how to get the information. I have gotten a consumer key and secret key but the problem is I am unsure how to get the file using the api and then once I get the file I don't know how I would read it since it is using xml.
The response from the html is on this site
http://code.google.com/p/car2go/wiki/vehicles_v2_1
once I get the file I don't know how I would read it since it is using xml
You'll need to parse the response to extract the data you want. There are a number of ways to do that. For example, you could use NSXMLParser (which is included in Cocoa Touch), or you could use the TouchXML library, or you could use libxml.

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?

Searching Twitter feeds

I'm looking to take information from Twitter feeds such as removed posts. Is it possible to do this through some sort of string match search by looking for keywords, that is, "this post removed"?
This is for an Arduino project.
It should be. Twitter just turned off their old API, though, so as long as you're willing to get an API key, you should be fine (https://dev.twitter.com). Grab the data with loadBytes or loadStrings called on the API URL and then start walking through the data you got back (http://processing.org/reference/loadStrings_.htm) -- which in the new API will be JSON. You can use a JSON library to turn that into an actual object, but frankly if you want to do text matching, which you do, then there's really no need for Object repacking.

Resources