Skip to content

Ask HN: How do I write good API client libraries?

2 pointsjnankindiscuss
On HN

I'm writing some new API client libraries in a variety of languages (PHP, Java, Ruby, C#, JS, Python) for an API.

Is there a list of best practices or a good resource for doing this? Both in general, and language specific?

Here are somethings I'd expect to see in such a resource: - How to handle instantiation of the library (static functions with static API credentials vs new instances of the library with instance variables for API credentials) - How to pass binary files - Using required arguments for required parameters of an API operation vs a hash or dictionary - How to name function calls - How to structure code/classes in relation to the API's design - What good client libraries should return or throw as an exception ... and so on

Comments

No comments yet.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.