Rest APIs are REST-in-Peace APIs. Long Live GraphQL.

Rest APIs are REST-in-Peace APIs. Long Live GraphQL.” is yet another look at REST vs. GraphQL for the API implementation.

I’m involved with developing quite a bit of REST APIs at work, but for now we are just trying to buy us some time.  I want to take a really long and good look at GraphQL, but I don’t think this will happen this year.  In the meantime, if you have any good GraphQL resources, please do send them my way.

GraphQL – a query language for your API

GraphQL is a query language for the API.  It’s been used by the Facebook mobile app since 2012.  The specification was open sourced in 2015.  And now GitHub is getting on board as  well.  This looks interesting.

https://www.youtube.com/watch?v=dsPVrbDHgaY

Announcing JSON Feed

Straight from the JSON Feed homepage:

We — Manton Reece and Brent Simmons — have noticed that JSON has become the developers’ choice for APIs, and that developers will often go out of their way to avoid XML. JSON is simpler to read and write, and it’s less prone to bugs.

So we developed JSON Feed, a format similar to RSS and Atom but in JSON. It reflects the lessons learned from our years of work reading and publishing feeds.

See the spec. It’s at version 1, which may be the only version ever needed. If future versions are needed, version 1 feeds will still be valid feeds.

Sounds interesting…

Listing, Iterating, and Loading JSON in Ansible Playbooks

Listing, Iterating, and Loading JSON in Ansible Playbooks – for those days when you need to offload part of your configuration onto external JSON files, but don’t have a spare day to try, fail and repeat.

PHPUnit Snapshot Assertions – a way to test without writing actual test cases

phpunit-snapshot-assertions – is an interesting addition to the PHPUnit assertions which allows testing against previously created snapshots.  This is particularly useful for testing the outputs of API end-points, format conversion functions, and the like.  Instead of testing the actual functionality, these assertions allow to compare the output of the current test run with the known good output of a previously created snapshot.

This works well for generic text, but even better for widely used formats like JSON and XML, where, in case of a failed assertion, a meaningful difference can be provided.

Here is a blog post providing some more details on philosophy and methodology.