I have a scenario in which I have REST API which manages a Resource which we will call Group.
A Group is similar in concept to a discussion forum in Google Groups.
Now I have two GET access method which I believe needs separate representations.
The 1st GET access method retrieves the minimal amount of information about a Group.
Given ...
I have a specific REST endpoint that creates a topic in a forum; but I want to apply different strategies when processing the request. e.g. If client A makes the call, perform moderation. if client B makes the call, do something else. The easiest would be to add a query param for differentiation:
POST /resource?from=xyz
Another brill...
As a follow up to my previous question about REST URIs for retrieving statistical information for a web forum Resource, I want to know if it is possible to use the internal anchors as filter hints. See example below:
a) Get all statistics:
GET /group/5t7yu8i9io0op/stat
{
group_id: "5t7yu8i9io0op",
top_ranking_users: {
[ ...
What are some guidelines and best practices that I can adhere to while designing an API? At the bare minimum, I know that an API should be easy to use and flexible. Unfortunately those terms can be rather subjective, so I was looking for some concrete guidelines relating to good API design.
...
I have a situation where I would like to have objects of a certain type be able to be used as two different types. If one of the "base" types was an interface this wouldn't be an issue, but in my case it is preferable that they both be concrete types.
I am considering adding copies of the methods and properties of one of the base types...
Was the new ViewStateMode property introduced to avoid breaking the existing EnableViewState?
Does setting EnableViewState = false at the page level causee the ViewStateMode setting to be ignored?
PS: What is CW in stackoverflow?
...
Assuming I create a method which is passed an object and that method would perform an action depending on the object passed. How should I identify the object?
I thought of using the class name to identify the object, but that may be impractical since I could easily change the class name of objects, and generate headaches during future d...
On SortedMap.subMap
This is the API for SortedMap<K,V>.subMap:
SortedMap<K,V> subMap(K fromKey, K toKey) : Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
This inclusive lower bound, exclusive upper bound combo ("half-open range") is something that is prevalent in Java, and...
Hi,
Anyone can suggest good books about Javascript API design good practices? What are the common practices developed by Google, Twitter, Facebook in their APIs. Code organization, request control etc.
...
I'm in the process of designing a .NET API to allow developers to create RoboCup agents for the 3D simulated soccer league.
I'm pretty happy with how the API work with C# code, however I would like to use this project to improve my F# skill (which is currently based on reading rather than practice).
So I would like to ask what kinds of...
I love Google Guava and use it a lot, but there is one method I always find me writing..
public static <T> T tryFind(Iterable<T> iterable, Predicate<T> predicate){
for(T t : iterable){
if(predicate.apply(t)){
return t;
}
}
return null;
}
To me this seems to be a very useful addition to...
hi,
the following code throws NPE for me:
int num = Integer.getInteger("123");
is my compiler invoking getInteger on null since it's static? that doesn't make any sense!
can someone explain what's happening?
thanks.
...
What tools exist for developing platform indepedent API Documentation?
I'm in the process of designing a proposed API, and want to write documentation in a structured and easily editable way. A lot of the answers I've seen have basically been "Use built in language specific documentation tools", but since I'm designing the API from a 't...
Hi,
according to the documentation, the method String.valueOf(Object obj) returns:
if the argument is null, then a string equal to "null"; otherwise, the value of obj.toString() is returned.
But how come when I try do this:
System.out.println("String.valueOf(null) = " + String.valueOf(null));
it throws NPE instead? (try it your...
I need to create an email-notification service (as a part of a bigger project).
It will be used to send several types of notification messages which are based on html-templates.
I can design it in two ways:
The first way is based on the builder pattern. It's universal (as I think) and can handle all necessary cases. But it's not ve...
I've consolidated many of the useful answers and came up with my own answer below
For example, I am writing a an API Foo which needs explicit initialization and termination. (Should be language agnostic but I'm using C++ here)
class Foo
{
public:
static void InitLibrary(int someMagicInputRequiredAtRuntime);
static void TermLi...
The other day I was implementing an important service in my application, that should continue to run no matter what. So I used the following construct:
ScheduledExecutorService ses =
Executors.newSingleThreadScheduledExecutor();
//If the thread dies, another will take over
ses.scheduleAtFixedRate(importantPeriodicTask, 1, 1, TimeUnit.N...
I'm building a system that allows multiple third-party plugins/gadgets conforming to the system's API to be run simultaneously on the page.
What is the best practice of securing or isolating these plugins from one another, aside from running them in separate iframes?
Should I design the API so that data fields of these plugins are priv...
I'm looking for a wiki like software where we can publish our public api documentation. I have found many people to use MediaWiki but this does not seem to be the most elegant way of doing it.
I would love to have a place where we can easily define the APIs specs and have it in an easy to read format. I like how twitter did their api d...
"API design is like sex: make one mistake and support it for the rest of your life" (Josh Bloch on twitter)
There are many design mistakes in the Java library. Stack extends Vector (discussion), and we can't fix that without causing breakage. We can try to deprecate Integer.getInteger (discussion), but it's probably going to stay ar...