RAML Tutorials for Beginners and Experts [Videos]
Time for a RAML rundown.
Join the DZone community and get the full member experience.Join For Free
What Is RAML?
RAML is Rest API Modeling Language, based on YAML, for describing your APIs. It is basically used to describe your API, which can be easily readable by humans and computers. It basically focuses on describing your API resources, methods, parameters, media types, etc.
Here is a video tutorial explaining how to write basic RAML.
URI Params and Query Params
URI parameters (path params) are basically used to identify a specific resource or resources, whereas a query parameter is used to sort/filter those resources. Query parameters are passed in the URL as a query string in key-value form.
For more details on URI params and query params, please refer to https://dzone.com/articles/understanding-the-uri-param-and-query-param-with-r
Traits are like functions and are used to define common attributes for HTTP methods (GET, PUT, POST, PATCH, DELETE, etc.), such as whether or not they are filterable, searchable, or pageable.
Here is a video tutorial explaining the traits with RAML.
RAML defines a security scheme that can be applied to resource methods for authenticating API requests.
Here is a video tutorial explaining security schemes with RAML.
Libraries and Fragments
A RAML library is a collection of the data type declaration, security scheme declaration, and resource type declaration into a modular and reusable group. It also allows you to define multiple types within the same library, unlike data types.
Fragments are basically used to externalize your security schemes, library, resource types, traits, data types, etc. They can be reused across any RAML. One of the characteristics of a fragment is that it can be published to Exchange, and it is possible to version your fragments.
Here is a video tutorial explaining libraries and fragments with RAML.
ResourceTypes are like resources in that they can specify descriptions, methods, and parameters. A resource that uses resourceTypes can inherit its nodes. ResourceTypes can use and inherit from other resourceTypes.
A ResourceType is basically a template that is used to define the descriptions, methods, and parameters that can be used by multiple resources without writing duplicate code.
Here is a video tutorial explaining ResourceTypes with RAML.
For more details on ResourceTypes and Traits, please refer to https://dzone.com/articles/understanding-resourcetypes-and-traits-with-raml
Opinions expressed by DZone contributors are their own.