RAML – RESTful API modeling language
raml.org
raml.org
I actually built the API console for my company - Spotify (https://developer.spotify.com/web-api/console/) - based off of RAML and am in the process of open sourcing the tech behind it. The first bit being RAMLfications, and the second, called Griffin (https://github.com/spotify/griffin) is a super alpha version of a static doc generator based off of RAML. The next/last bit to open source is the console itself, as well as some integrations like Flask extensions/Django packages.
Calling this a "RESTful API modeling language" is like calling a water cannon a flamethrower. If we're going to call this RESTful, we might as well call SOAP RESTful.
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hyperte...
> A REST API should be entered with no prior knowledge beyond the initial URI (bookmark) and set of standardized media types that are appropriate for the intended audience (i.e., expected to be understood by any client that might use the API). From that point on, all application state transitions must be driven by client selection of server-provided choices that are present in the received representations or implied by the user’s manipulation of those representations. The transitions may be determined (or limited by) the client’s knowledge of media types and resource communication mechanisms, both of which may be improved on-the-fly (e.g., code-on-demand). [Failure here implies that out-of-band information is driving interaction instead of hypertext.]
The need for a document like this in the first place demonstrates that the API is not REST. These systems are simply ad hoc, partially specified RPC systems operating over HTTP.
I've almost given up caring about what REST means due to endless debates and misunderstandings about this. REST just means any HTTP-based API where operations and inputs/outputs are modeled with HTTP fields these days.
PierOne is a Docker registry in Clojure with S3 backend and OAuth support. I wrote swagger1st[0] which is used there. Swagger supports authorization definitions via scopes. Besides that, you can only define required basic auth or API key usage for authentication but not for authorisation.
Swagger defines various places, where you can add own x-* attributes to fill in your own logic if swagger is not expressive enough.
But whichever one you choose, this stuff is awesome. We author API specs and then codegen mock services, client side wrappers (Angular services or Backbone models/collections), server side DTOs and controllers, and pretty documentation. Having that all done from a single authoritative text file under source control has drastically reduced the friction between frontend and backend developers.
RAML was the top choice for developer preference and syntax, but industry tooling was much stronger for Swagger.
What we chose was Swagger 2 with the new options for YAML syntax, which gives us good readability/writeability, plus excellent tooling.
Why not just call it an "HTTP API modeling language", since that's what it is, instead of using buzzwords for the sake of it?
There's nothing wrong with what the author is trying to do, but it's nothing to do with REST.
Because if it didn't, the full API description language would be:
api-root: <url>
Or, for a pedantically detailed version: api-root: <url>
media-types:
- <media-type>
- <media-type>For a truly RESTful API, the question you ask is somewhat incoherent. A client for a RESTful API consists of two key sets of components: functionality for sending and receiving resource representations to and from locations identified by URIs, and functionality for handling resource representations of particular media types. Assuming you have those, you don't need to "programmatically generate a client library" with the particular base URL of a particular API root, you access a URL that provides resources of any of the supported media types and your off to the races without programmatically generating anything.
Is this possible in practice for real implementations of RESTful principles? Yes, including the one that motivated the articulation of the REST principles, the WWW.
Is REST appropriate for all APIs? Maybe, maybe not. But its probably not useful to anyone to just call every web service that uses HTTP and isn't SOAP "RESTful".
1) Swagger (by far)
2) API Blueprint
3) RAML
That's great for readability, but it doesn't seem like a perfect choice for a webservice description language, since that content might get hosted and transferred often over the network for clients that might be interested in it.
You could convert to binary to compress it, but that makes it harder for the client, so the friendliest thing would be to convert it to JSON, e.g.: http://my.host/to/a/path/of/my_service.haml.json in addition to the more human-readable haml format at: http://my.host/to/a/path/of/my_service.haml
I suspect this will be a standards war for years to come until we finally settle on one API planning spec.
Disclaimer: I'm working on Swagger on behalf of Apigee.
I haven't looked into Swagger deeply, but RAML seems better at re-usability. Swagger seems to have way more traction though, and also more tools.
I haven't built anything with Swagger but I never clicked with it the way I instantly did with RAML. It's a pity - there seems to be a lot more industry and open source support behind Swagger than there is for RAML which is mostly backed by MuleSoft.
Disclaimer: I work on making API Blueprint better.
EDIT: spelling
This can be both a spec and documentation at once. Client libraries can be generated and services can be stubbed.
Personally, I'd love to see something in reverse: traverse an existing restful service and produce a RAML document.
while actually allowing you to build RESTful APIs
YAML strikes a nice balance between machines and people, but I wouldn't want to write a blog post in it.
Markdown is great for blog posts, but APIs are terse.
It appeared to have weirdness from the homepage:
- secured: !include http://remote-host/secured.yml
/songs:Which is invalid YAML.
It turns out this is probably an unfortunate word-wrap in the page, where a non-wrapping text field would better convey the format.
how do you create your own "specification" and your own "workgroup"? Can anyone invent some acronym, create their own "workgroup"? Do you need some blessings from YAML or someone else?
You create a specification by recording requirements in some medium.
You create a workgroup by getting a bunch of people to work together.
> Can anyone invent some acronym, create their own "workgroup"?
Yes. Whether other people care that they have done so or not is another question.
> Do you need some blessings from YAML or someone else?
No.