API Design Questions (2)
Gervase Markham
gerv at mozilla.org
Wed Sep 23 17:03:51 UTC 2009
On 23/09/09 12:14, Gervase Markham wrote:
> Here are some things I've run into when designing the RESTful API.
> Perhaps people could tell me what they think the best option is.
And another one :-)
We update bugs with a PUT of a JSON representation:
{
bug: { priority: P1, assigned_to: { name: gerv at mozilla.org,
real_name: "Gervase Markham" }, ... }
}
(At the moment, users are always represented by "user objects" - hashes
in the JSON interface - which can have a number of keys and values. This
makes the API more understandable; it would be odd if assigned_to was a
hash for data coming out, but a scalar for data going in. But obviously,
when PUTting a new value, we only look at the "name" key.)
What is the best way of issuing meta-instructions, like "set assigned_to
to default"?
Do you:
1) Not provide that feature?
2) have a magic value for the "assigned_to" in the bug hash:
{
bug: { priority: P1, assigned_to: { default: 1 }, ... }
}
3) Support an extra bug hash key "set_default_assignee:
{
bug: { priority: P1, set_default_assignee: 1, ... }
}
4) Have an additional "instructions" hash:
{
bug: { priority: P1, ... }
instructions: { set_default_assignee: 1 }
}
5) Something else?
Gerv
_______________________________________________
dev-apps-bugzilla mailing list
dev-apps-bugzilla at lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-apps-bugzilla
More information about the developers
mailing list