--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
I just don't see a need for "version" information on the public-facing interface for Web APIs.
Couldn't I keep the API version-less by making the email address field optional while logging those client IDs who do not supply email addresses in requests? I could even provide a warning in the response indicating that the field will be required in the future. This would require additional implementation effort on the server/gateway, but would ease the burden of client apps having to send messages to a new URL.
Is it *possible* to change message-level interactions such that you break existing clients? you betcha!'
Is this *REQUIRED* in order to modify client-server interactions over time? nope.
|
there is a class of types that contain not just formats and data markup rules, but also interaction rules. These are defined as part of the message type itself; most commonly called links and forms. HTML, Atom, SVG, VoiceXML, etc. all contain these native interaction elements; often called affordances. I did some basic research on this a few years ago and, as a start, identified a common set of these features and named them "Hypermedia Factors" or H-Factors[2].
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
HTML has no such expectation. the *implementation* on the serer that *uses* HTML may have this expectation. To prove the point, the same server may have the expectation regardless of the media type used to represent the message (HAL, CJ, Atom, etc.).
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+unsubscribe@googlegroups.com.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Using a media type with a variable for schema is not versioning via
the media type it's versioning via schema identifiers.
Nobody creates separate media types for each
type of resource in their app, it's not practical and there are no
benefits of doing so.
The only way to achieve granularity via media type identifiers
themselves is to have a custom identifier for each type of resource in
your application, which is even more of an issue wrt media type
identifier proliferation.
no need to type a resource explicitly
since clients will be able to infer the meaning/type of a resource
according to the context provided by the previous link relation which
led them there.
M
I am going to have to disagree. I believe Hypermedia Types are built to solve a particular problem domain and you should have enough MediaTypes to handle that domain.AtomPub: RFC5023Problem Domain: Publishing Content (of any type)Types:- application/atom+xml- application/atom+xml;type=entry- application/atomcat+xml- application/atomsvc+xmlHTML:Problem Domain: PresentationTypes:- text/html- tex/css- text/javascript- image/*These two types have the advantage of solving generic problems. I think if you are trying to solve a problem domain like say Profile Management, it may require more understanding by the client, and therefore more Content-Types.
I am going to have to disagree. I believe Hypermedia Types are built to solve a particular problem domain and you should have enough MediaTypes to handle that domain.AtomPub: RFC5023Problem Domain: Publishing Content (of any type)Types:- application/atom+xml- application/atom+xml;type=entry- application/atomcat+xml- application/atomsvc+xmlHTML:Problem Domain: PresentationTypes:- text/html- tex/css- text/javascript- image/*These two types have the advantage of solving generic problems. I think if you are trying to solve a problem domain like say Profile Management, it may require more understanding by the client, and therefore more Content-Types.
M
Also, I wanted to point out that none of these techniques are "wrong," per se. Design isn't so black and white. I don't think Fielding's work should be seen as the definitive source for how all Web API's should be built. His opinions, obviously, revolve around the idea of hypermedia API's, because that's his world. There is a whole set of real-world constraints REST doesn't consider... such as time to market. :)
There does not seem to be a problem with evolvability in the semantic world, as far as I can see.
<html xmlns:geo='http//www.w3.org/2003/01/geo/wgs84_pos#'>
…
</html>
If the geo context changes, the client will surely detect it right away.
Pat.
A REST API should never have “typed” resources that are significant to the client. Specification authors may use resource types for describing server implementation behind the interface, but those types must be irrelevant and invisible to the client. The only types that are significant to a client are the current representation’s media type and standardized relation names. [ditto]
"HTML doesn’t need type specifications. No RESTful architecture needs
type specifications. Don’t expect REST to act like some other
architectural style. You don’t get to decide what POST means — that is
decided by the resource. Its purpose is supposed to be described in
the same context in which you found the URI that you are posting to.
Presumably, that context (a hypertext representation in some media
type understood by your client) tells you or your agent what to expect
from the POST using some combination of standard elements/relations
and human-readable text"
A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types. Any effort spent describing what methods to use on what URIs of interest should be entirely defined within the scope of the processing rules for a media type (and, in most cases, already defined by existing media types). [Failure here implies that out-of-band information is driving interaction instead of hypertext.]
The thing I keep struggling with regarding hypermedia is this:In a URI-based API (which is what I primarily work with) then the "contract" is the set of URIs and the corresponding resource definitions. So if I add a URI I have not made a breaking change to the contract but if I rename one or change the resource representation in an incompatible way (like you showed) then I have. I change the "major version number" in the URI only when I make a breaking change to the contract.In a hypermedia-based API, then the "contract" is the set of resource representations, but also the set of link relations on each. I understand that a hypermedia-based API lets the server change the URIs if the client is carefully written to always follow them.But what happens in a hypermedia API when a link relation is changed in an incompatible way -- it is removed, or renamed, or the resource representation is made incompatible? Isn't that also a breaking change to the contract?
On Thu, Aug 9, 2012 at 7:18 AM, Kevin Swiber <ksw...@gmail.com> wrote:Put simply, a breaking change to the contract requires a change to the client unless you've developed some super-smart schema-adapting components (which is possible and cool, but potentially expensive).(Keep in mind this is a very contrived example. Such a small detail is usually not worth a breaking change.)Changing...{ firstName: "Kevin", lastName: "Swiber"}to...{ name: { first: "Kevin", last: "Swiber" }... is potentially a breaking change for API clients, depending on how the contract was written.With hypermedia contracts, backwards compatibility is very important. If you were to do this, I think a phased approach is a better way. Some have mentioned new link relations. That is one option. There are more, but really... try not to break compatibility.If you feel you really need strong versioning, I would recommend using an option that is not purely hypermedia (I believe Greg Brail had a good suggestion). There are trade-offs, of course. Every design has its strengths and weaknesses. I'm putting together a matrix of this in my mind. I need to commit it to paper. :)There is a lot of guidance on URI-driven approaches. Hypermedia guidance is still evolving, but I'm expecting this to shift over the next few months. There is room for more than one approach in this arena. I encourage everyone to be strongly opinionated, but open minded. I think we do a pretty good job of that on API Craft. :)On Thu, Aug 9, 2012 at 9:47 AM, Pat Cappelaere <cappe...@gmail.com> wrote:Please allow me to keep asking the same question… but since you have another pointed example… I will try again.You are using for some reason the "complex" custom media type [for which I am still debating the value of :)]so:My automaton is dealing with APP1 that sports the custom minted: application/vnd.apicraft;type=Person;version=1and all of a sudden, APP2 decides to upgrade to: application/vnd.apicraft;type=Person;version=2 (and not support version 1)[and I have a few more of those to deal with…]I am a good automaton and I follow the links very faithfully [treat them as completely opaque]So, how do I know or infer the correct change in the API for one APP? ….How do I know that to task, I really need two different parameter types with two different ranges?I do not see why custom media types help nor how Hypermedia API helps [although Siren might get pretty close… and does not need custom media types]This is certainly a good exchangeThanks,Pat.On Aug 9, 2012, at 8:52 AM, Daniel Roop <dan...@danielroop.com> wrote:Since this distinction has been pointed out int he past, I will make it here. Not all APIs need be "REST" based. And by REST I mean Hypermedia Driven aka RMM Level 3. I think if you choose not to go the Hypermedia route (which I wouldn't) then versioning in the URL as described by Greg Brail above is completely workable solution.Once you drink the Hypermedia Kool-aid it breaks down. Imagine I have three services, let's call them Catalog, Reservation and Itinerary. Let's aslo assume that Reservation and Itinerary "link" to catalog information. If you are providing the version in the URI (ala /v1) You are putting the burden on the client to understand more than one version of the Catalog data you are linking to, if Reservation and Itinerary do not agree on which version you should be linking to. But this isn't fair, the client is the only one that knows what data he needs from the catalog at the other end of that link, and should ask for the one he wants. SO my perspective is URL based "version" paths break down when you start linking because- Puts more burden on the client to understand N number of versions of the same content- THe alternative is providing which version you care about to all other services which seems slightly unwieldy.The recommendation I have landed on is that in a Hypermedia Based design I agree with what Mike and mca have been saying (suprise suprise the REST zealots agree ;-)). I talk about two ways to version a hypermeida API
:Representation Versioning:This is when the format of your data has changed, but the concept has not. Imagine I have a /person/{personId} resource. The person is still a person is still a person. He has a name. Maybe it is represented like this{"firstName" : "John","lastName" : "Doe","address" : {...}}
I want want to restructure that, to the following{"name" : {"first" : "John","last" : "Doe"}"address" : {...}}It would be a backwards incompatible change, and therefore I need to version. I would do this through the Content-Type. The easiest way to do this is through adding a version Accept param to your content type. So the original could be application/vnd.apicraft;type=Person;version=1 and the second application/vnd.apicraft;type=Person;version=2. You would typically take advantage of this if you want to change the way some data is represented. It is easier to imagine this between two completly different formats. Imagine I have a reservation /reservation/1234, in a hypermedia/rest world I would use content-type negotiation to get the json document, version the xml document vs the pdf. Same concept. Typically on the web you see these represented as different links, I actually think this is one of the cases where the human component hurts us. They have no easy way to say what representation they want simply by clicking a link, so we create different links (and urls) for different content types. But it isn't required in the m2m world, since the machine can specify which representation it wants.:Resource Versioning:This one is where the concept has change. So building on the previous example let's say, I wanted to have a smaller resource that only dealt with the name, not the address. This too would be a backwards incompatible change so I need to "version" this somehow. Since this is a resource model change, I would use the ID for the resource (aka the URL). But I tend to shy away from "numbers" in this case, because I subscribe to the theory that if you can't name it you don't understand it. Since you have created a new concept you need to come up with a meaningful name for that concept. In this case I would call it /person-name/{personId}. That would just return the name structure, and could even use the same Content-Type as above, but the resource is different and the links to it are probably different.Some other thoughts:- I agree with mca that you do not need to make backwards incompatible changes, but I accept this is the tendency for most developers (on both ends) so this is a hard problem to overcome (although not impossible).- To you original question...IN any of the solutions I have described (or any other's on this thread) I think the answer to your question is no, you don't need to rev the API version.- We have instituted a rule that (in any of the solutions) that if the "version" is not specified (whether it is /v1/.. or in the content-type) we assume the lowest supported version. This has the nice side effect of letting you avoid the problem until you need to solve for it (and maybe you won't ever need too). Google used this in their Google Data API specification as well.- I do believe that you can draw a lot of information out of how existing Hypermedia Solutions have been implemented, including primarily presentation based ones (like HTML), but I do think M2M creates some unique challenges that HTML does have and vice versa.- I am starting to wonder if there should be a distinction between a "bot" client and a "remote control" client. The difference being one is a "crawler link automated program" while the other one has an eventual human on the other side. I think there is a lot of similarity but I think the "remote control" style has the opportunity to have more "open ended" capabilities since he has a neural network on the other side.
-Daniel
P.S. I love it when this group gets a topic like this...On Thu, Aug 9, 2012 at 8:13 AM, <chris...@gmail.com> wrote:
On Thu, 9 Aug 2012, Mike Kelly wrote:This sounds like bait, but I'll bite anyway, because I like to
I don't think it needs to much more complicated affair than this when
we are talking about APIs. Drawing parallels between human-consumed
HTML web apps and machine-consumed APIs is not a good idea, either -
so don't waste too much time thinking about that.
participate in such things. Take this with a bit of I don't live in
the real world salt.
Making a distinction between "machine-consumed APIs" and, well,
everything else seems limiting.
The win from having resources on the (a?) web, using common and
visible media types, and using scrutable URIs is that all sorts of
things, be they machines or humans, can interact with those resources
and do all sorts of stuff.
I'm being a hippy here, but that is, at core, a political statement
about participation and control.
It's no surprise that organizations pigeonholed as enterprisey want to
limit participation and maximize control. In that context, having a
scrutable API means that some yahoo can come along and subvert the
imposed information controls.
Except in extremely rare cases, this is a good thing.
Thinking that has led me to a few conclusions about API designs:
* publish your resource URIs and limit (if not outright remove)
dependencies between resources
* don't require hypermedia (which is essentially the above sentiment
repeated)
* Use generic media types (text/plain, text/html, application/json)
and let the client decide how it chooses to interpret them
and to bring this back to the thread topic:
* Don't worry about versioning. If you've got the above sorted, you
probably won't need it, and if you find that you do, then perhaps
what you have is another resource, not a different API.
A profusion of custom media types and a need for versioning is a
hallmark of perhaps thinking a bit too much like RPC or SOAP or
something. That level of complexity is certainly available to you with
a strong REST-over-HTTP API, but is it worth the effort?
If you find that your problem area requires strong and detailed types,
is going to be impacted by slight changes in stucture (thus requiring
versioning) and is encumbered with complexity from trying to manage a
lot of state, it might be worth considering something other than HTTP.
Use HTTP to expose things. With flexibility.
--
Chris Dent http://burningchrome.com/
[...]
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
--
Kevin SwiberProjects: https://github.com/kevinswiber
Twitter: @kevinswiber
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
Gregory Brail | Technology | Apigee--
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
On Fri, Aug 10, 2012 at 10:02 AM, Kevin Swiber <ksw...@gmail.com> wrote:With this model how do you deal with the situation where client A
> One way to accomplish this is by building version selection into your
> messaging.
>
> GET /
> {
> links: [
> { rel=["http://x.io/rels/version/1"], href="http://api.x.io/1" },
> { rel=["http://x.io/rels/version/2", "latest"], href="http://api.x.io/2"
> }
> ]
> }
>
> A client knows it supports version 1, so it looks for the appropriate rel
> value. Again... this is a slippery slope. Make sure it's absolutely
> necessary.
>
> I've also toyed around with using product tokens in the User-Agent and
> Server headers. My advice would be not to head down that path. There are
> too many unresolved issues.
understands v1 captures the uri `http://api.x.io/1` and passes it to
client B which only understands v2?
The only approach i can think of is to provide a link to every
resource that is logically equivalent to the current resource (ie, one
link for each version) in every representation generated by the api.
That way client B could GET the v1 resource and see that it has a v2
equivalent and navigate to that supported version of the resource.
This is certainly possible but it is effectively a just an awkward
implementation of content negotiation. We are basically just saying
that each resource has exactly one representation and then using links
(and extra round trips) to find the representation we actually want.
Many incremental changes/improvement can be made to apis using the
addition of new link relations and properties. We should definitely
use that approach when possible. However, when you are introducing
representations that have a significantly different structure you need
content negotiation. You can either implement it yourself or you can
use http's built in (and fairly bad ass) content negotiation. Or you
could do both.
1. We all need to provide semantic/contextual information to help clients understand the data structures that may be passed around. There may be several ways of doing this based on your preferred API mime-type (html, json, xml). That's a different thread to explore
4. So far there is still no sign of real value added to custom mime types. Early indications tend to show that:
since the client has access to your context info (which may include version), this info is superfluous
So from what I can glean, we seem to agree (or do we?) that:
3. A change of version has to be immediately obvious to a client (rather than fall into it)
4. So far there is still no sign of real value added to custom mime types. Early indications tend to show that:
application/vnd.app+json is really bad
if push comes to shove, a better approach would be: application/json; profile="vnd.app"
and you get brownie points if you specify version="1.0"
and describedby="http://myapp.XYZ.com"
for something like: application/json; profile="vnd.app"; version="1.0"; describedby="http://myapp.XYZ.com"
but again, since the client has access to your context info (which may include version), this info is superfluous
is this a good summary?
Thanks,
Pat.
1. We all need to provide semantic/contextual information to help clients understand the data structures that may be passed around. There may be several ways of doing this based on your preferred API mime-type (html, json, xml). That's a different thread to exploreI don't know that you NEED to, but I can see potential value in it.
4. So far there is still no sign of real value added to custom mime types. Early indications tend to show that:This is where i strongly disagree. Should application/atom+xml not exist because application/xml exists? the Atom mime type builds on top of xml (and the xml format even encourages this behavior by declare that +xml is a standard for extending the format to have semantic meaning.REST in Practice (a great book on this topic) also recommends app specific Media Types. If you haven't read the book I would highly recommend it.
since the client has access to your context info (which may include version), this info is superfluousYou are suggesting that because in the response the client recieves contains a reference to a schema, they don't need a say in the version that is returned? I think I am missing something.
Kevin,my big hangup on all of this, is how does a client express which version of the representation they want. I must admit I haven't read the siren stuff you have sent as much as I want, but it seems that siren is a single media type (correct?). So if I callGET /profile/1234Accept: application/vnd.siren+jsonI will always get back a representation with "type" information decided by the server. This means that I can not have one version ask for profilev1 and provilev2, even though the response representation includes the type information. Am I missing something?
Is it necessary to include version if I m introducing new urls for resources in my APIHappy to hear any suggestions over this.ThanksIndu
My take on versioning is to literally interpret the previous posts about "you should version if you introduce incompatible features". Adding new vocabulary to your api that doesn't break what's already in place wouldn't need a customer facing version increment, even though you'd probably want to track that progress internally with a minor v #.