That’s a lot of acronyms. Here have a picture:
how APIs work, sort of
Super! MARY, BUT WHY SHOULD WE CARE?
Long story short: I’ve had this WordPress blog since I started coding, and since then I’ve coded other web sites “from scratch,” including a professional portfolio site, that are much easier for me to customize and that add legitimacy to my claim of web developer. So that is what I want to share with potential employers but I also want them to see my awesome technical blog posts so they will think “She sounds cool and writes good. Let’s pay her money in exchange for her time!” UNTIL NOW the way to do that was to direct people to this site, marydickson.com, and hope that they will also go check out marydickson.info, or vice versa. Awkward.
The WordPress API allows me to import blog posts from marydickson.com and render them as a tab on marydickson.info. If you have any sort of non-WordPress site and you’d like to link to or display your blog posts, you can do that with the WordPress REST API. I’ll walk you through what I did to get this working in a Rails app:
Top of my to-do list has been to build something using data from the City of Seattle data portal (data.seattle.gov), powered by Socrata. This one is not particularly useful, but I’ll share with you anyway!
One of the things I like least about homeownership is the need to keep up a yard. Thankfully I’ve never received nastygrams about yard care, but I’ve heard some horror stories. One couple in Texas was in the process of removing a dead tree from their yard — they had just cut it down and into transportable sized pieces, and piled and covered the logs up with a tarp, and THE NEXT DAY they got a note demanding they remove “tree debris” from their yard within three days or pay a penalty.
Anyway, in that frame of mind I giggled through the “weed and vegetation code citations” available via public record. Since Washington legalized marijuana last year, I had an idea in my mind to track code citations like these:
- Large overgrown blackberries and vegetation encroaching sidewalk
- Hazardous vegetation encroaching on sidewalk forcing pedestrians into street
- OBSERVED LARGE TREE ON PROPERTY NO SIGNS OF RODENTS AND NO BEES WERE PRESENT DURING A SUNNY DAY
…and present them as our city’s most pressing weed violations.
Clever? Maybe. Half-baked? Definitely. My first idea was to tweet out the description of the citation, with a google maps street-view image of the address in question. That might be visually interesting but seemed like a huge invasion of privacy, so I quickly shelved it. I have no interest in actually shaming the property owners.
So instead I started with the easiest path, tweet the generic descriptions, to see where that led me. Here are the “get-started” steps:
- Register for a developer key with Socrata
- Identify the data set you want at data.seattle.gov (for me: code violations)
- Use developer key to access the API (I used a Ruby gem from Socrata) to fetch that data set
- Filter (for code group: “weed and vegetation”) and collect results in an array
- Set up a Twitter API client to talk to twitter, via a new twitter account if needed (I recycled an existing bot!)