loading...
Cover image for The biggest mistake you can make when designing an api

The biggest mistake you can make when designing an api

rallipi profile image Ralf πŸ’₯πŸ”₯β˜„οΈ ・1 min read

This is just a quick tip for everybody currently designing an api.

I have seen something like that very very often:
Alt Text

Always return something like that instead:
Alt Text

The reason is pretty simple. While you can easily iterate over the object keys in dynamically types languages like javascript, it's not that easily doable in statically typed languages. For example when consuming such an api in c#, you want to serialize the response directly in instances of classes that you already defined. Dynamic keys are the worst for that.

So please please please, never use dynamic keys in an api.

Discussion

markdown guide