Smurf Blocket like a BAAWS?

Schibsted and Blocket Hackday mission

Prime directive: make something you learn stuff from. If it can benefit Blocket or Schibsted, that’s good, but it doesn’t have to affect the indigenous population @theoffice. It is desirable to present what you’ve done and your learnings though, but it mustn’t be code.

Mission oAuth: I had been asking around as to how to connect to Blocket’s API, but everyone kept saying it’s messy, so monkey wanted to give it a try 🙂 I mean, how hard can it be right?

WP Plugin: I also wanted to make a WordPress plugin that consumes the API (read only), so I set up this testblog.

One Hackday never enough: The perfect playground would be a hackday, but introducing several new concepts at once can often end up in a mess and many hacknights, so I cheated and prepared a “Hello world” API-connection the night before and read up on WP plugins. No more cheating here, I promise!

Learnings after the Schibsted #22 hackday in May 2019 were:

  1. To make a somewhat secure WP plugin for the WP admin to config categories and search words. Usable only in categories where you allow the API key.
  2. To do the actual authentication is easier with an example. Docs work if you’re alone but friends save time.
  3. To parse the string I got (which didn’t let itself become a PHP array or object until I finally read up on how to properly cURL it).
  4. To CSS-ify it all to be responsive with as little code as possible, use Flexbox FTW. Having worked at Blocket for some years now, the mantra was always “keep it IE safe”. Now it is, kinda.
  5. All of the above in one day… pheew. 400 lines of code with generous spacing.
  6. There’s a Git repo I started somewhere. Here’s the URL.

Learnings after #23 Sch-hackday in Nov. 2019:

  1. Once you’ve figured it out, WordPress is really well thought out with it’s plugin system. Many go: “naah, I don’t do PHP, WP etc” but in how many libraries can you cover developing a whole eco system of functions from day one (or actually two or three) without much prior knowledge?
  2. WordPress documentation is awesome, but there’s a clutter of beginner’s questions spamming the Ether.
  3. Addendum: once I had the main settings going from the 2:nd Hackday, it wasn’t that hard work to use WordPress shortcode to override the basic query and consume multiple instances of the Blocket API in different categories. This was done aprés L’hackday.

Well, that’s all folks.

Like biking? Join Tibor on Strava!