2

RAML Tutorials for Beginners and Experts [Videos]

 3 years ago
source link: https://dzone.com/articles/raml-tutorial-for-beginners-and-experienced-basic
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

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.

Security Schemes

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

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

Complete RAML code: https://drive.google.com/file/d/1a-Dqq-0DdramcRv_Sp0AHq0BXsIB4wTU/view?usp=sharing


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK