Five Clues That Your API isn’t RESTful

I get a lot of emails asking me to get involved with API projects, and that means I see a lot of both implemented and planned “RESTful” APIs. Now, I absolutely love REST and for a data-driven application, it would be my first choice. A service of some other description may work better for other scenarios or skill sets, and non-RESTful services can be very, very useful. If you tell me that your service is RESTful, then I expect it to be. If you’re not sure, look out for these clues:

It has a single endpoint

I don’t really care what else is going on in your API, any “RESTful” API which has a statement such as “all requests are made to http://example.com/rest” is … not RESTful. REST is all about handling representations of resources, each is represented by its own URI and we operate directly on that. If it looks like “pretty URLs”, then it’s probably along the right lines. Continue reading

PHP 5.4 Timezone Error Message on Ubuntu

Quick post because this tripped me up the other day: When you use a vanilla ubuntu 12.10 “Quantal Quetzal” installation, it will come with PHP 5.4, which is excellent news. However the default php.ini doesn’t set the timezone, so you will see an error like:

It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

These have been warnings in earlier versions of PHP, but as of PHP 5.4, the date.timezone ini setting must be set correctly, using the continent and place – for me that’s “Europe/London”, like this:

date.timezone = "Europe/London"

If you see these errors, don’t panic, just add the line above to your php.ini.

PHP at FOSDEM 2013

In case you haven’t been following, FOSDEM is a Free Software/Open Source weekend event held every year in Brussels – it’s free to attend and it’s huge! It’s actually a network of smaller events, and this year that includes a whole day of PHP on the Saturday (2nd February 2013). Our schedule is excellent, taking in frameworks, extensions (tutorial from Sara Golemon!), nginx, APIs and a few other goodies. Also, this lovely one-day PHP conference is in the wider context of an event that is packed full of otehr excellent open source technology sessions – see the full schedule for what else is on offer. I love these open source events for the opportunity to dip into not-PHP topics, and I hope to see you in Brussels! Come along, be geeky, and bring your friends :)

How NOT to Design Your API

Recently I tweeted as a #linktuesday link the 10 Worst API Practices post from ProgrammableWeb. Today, in search of some concrete examples of APIs implementing unhelpful antipatterns, I sent out a tweet for help:

[blackbirdpie id=”289014953954930688″]

In the raft of responses (and thankyou all, this was fabulous, helpful and entertaining in equal parts!), there were some definite patterns that I’d like to share with you, in no particular order. Continue reading

You’re Not Using Source Control? Read This!

Last week I wrote an email to a client who hasn’t yet implemented source control, but who is thinking about it. It turned into rather a long email as I attempted to convey WAY too much information in one long email. After some twitter banter, I repackaged my thoughts into a whitepaper on Source Control entitled You’re not using source control? Read This! (PDF, no registration needed).

The document goes on to talk about the available tools (git, Hg, SVN) and give a sales pitch for _why_ source control has benefits for an organisation. There are also some action points to follow to implement source control if you haven’t already taken the leap, which I hope will help anyone looking to take that step – it’s kind of awkward in this day and age to admit that your organisation doesn’t have source control, but however this situation arose, hopefully this document wraps up my thoughts on how to find a good way out! Continue reading

Become a ZCE in 2013

A few people have told me it’s their New Year’s resolution to become a ZCE this year, and I’m sure they’re not the only ones. I regularly help developers and teams prepare for ZCE, so I thought I’d make up a mini package of tips, tricks and a full set sample questions with solutions and explanations, for anyone who won’t be taking a whole preparation course, link below:

Edit: Pack now available from https://leanpub.com/zce
Continue reading

Christmas Kitchen

It’s Christmas and we’re at home this year, which means I’ve been spending a lot of time in the kitchen! This post combines Christmas planning thoughts, a craft project, and some recipes we enjoyed this year – and delivers a surprise to anyone subscribed to the main blog feed expecting only technical content. Continue reading

Building on Datapoint: Weather With Icons

I wrote the other day about the new datapoint API from the MetOffice (there were some great links to other weather APIs in the comments, if you like weather). I’ve been using it to create a detailed forecast of the weather over the next few days, mixing in some lovely weather icons by Adam Whitcroft, from The Noun Project (the same site that the icons on my own site came from) – so I have something like this for each kind of weather:

noun_project_2590
Continue reading

9 Magic Methods in PHP

This post forms part of a series of articles about using PHP to do objected oriented programming, or OOP. They were originally published elsewhere but are no longer available at that location, so I’m reposting them here. Previously in the series was an introduction to OOP in PHP, in two parts

The title is a bit of a red herring as PHP has more than 9 magic methods, but these will get you off to a good start using PHP’s magic methods. It might be magic, but no wands are required!

Continue reading