The api-design tag has no wiki summary.
0
votes
0answers
18 views
Manipulating Tree Structures for API endpoints
I am working with an RDBMS that contains a list of hierarchical objects stored like this:
Id Name ParentId
====================================
1 Food NULL
2 ...
1
vote
2answers
83 views
Should I have a method name longer than its statement?
According to General Naming Conventions of .NET framework:
X DO NOT use abbreviations or contractions as part of identifier names.
For example, use GetWindow rather than GetWin.
X DO ...
0
votes
1answer
29 views
Downsides to supporting generic query conditions in REST APIs?
I'd like to know what the trade-offs are of having one's REST API support a wide variety of query constraints. I'm thinking along the lines of what an API like that of Parse does.
Parse's take on ...
16
votes
8answers
401 views
Call a Server-side Method on a Resource in a RESTful Way
Keep in mind I have a rudimentary understanding of REST. Let's say I have this URL:
http://api.animals.com/v1/dogs/1/
And now, I want to make the server make the dog bark. Only the server knows how ...
0
votes
1answer
17 views
How to return only the changed resources in a collection using REST
Let's say I'm designing a REST API that should return a list of an authenticated user's contacts
e.g. /users/me/contacts
To improve performance I'll return an ETag and provide this in future GET ...
0
votes
1answer
60 views
Differences between API development platform e.g APIGEE and ESB
Me and my team will be working on APIGEE which is an API development platform to expose some services in our application. I am going through their documentation and also trying to understand the need ...
1
vote
1answer
33 views
RESTful API path for multiple pairs of bus-routes and bus-stops?
This is what I'm currently doing and should return a bus timetable for given bus-routes at given bus stops
/routes/:routeIds/stops/:stopIds
This works for if I want to look up the timetables for ...
3
votes
1answer
53 views
Rest API: reasonable to create associated resources given a verbose representation?
Take it that we have several collection resources.
I can create an instance resource on this collection:
POST /people
{
"_links" : {
"car" : {
"href" : "/cars/66H8800"
...
2
votes
1answer
24 views
Securing API with access token
I am not using any kind of SSL and I am wondering the following:
If I have a list of api keys stored in my DB, and I force users who want to consume the API to do the calls with the following HTTP ...
9
votes
5answers
296 views
Why is there an Option.get method
Why is the method get defined in Option and not in Some?
One could apply pattern matching or use foreach, map, flatMap, getOrElse which is preferred anyway without the danger of runtime exceptions if ...
1
vote
1answer
39 views
How to model a REST API with “POST to PUT redirect”?
I'm creating a REST API for a backup service, which in principle is quite simple:
a user is identified by some uid;
files are identified by some fid;
to upload a file, the user POSTs a file to ...
1
vote
2answers
38 views
How to handle conflicting HTTP GET param
I'm designing a REST API that supports HTTP GET parameters. In most cases I only accept one value for a parameter. But how should I handle duplicate parameters?
For example, Stack Overflow accepts a ...
0
votes
2answers
35 views
How to pass an arbitrary number of parameters while adhering to REST principles
I have a database with 3 tables: product, category, and xref_product_category. My business logic permits a product to be associated with an arbitrary number of categories (bed, bath, kitchen, etc.). ...
2
votes
2answers
146 views
REST API Design sending JSON data and a file to the api in same request
I am creating a REST API on top of an existing application. One of the features takes in a json data along with a file uploaded by the user.
I am unsure how to send a file AND json data in the same ...
3
votes
2answers
77 views
Why does the Object class have Thread methods? [duplicate]
Why does the Object class have thread-related methods, like wait(), notify(), notifyAll()?
We need to extend Thread or implement Runnable to give Thread-like behavior to a class. So why weren't they ...
0
votes
2answers
45 views
API design choice - namespaces in XML interface
I'm designing a new API and I'm struggling with some decisions. I've read tons of blogs on SOAP vs REST and I used the popular APIs (Paypal, Amazon, etc.) as my guidelines.
I ended up with 2 ...
-1
votes
2answers
56 views
Why does the jQuery library expose DOM elements?
This is a question about the design of the jQuery API, not specifics of usage.
Why is a jQuery object a collection of DOM elements and not a collection of jQuery objects?
Working with only jQuery ...
0
votes
1answer
41 views
Monolithic Methods - Disadvantages
Let's say I am creating a MATH class and need to provide a method to process two numbers. [
Instead of providing the traditional mechanism of have methods for each possible operation I provide a ...
1
vote
5answers
129 views
REST API Design Guideline
I am in the process of designing a public API for our REST interface. One of the thing's that came up was the use of the http verbs, specifically the DELETE verb.
We want to expose methods to ...
5
votes
2answers
55 views
How should exceptions be handled in a RESTful API for collection results?
We are designing a RESTful API to return collections of documents. Our initial implementation uses HTTP status codes to indicate if a request could not be fulfilled. This seems to be a widely ...
2
votes
2answers
75 views
semantic versioning of API bundle
When starting with a package versioned at 1.0.0 in an API bundle, what should the new version be after adding a new interface to said package? The whitepaper makes this statement regarding ...
0
votes
0answers
62 views
Reusing Runnable in single threaded app
I have some interfaces that hides from me things like web-server/OSGi/JMS. For that thing I clearly see construction and running phases. I see several approaches about this in code.
mix ...
0
votes
2answers
91 views
RESTfully creating object graphs
I'm trying to wrap my head around how to design a RESTful API for creating object graphs. For example, think of an eCommerce API, where resources have the following relationships:
Order (the main ...
0
votes
1answer
33 views
Api URI Design Preference
A quick api uri design question. We have resources that belong to our clients. These resources can be edited / viewed / deleted by the client who entered them into our system. The resources can be ...
2
votes
2answers
63 views
Is it bad to have “specifications” for a controller/method specified in routing code?
I'm designing an alternative MVC framework for ASP.Net. Part of my goals for the framework is to have as little "magic" as possible. The only bit of reflection I have is for binding things like form, ...
0
votes
1answer
100 views
How do I design my Node.js API so that I can also consume it from the server side?
I have an API that returns some JSON from mongodb:
// In router.js
var api = require('api')
app.get('/lists', api.lists);
// In api.js
var db = require('db')
exports.lists = function(req, res) {
...
1
vote
0answers
90 views
Should a replacement for a deprecated delegate method fall through to the old version?
I have a proper delegate protocol created in Objective-C and I'm updating it. One of the updates requires a method be deprecated, but it is technically still valid for the time being.
Here is the ...
3
votes
1answer
60 views
Wrapper's parseXXX() for signed binary misunderstanding
Let's take Byte.parseByte() as an example as one of the wrappers' parseXXX().
From parseByte(String s, int radix)'s JavaDoc:
Parses the string argument as a signed byte in the radix specified by
...
4
votes
2answers
77 views
Should I write tests before they will compile? [closed]
I've been trying to follow a loose TDD workflow for one of my open source projects. It's an API for other programmers to use.
As such, one key aspect as well as making the API "work" is also ...
0
votes
1answer
56 views
Rest api - adding tags to an entity
I am designing a rest api in which I need to add tags to an entity. The entity is created using POST /content where the json data is passed in the request body. I want to allow adding tags while the ...
1
vote
1answer
33 views
API Design - Ordering return data in an array
I currently have an API endpoint which returns an array of objects each containing 4 variables in JSON format.
The size of the data ranges from 500kb to 5mb - depending on the number of records. In ...
0
votes
0answers
30 views
Are there any caching issues with legacy components and the vary http header
I'm considering the design of a ReST service where resources can be served with multiple representations.
My preferred method of doing this is for client to make a request with appropriate Accept ...
1
vote
3answers
285 views
iOS consuming API design
I am going to develop an iOS app for a web application. (The web app uses code igniter)
I am going to create an API Service that the iOS app will consume.
I am thinking of creating an api version, ...
6
votes
3answers
420 views
Designing an API with designated client keys
I'm designing a JSON web API and want to distinguish clients by unique IDs, in order to monitor usage and block malicious/misbehaving clients. The API is NOT encapsulated in a JavaScript library and ...
4
votes
3answers
331 views
REST API Design regarding DELETE method
I'm building a REST API. actually I understand the the common guide and rule.
But i have issue with DELETE method, because I need to send the data over the body in the request, which DELETE method ...
7
votes
3answers
93 views
(start, end) vs. (start, length) in API design
I've seen two alternative conventions used when specifying a range of indexes, e.g.
subString(int startIndex, int length);
vs.
subString(int startIndex, int endIndex);
They are obviously ...
0
votes
0answers
53 views
Passing the right parameters to variable methods in PHP
I'm setting up a PHP API that will expose functionality and vend data to my users, and I'm looking for an elegant way of passing to my functions the arguments that my users are "passing" to me. I can ...
22
votes
5answers
2k views
API pagination best practices
I'd love some some help handling a strange edge case with a paginated API I'm building.
Like many APIs, this one paginates large results. If you query /foos, you'll get 100 results (i.e. foo #1-100), ...
2
votes
2answers
66 views
Should a ReST API silently ignore request to change nonexistent field?
Consider a ReST API which provides an interface to a database.
Should a the server respond with an HTTP 400 Bad Request on a PUT or PATCH request which attempts to specify a new value for a column ...
0
votes
3answers
75 views
RESTful design: Should renamed resources block old URIs forever?
I'm trying to understand RESTful Web Services page 274 section HTTP PUT. Issuing PUT against a non-existent resource creates the resource. If PUT causes an existing resource to move, HTTP 301 (Moved ...
3
votes
2answers
319 views
RESTful design: when to use sub-resources?
When designing resource hierarchies, when should one use sub-resources?
I used to believe that when a resource could not exist without another, it should be represented as its sub-resource. I ...
3
votes
1answer
798 views
Applying LIMIT and OFFSET to all queries in SQLAlchemy
I'm designing an API with SQLAlchemy (querying MySQL) and I would like to force all my queries to have page_size (LIMIT) and page_number (OFFSET) parameters.
Is there a clean way of doing this with ...
1
vote
1answer
100 views
Representing local timestamps in Ruby based REST API
Perhaps this question should be broken up into two posts, but I currently have an API for a few business customers. I am currently using ISO 8601 timestamps with a UTC time zone to represent times. ...
0
votes
2answers
175 views
How should I expose a generic List<T> as a property in a .NET API when the property can legitimately be null?
I am trying to create a .NET API which wraps and interfaces with a third-party C API. As such the semantics of the API are as follows:
There is a property which represents a list of strings in a ...
3
votes
3answers
105 views
How can I create this API with JavaScript and break out the methods
Let's say I wanted to have this API for an example to do app:
var db = new Database('db-name'); // DB connection
var todo = new Todo(db); // New "Todo" and pass it the DB ref
// I want this API:
...
0
votes
1answer
189 views
Pure HATEOAS vs making too many service calls
I am trying to build a RESTful web service which is supposed to power my UI. If I go by pure HATEOAS principles, I should only be exposing URIs of individual resources in collections. Now, say I have ...
0
votes
1answer
25 views
Libraray/Toolkit API: How to handle composition when containing objects are not known
Could not think of a good title.
I'm creating a library / toolkit for storing and searching a special kind of data (does not really matter to the question but it's chemical structures) in a database. ...
3
votes
2answers
139 views
Marker interface or boolean method to identify object capabilities?
I am developing a largish hierarchy of Java classes, some of which have a particular property that I am interested in querying at runtime (the property definitely only applies to classes, not specific ...
2
votes
1answer
47 views
REST API “Nothing to do” response
I have an API where a put request may not result in changes to the underlying data. If this occurs, I am sending back a 200 and the ETag remains the same as it was if nothing happened. The client, ...
2
votes
2answers
242 views
Rest api design: POST to create with duplicate data, would-be IntegrityError/500, what would be correct?
I have a normal, basic REST api like:
/
GET - list
POST - create
/<id>
GET - detail
PUT - replace
PATCH - patch
DELETE - delete
When a POST comes in to /, I usually ...