Tagged Questions

Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.

learn more… | top users | synonyms

0
votes
3answers
1k views

Web API design best practices - having many (similar) operations

I have a web service (axis2) and the server performs 4 primary operations: createX, removeX, getX and updateX Where X is represented by a combination of 4 values: id1, id2, id3 and id4 So, to ...
33
votes
3answers
6k views

What's so bad about the DOM?

I keep hearing people (Crockford in particular) saying the DOM is a terrible API, but not really justifying this statement. Apart from cross-browser inconsistencies, what are some reasons why the DOM ...
5
votes
9answers
402 views

Populate fields or return object

What is better to do in this type of scenario: populate fields or return an object? The situation is like this: I'm doing calculations to find the prices (inc tax, ex tax, discounted etc) of a ...
1
vote
1answer
311 views

Request / Reply , how should one initiate the actual sending of the transmission?

I'm working on Language level interfaces to web API's. These libraries are of course built around existing HTTP Request/Reply interfaces. I see myself as having a few options submit method on the ...
3
votes
2answers
551 views

“Invalid operation” status code in a HATEOAS REST API

In a HATEOAS API links are returned which represent possible state transitions. A conforming client should just be retrieving and following those links, but if a non-conforming client is constructing ...
10
votes
2answers
310 views

Is the 'Law of Demeter' applicable to public/API method signatures?

Given that changes to the API/public method signature should be minimal to prevent breaking those client codes that use these methods, I was wondering if the Law of Demeter is less applicable to ...
3
votes
3answers
408 views

API method placement guidelines?

Are there any guidelines for placing methods in API when the placement isn't obvious? Example: I have classes A and B and a method X. The work being carried out can be phrased in two ways: A does X ...
3
votes
7answers
364 views

Better name for existsByUserNameAndPassword()

I wonder if there is a better name for a DB API function called existsByUserNameAndPassword() which returns boolean. There are more function called like this: existsByOldId()... It sounds a little bit ...
7
votes
5answers
5k views

How best do you represent a bi-directional sync in a REST api?

Assuming a system where there's a Web Application with a resource, and a reference to a remote application with another similar resource, how do you represent a bi-directional sync action which ...
5
votes
1answer
795 views

Sending a collection of data to an API. Multiple small calls vs one big call

I am currently creating an API and implemented a few basic REST actions such as get, update, search etc. Another program that collects data needs to synchronize these to this API. My current thought ...
3
votes
1answer
121 views

How should I deal with external data sinks?

I recently took on a contract job that will largely involve generating data feeds from my client's data and sending it to external partners, via feeds and API invocations. I've always found this ...
2
votes
2answers
98 views

How should XML subtree manipulation be handled in a public API?

I'm working on an API whereby a specific call would replace a subtree of an XML document—rooted at some element—with another subtree. The two options I'm considering for a response to this call are: ...
5
votes
3answers
324 views

Should I provide synonyms in an API?

I'm designing a small library and there is a strong temptation to provide synonyms to some of the exported functions. var foldl = function(){ ... }; var reduce = foldl; //reduce is a synonym for ...
4
votes
1answer
759 views

Mask oAuth API key and token for pure client-side technologies

If I were to build a Twitter or Facebook application using pure client-side technologies like HTML and javascript, how would I mask/hide my API keys? For example, for Twitter I have consumer key and ...
4
votes
3answers
255 views

Creating a webservice API - how much “credit” should I give the client/developer

When creating a web service API, how much should I count on the developer to act by my rules? We are really aimed on creating an API so the developers shouldn't develop client side logic too much... ...
2
votes
3answers
459 views

Creating public API definition for existing application

Let's say there's a successful open source application (written in PHP if it matters), which provides its users with multiple ways to extend it (think about something like Drupal or Wordpress, lots of ...
3
votes
3answers
713 views

API Development - Sinatra?

I've been tasked to create a mobile application as well as an accompanying website. Both the application and website will interact with the same database. To make things easy, I figure creating an API ...
1
vote
1answer
171 views

How do you deal with errors in enumeration / list processing (lowish-level API)

Ive struggled with variants of this problem many times, experimenting with different solutions, happy with none. Abstract: Enumerating a list of items, an error for one item does not affect the ...
-1
votes
3answers
1k views

API design pitfalls in C

What are some flaws that drive you nuts in C APIs (including standard libraries, third party libraries, and headers inside of a project) ? The goal is to identify API design pitfalls in C, so people ...
1
vote
4answers
218 views

API naming and namespacing

Is it right or more beautiful to name the functions with an prefix, like in Qt? Or using "many" namespaces, but 'normal' names for functions? For example, slOpenFile(); //"sl" means "some lib" vs ...
3
votes
1answer
172 views

What are some good Photo and Artwork APIs?

We had an idea for starting a ecards service and were looking into the possibility of populating our site using photo/artwork APIs. Due to legal reasons, Flikr probably won't work, although I've ...
5
votes
7answers
392 views

Why do certain code elements (classes, methods etc.) in public APIs get deprecated over time?

Today our professor discussed with the class that what "class X or method X get deprecated" means? From what I understood, it means, for example, that we are not going to get that method or class in ...
15
votes
7answers
3k views

Why does the Java collections APIs not have a last method?

This is for ordered collections e.g. java.util.List. Why did the language designers not include a last method? The only reasons I can think of are: ambiguity when the collection is empty (return ...
3
votes
2answers
416 views

Strategy for designing a plugin API

I am working on an application for which a rich plugin API is crucial. What is the best process for creating an API that is intuitive and easy to learn?
16
votes
4answers
438 views

Database abstraction — is it being overdone?

After being exposed to numerous database abstraction layers, I'm starting to wonder what the point is of every library inventing their own different paradigm to access data. Picking up a new DAL feels ...
5
votes
1answer
497 views

Application internal API

I am currently building a small python CLI (Command Line Interface) application with ambition. In the first development phase I would concentrate on making it work through the CLI interface only, but ...
13
votes
3answers
6k views

Is there a list of common usernames to reserve in a new system?

I need to reserve usernames in my new website. These generally fall into three categories 1) usernames no-one should have (eg: admin, user, service, help, root, etc) 2) names of super famous people ...
3
votes
5answers
184 views

Consistency vs. Usability?

When designing an API, consistency often aids usability. However, sometimes they conflict where an extra API feature can be added to streamline a common case. It seems like there's somewhat of a ...