iPhone programming: how to use URL's API (e.g. BLAST) - iphone

I am new to iPhone programming and would like to be able to use the BLAST (is a bioinformatics server) URL's API from the iPhone. I would like to write a very simple application that queries the BLAST server and make some query. I have found the following
I have found the following documentation on BLAST (http://www.ncbi.nlm.nih.gov/BLAST/Doc/urlapi.pdf).
I am not sure from where I should start.. I checked out the following on security concepts for Mac OS X and iOS(http://developer.apple.com/iphone/library/documentation/Security/Conceptual/Security_Overview/Concepts/Concepts.html) and then found CFNetwork library (http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html).
But I don't really know from where to start..
theoretically I would like to query the BLAST url API from a .mm class method (so I can use standard C) and then show the results in a normal view.
Anyone would be able to guide me in these first steps?
Best regards and Many thanks!

The BLAST API is strange. It is a POST-only command-response API, but the commands you POST are things like CMD=Get&..., CMD=Put&..., etc.
The iPhone SDK provides a fairly convenient high level way to invoke URLs. Have a good read of the NSURLRequest documentation. You'll need to set the HTTPMethod property to POST, and populate the HTTPBody with whatever the BLAST API tells you to post.

Related

How to write to a server/URL in iOS?

Basically, how can I store data in a URL that can be accessed by other devices?
This would be similar to how Instagram works, where people can see the pictures that others post, even though the files are not stored locally on the user's device.
This could also be a way to create high score leaderboards in a game without using GameCenter.
Thanks in advance.
NSURLRequest class is better to use to perform request by URL. So, if you have some RESTful backend by the URL that accept POST data you will be able to push binaries. You can find code iOS example for request similar to yours by following URL - Send image to server as binary data
For the server side I would suggest to take a look into node.js direction (http://nodejs.org)
You need some form of server support, like php, asp etc.
Have a look at HTTP POST and for iOS have a look at NSURLConnection Class Reference, or even better, AFNetworking.

Getting data from remote sql table on iphone

I am a beginner at both iPhone programming and SQL, yet I have basic knowledge of them.
I am planning to do an application that would plot a graph from data taken from a database of the server of my company. I know how to plot, I know how to extract data from an sql table, but what I don't know is how to access the server.
So do I have to go through some kind of oracle-like application ?
This may seem like a very stupid question because it might not even be possible but any answer will be appreciated.
Thanks !
Go through a web service for example a PHP page that returns JSON (or XML, but JSON is easier to parse).
I can highly recommend this tutorial
Once you have your web service, you can use NSURLRequest/NSURLConnection to download the data and use a JSON framework to parse it. Or, if you're using XML you can use NSXMLParser.
See this apple code for more info on downloading using NSURLConnection.
The best way for this will be, using APIs at server end that handle the client request and perform database interaction, so transfer of data among device and server, take place through XMLs that will be secure as well as fast.
It is definitely possible to contact a server (I can't imagine what would happen without that!). What you are looking for is NSURLConnection. Have a look at the example provided by Apple.

What's the best way to get latest tweets in iPhone(SDK, 3rd party libs, etc)?

I need to display a list of latest tweets in my iPhone app, and wondering what is the best way to do this, is there any SDK or existing projects doing this? I know about ShareKit, but it seems to be a method for sharing with standard UI, and no way to use it as a getter for latest tweets.
Thanks!
If you only need to get publicly available data, then Twitter has a pretty straight-forward HTTP API that outputs JSON.
For example, to get a user's tweets: http://dev.twitter.com/doc/get/statuses/public_timeline
You can easily use it by utilizing available library for JSON parsing (e.g. JSONKit) and HTTP client (e.g. ASIHTTPRequest, or NSData's + dataWithContentsOfURL).
U see the following example.you will get some idea
http://mobile.tutsplus.com/tutorials/iphone/twitter-api-iphone/
There is also a third way, which is using http://three20.info/, that also implements main Twitter methods, but since all that you want is to retrieve public info I would stick with ASIHTTPRequest, as Barum Rho recommended. Easier and quicker.
Just to let you know more ways :)

Transferring images captured by iPhone onto the WebService

This is what I am trying to accomplish.
Capture images from iPhone
Store them on the web service
Retrieve them when required
I have searched for tutorials on the topic but have found none. Also, there are various threads providing information in bits and pieces which I am finding hard to piece together and deduce something useful from. Please post a sample code that does it.
Thanks in advance.
Sayeed
If your trying to upload to a popular web service like Flickr, you will have to read and understand their API. Whether your using one of those, or your own server, most probably you'd want to use this open-source library ASIHTTPRequest as it will provide you with a nice layer of abstraction with communicating with web services.
To capture images you can use the UIImagePickerController
To up- and download images to/from a web server you can use NSURLConnection and it's companion.
And it's always a good start to look into some apple sample codes. They're on the related classes documentation at the top under "Related sample code".

Adding pins for nearby places (e.g. pizzerias) in MapKit

MapKit doesn't natively support local search results, so I'm looking for a way to get a list of local pizzerias (or coffee shops, or a specific retailer) via some http api call.
The default google maps api requires javascript, so it's not clear to me how to integrate this into an iPhone app (without displaying a UIWebView).
I have found that a url in a format such as this:
http://maps.google.com/maps?output=json&q=pizza&near=37.3,-122&num=10
Does return a JSON-like list of results, but my usual friendly JSON parser, json-framework, barfs when it tries to parse this (even if I do clever-sounding things like leaving out the "while(1);" at the start of the reply). I'm also not sure how legitimate this URL is to use for this purpose.
I'm on the same quest. It seems that one option would be to perform the local search using Google's AJAX Search API, then plug that data into the mapkit.
That said, it's not entirely clear to me yet that this approach is in the clear vis a vis google's terms of service. Let's see here. Alright, changed my mind because of this. It's a post on google's own ajax api blog including video of a native iPhone app. Looks like this is the approved solution.