Intro to RAML - The RESTful API Modeling Language

Intro to RAML - The RESTful API Modeling Language

The API we’ll define is fairly simple: given the entity types Foo, define basic CRUD operations and a couple of query operations. Here are the resources that we will define for our API:

[…]

Next, we will define the data types that our API will use:

The above example uses expanded syntax for defining our data types. RAML provides some syntactical shortcuts to make our type definitions less verbose. Here is the equivalent data types section using these shortcuts:

[…]

Now, we’ll define the top-level resource (URI) of our API:

[…]

Now we’ll define a way to query the foos collection using query parameters. Note that query parameters are defined using the same syntax that we used above for data types:

[…]

For example, we can put the data type for a Foo object in the file types/Foo.raml and the type for an Error object in types/Error.raml. Then our types section would look like this:

[…]