# Who needs an API, anyway?

Alt Title: My (Failed) Quest to Achieve Automated Trolling

So today is my good friend’s birthday. As is typical of a birthday, I had several photos of said friend to post on his wall, but wait! Instead of being boring and doing a collage/album, I wanted to return the favor he paid to me on my birthday by posting one every hour. Given that I had seven of them, I would need to stick around (or at least pay attention) every hour. Ugh. Add that I’m impatient, and we get a recipe for “not a good idea”!

Enter scripting! My thought was to set a timer for every hour to post a photo to his wall (with the accompanying caption), but little did I know that this was quite a tall order (and probably one that FB doesn’t endorse anyway).

My first thought (of course) is to google “Facebook API post photo to wall”. This gets me to this page and this page. Both look like PHP. Pass. (A bit more preliminary research showed that FB only officially supports JS and PHP. Yeesh. And they say they want to promote new programmers?)

Searching for the python SDK is a little more fruitful, although I’m faced with the same problem of “how do i post phot”. With enough digging and reflection (the inspect module is fantastic and should be used on mystery libraries frequently if you’re like me and need to know how everything works), I find https://developers.facebook.com/docs/graph-api/reference/user/photos, but now with some clarity - particularly the “target_id” parameter.

All good, it seems - I can now programmatically upload photos to a friend’s wall. Last thing I need to do is authenticate.

Wait, what?

You see, Facebook authenticates its apps with some kind of “user token”. I have no idea how to obtain one of these, nor is it important enough for me to find out. I did do some fiddling around with Facebook Apps and ended up with something called an “App Secret”, but that doesn’t allow me to post to walls. I’m sure that, with enough patience, I could finagle a way (perhaps by adapting the php code found earlier), but at this point I’ve literally done an hour of research on, essentially, a prank.

source

Sitting here a few hours later, though, I’ve started to appreciate FB’s obscurity. By making their SDK so obtuse (well, the actual documentation looks alright, but PHP?), they drive away a lot of amateur (read: non-profitable) programmers like myself who are just looking for a bit of fun with the system. Particularly, it prevents people (namely, me) from screwing around and automating an annoyance system. Maybe it’s a good thing that FB doesn’t let other people mess up a potentially curated, professional wall with a mere script.

At least, maybe not without some \$ behind it.

Updated: