Help get started programming with a web service's API
June 1, 2015 8:10 AM   Subscribe

Can you recommend a tutorial to get started with web programming that interacts with APIs?

I'm pretty handy with php, javascript, and HTML/CSS, but for some reason, working with a service's API is very confusing to me. I just can't seem to even get started.

My goal is to connect my photo archive at photoshelter with google's image search to search out where my photos are being used. Both have APIs and I have the pseudocode idea about what I want to do, but I can't quite figure it out.

I think any sort of API-focused tutorial would get me on the right track. API documentation never seems to be enough. I need something that has full code to do something simple (anything!) with any API (flickr would be fine, for instance) that also explains some of the steps. I just can't get my head around opening and authorizing a session with a service, sending requests, ending a session, etc.

Also, I don't need this to live on a live web server. I'm happy using my own development environment or some other local solution.
posted by msbrauer to Computers & Internet (7 answers total) 14 users marked this as a favorite
You might find this blog post on REST APIs useful.
posted by neushoorn at 8:29 AM on June 1, 2015

This article, Demystifying Rest and this video, Teach a Dog to Rest, helped me out.
posted by backwards guitar at 8:53 AM on June 1, 2015

Codecademy has a bunch of lessons on working with APIs -- go here and scroll down a bit.
posted by ludwig_van at 11:08 AM on June 1, 2015

My biggest hurdle with learning new coding stuff has always been the cock-eyed way in which people tend to talk about stuff.

For example, someone online or in a job req will be like "MUST KNOW XML" and it sounds like some intimidating language you need to learn. When in reality, it's just a list of information in a hierarchy, there's literally almost nothing to "know."

By the same token, if you know how to make an AJAX request to your own server via jQuery or whatever, that's all an API is. Exact same thing, except the link is to someone else's webserver. If you want to start with something like getting someone's photos off flickr, it's all public for the most part and you won't need any kind of session.

I'm sure all the resources above will help, but for me the first step is always a sort of demystifying. It's just a collection of concepts you are probably already quite familiar with.

My only other caveat is that the documentation for the average public API tends to be awful. Sometimes you just have to guess at parameters and such until you get the result you want.
posted by drjimmy11 at 11:41 AM on June 1, 2015 [1 favorite]

Actually I take back part of what I said, you do need an API key for flickr. But still if it was me, I would just google "flickr [or whatever] API jquery example," copy the code and tinker with it until it did what I wanted. I learn much better that way than through long tutorials full of abstract concepts, personally.
posted by drjimmy11 at 11:45 AM on June 1, 2015

I just can't get my head around opening and authorizing a session with a service, sending requests, ending a session, etc.

Sessions are a whole different can of worms. Possibly the service you're trying to use is using OAuth/OAuth2? In that case I'd highly recommend using a library instead of trying to DIY.

With a typical REST API, you shouldn't need to worry about sessions. For an easy one to get started, I'd recommend the GitHub API -- it's pretty sensible and doesn't require an authorization key (to up a certain number of requests). For example, here's an API call for Microsoft's GitHub repos.
posted by neckro23 at 12:34 PM on June 1, 2015

A tangential query for you is searching for JSON and AJAX tutorials, because those will typically be using some web API. Searching for json ajax flickr tutorial got me this tutorial (disclaimer, it's from 2009 and I don't use the flickr API so I don't know if it's still up to date).
posted by anaelith at 5:09 AM on June 2, 2015

« Older Heroine's Journey   |   Strange Symbolic Sign Newer »
This thread is closed to new comments.