Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.
1
vote
3answers
63 views
Two libraries connecting to the database, leading to code smell?
In the current company that I work for there is a very large Utilities library. It was written a few years back (long before I joined) and has grown ergonomically over time to now do everything:
...
0
votes
2answers
79 views
How to get different resources in a single endpoint in RESTful?
I have a REST webservice that have a couple of resources, like Company and User. But now I need to make a modification to the API to return a special list combining company, user and maybe other type ...
2
votes
2answers
116 views
Design for using your own API
So I'm planning to use APIs for my host app. But the APIs are built such that it requires a sessionkey for every request.
So my question is, how would I dogfood my API? Cause, apparently I'm thinking ...
4
votes
2answers
109 views
Custom functions in a REST API
Looking at two of our entities Company and Address. A company has a billingAddress and a profileAddress.
I'm unsure of how to implement a function to set the billing address versus the profile. Here ...
2
votes
2answers
138 views
RESTful URI's, Creating a new noun/uri or add a queryparameter
I have a Person class with a one to many relationship to Employment. A Person in the CRM can have multiple Employments (historic data).
My current REST URI for this class looks like this:
...
0
votes
2answers
144 views
How does API design differ from general web application development design? [duplicate]
If I was working on a web application designing and writing an API how does that differ from a general web application development?
What things would I need to consider and take into account? Are ...
1
vote
2answers
223 views
Choosing between words with different spellings for function names
A question has been bothering me for a while: when developing international projects, it is common sense to use English as the reference language since it is the language that the most people ...
0
votes
1answer
65 views
How does public API designer come to the conclusion what shall be provided for future and what not?
Often working with various jars and exploring the features specially in corner cases, I often realize and think that how is that they thought that it might be a useful scenario somewhere in future ...
1
vote
2answers
94 views
Designing an API for service operations with closely related parameters
I'm having trouble deciding how to design this service API.
public class GetCurrentValuesRequest
{
public int ReferenceID { get; set; }
public int[] FilterIDs { get; set; }
}
public class ...
0
votes
4answers
299 views
C++ library API: new or getters?
I'm writing a C++ wrapper for my C library (my C++ skills are a bit rusty) and I'm wondering what's preferable: allowing user to construct objects themselves or give them objects via getters?
What ...
7
votes
3answers
242 views
Is it safe to assume that one controller will only ever use one primary model?
So, I'm designing an MVC framework. In the name of keeping everything statically typed and non-magical, I've come to quite a problem with "automatically" passing models to a controller.
So, ...
1
vote
1answer
67 views
Storage Client Library 2.0 - Why is the API not as intuitive to use as 1.7?
I am migrating to using the new Storage Client Library for my Azure Table Storage.
Querying with the previous Storage Client Library 1.7 namespace:
var orders = serviceContext
...
19
votes
8answers
1k views
“Public APIs are forever: Only one chance to get it right”?
In an OS book I just read that, "Public APIs are forever: Only one chance to get it right". Is it true? Is it applicable only in APIs of Operating Systems or other APIs too? For example, will this be ...
8
votes
1answer
484 views
What API design for storing generic data in a more specific format?
for In the project I am working on we send messages about widgets over message queues, serializing them onto the queues as XML. The XML schema contains tags for properties that are common to all types ...
4
votes
1answer
253 views
When to use nested resources in a RESTful API
I have two resources: users and links.
Users can have several links associated with them. I have designed my RESTful API so that you can reach the links associated with a user at the following URI:
...
0
votes
1answer
95 views
Configuration file for an API - should it be web.config?
I have a remote procedure call API where the connection parameters need to be stored somewhere that the API code can access. This API is expected to be used mainly to create web services.
I ...
2
votes
1answer
206 views
Node.js API Architecture
I am currently working on a web app and want to design the interface between nodejs / mongoose and the backbone app.
A short description of the app:
A user signs up to the application and gets a ...
4
votes
2answers
417 views
Implementing the command pattern in a RESTful API
I'm in the process of designing an HTTP API, hopefully making it as RESTful as possible.
There are some actions which functionality spreads over a few resources, and sometime needs to be undone.
I ...
22
votes
4answers
942 views
When creating an api should I stick with small functions and many calls, or a few calls and large functions?
I have a rails platform that I maintain. It has a lot of different web applications built on top of it. However now a client is asking for an API so that they can keep users on their site, but take ...
33
votes
2answers
4k views
What is an Anti-Corruption layer, and how is it used?
I'm trying to figure out what the Anti-Corruption layer really means. I know that it's a way to transition/work around legacy code or bad APIs. What I don't understand is how it works and what makes ...
14
votes
3answers
551 views
Detecting IEnumerable “State Machines”
I just read an interesting article called Getting too cute with c# yield return
It made me wonder what the best way is to detect whether an IEnumerable is an actual enumerable collection, or if it's ...
0
votes
1answer
124 views
Rails-API gem, Is there such thing as an API only application?
I've built a few API's using the complete rails stack. In each project there have been multiple uses for rails core features. Each of the API has had management screens for monitoring usage, managing ...
6
votes
3answers
189 views
Does a mobile app need more access than the public API of a site?
I have a site with a public API, and some mobile app developers have been brought in to produce an iPhone app for the site. They insist they need to see the database schema, but as I understand it, ...
5
votes
2answers
178 views
Designing a plug-in system
I'm working on a Java project and I would like to add a plug-in system. More precisely, I would like to let the user design his own module, pack it into a jar, leave it in a "plugins/" subfolder of my ...
1
vote
1answer
137 views
RESTful API design - should a PUT return related data?
I have an API which allows a user to update their system status; and a separate call to retrieve system status updates from other users. Would it make sense to unify them under a PUT request where a ...
2
votes
3answers
107 views
Should static parameters in an API be part of each method?
I am currently creating a library that is a wrapper for an online API. The obvious end goal is to make it as easy for others to use as possible. As such I am trying to determine the best approach when ...
8
votes
1answer
227 views
Versioning APIs
Suppose that you have a large project supported by an API base. The project also ships a public API that end(ish) users can use.
Sometimes you need to make changes to the API base that supports ...
6
votes
3answers
235 views
Style bits vs. Separate bool's
My main platform (WinAPI) still heavily uses bits for control styles etc. (example).
When introducing custom controls, I'm permanently wondering whether to follow that style or rather use individual ...
4
votes
1answer
563 views
Authentication for users on a Single Page App?
I have developed a single page app prototype that is using Backbone on the front end and going to consume from a thin RESTful API on the server for it's data.
Coming from heavy server side ...
1
vote
5answers
4k views
Why does java.util.ArrayList allow to add null?
I wonder why java.util.ArrayList allows to add null. Is there any case where I would want to add null to an ArrayList?
I am asking this question because in a project we had a bug where some code was ...
2
votes
2answers
620 views
C++ Library API Design
I'm looking for a good resource for learning about good API design for C++ libraries, looking at shared objects/dlls etc. There are many resources on writing nice APIs, nice classes, templates and so ...
3
votes
1answer
164 views
When designing an enterprise API, what level is appropriate for separating libraries?
Assume we are developing a REST system for an enterprise company to expose the companies resources in a Java based application. Ultimately you have one web application, and domain libraries. My ...
7
votes
1answer
241 views
How To Handle Login For An Unofficial API?
I am building a tool to access some data on a site (Fitocracy) and I would like to turn it into an unofficial partial API, as no official API exists.
If you are not logged in, you cannot get access ...
4
votes
1answer
181 views
Data service API design
We're designing a data service that will store a large number of statistics about stocks, including historical data. The client will be a web application, which will need to pull various bits of data ...
5
votes
3answers
251 views
How do I assess tradeoff between robustness and “lazy” code in API design?
Postel's law:
Be conservative in what you do, be liberal in what you accept from others.
"Lazy" code (per The Pragmatic Programmer):
Be strict in what you will accept before you begin, and ...
2
votes
3answers
315 views
One or many RESTful APIs for large company?
I work for a large company which has several non-RESTful APIs. I am tasked with building a web application to interact with these APIs. Each API handles and provides very different business processes ...
2
votes
4answers
309 views
Should an API platform enforce only receiving JSON requests?
I am building an API platform.
I have already ensured that the platform always returns JSON responses.
My question is
Should my API platform enforce the rule that all requests must be JSON?
What ...
1
vote
2answers
169 views
What's the term for re-implementing an old API in terms of a newer API
The reason for doing it is to solve the case when a newer API is no longer backwards compatible with an older API.
To explain, just say that there is an old API v1.0. The maker of this API decides it ...
1
vote
1answer
377 views
Securing Back End API for Mobile Applications
I have an application that I am writing for both iOS and Android; this application will be served by a ReSTFUL API running on a cluster of servers on "the internets". I am curious how the rest of the ...
2
votes
1answer
614 views
HTTP PHP Authentication and Android
I am working on a website for which I hope to have an application for as well. Because of this, I am creating PHP API's which will go into my Database and serve specific data based on the ...
2
votes
1answer
339 views
Designing A 2-Way SSL RESTful API
I am starting to develop a WCF API, which should serve some specific clients.
We don't know which devices will be using the API so I thought that using a RESTful API will be the most flexible choice.
...
5
votes
1answer
487 views
When should I use AtomPub?
I have been conducting some research into RESTful web service design and I've reached what I think is a key decision point so I thought I'd offer it up to the community to get some advice.
In keeping ...
0
votes
3answers
585 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 ...
27
votes
3answers
1k 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
339 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
132 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
246 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
241 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
264 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
349 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 ...

