Exploration with workbench with raml

21
Exploration with Workbench with RAML By Anirban Sen Chowdhary

Transcript of Exploration with workbench with raml

Page 1: Exploration with workbench with raml

Exploration with Workbench with RAML

By Anirban Sen Chowdhary

Page 2: Exploration with workbench with raml

MuleSoft has an integrated development environment (IDE) that makes it possible for developers to build and design RESTful APIs based on a RAML specification called API Workbench that supports both RAML 0.8 and the RAML 1.0 release candidate.

Page 3: Exploration with workbench with raml

And the tool is called API WorkBench

Page 4: Exploration with workbench with raml

We will see here how to get started with this tool/editor and with the installation details and then apparently start with designing and developing our APIs in it. This will be the design-first approach to APIs.

Page 5: Exploration with workbench with raml

Features of API Workbench

Page 6: Exploration with workbench with raml

API Workbench is one of the brilliant tools by MuleSoft that help us to create and consume APIs with RAML easily and efficiently. Here are a few features:• It is a Desktop-based IDE that has an interactive and dynamic API

console with other features like advanced search, RAML autocomplete, live RAML debugging, RAML refactoring, RAML code validation, etc.

• It has a powerful Graphical API creation tools and can dynamically generate API mocking service.

• It has an easy to use wizard and built-in tools for source control and versioning along with tools for testing and use case documentation.

Page 7: Exploration with workbench with raml

Getting Started With Designing Our APIs

Page 8: Exploration with workbench with raml

After selecting the option for creating a fresh RAML project we can start our RAMLing business. We will be greeted with the following screen where we need to provide Title, Version, and Base uri for our API. This is the first phase of our design and the input we will put here will result in creating a new RAML file with all these details.

Page 9: Exploration with workbench with raml

Once done, we will get the following RAML file, which has a sample code in it. We need to modify the file as per our requirements. We can also see here that the RAML file generated contains the Title, Version, and Base uri for our API we mentioned in the wizard:

Page 10: Exploration with workbench with raml

On the right-hand side bottom, we can see a ready-made palette available for the RAML tags which we can use in our design that will reduce our effort in typing. It also has other features like RAML autocomplete that will help to reduce the long typing and other features like a documentation tab which let us add a description automatically with RAML tags:

Page 11: Exploration with workbench with raml

The most powerful feature here we can see is the RAML code validation as below which instantly shows up the syntax issue with the line number:

Page 12: Exploration with workbench with raml

It performs different types of validations during our API design, which include Structural Validation, References Validation, Traits & Resource Type Parameters Validation, Schema Validation, Example Validation and RAML version and fragments validation. Thus we can easily imagine how powerful this IDE is that help us to make our API perfect in both design and functionality!The API Workbench provides a dynamic API console where we can see our output and structure of our API dynamically. This gives us an idea how our API is going to be. It changes dynamically as our design changes:

Page 13: Exploration with workbench with raml

We can create and design our APIs easily by adding different resources with different methods like GET, POST, PUT, DELETE, etc., and it can be designed very easily with a palette available for the RAML tags:

Page 14: Exploration with workbench with raml

Testing our API

Page 15: Exploration with workbench with raml

At this point we are ready to test the design we created in our RAML using the dynamic API console. In the API console we can see the design and structure of our API we created:

Page 16: Exploration with workbench with raml

We just need to click the button Make an API request to get the interface where we can test the API.Here we can see we’ve got the interface and in the place of the Query parameter input box we will place our parameter and then will hit the GET button as follows:

Page 17: Exploration with workbench with raml

And at the end we will get the mock status message. This API console window is extremely helpful to check out the API design we just created:

Page 18: Exploration with workbench with raml

For now we have designed a simple API with a GET method. We can add other resources, methods, parameters, headers with the API to meet our requirements and standards. We can also add other RAML tags like documentation, traits, securitySchemas, etc. in it to add more description and other features like security and reusable for our API.

Page 19: Exploration with workbench with raml

Conclusion

Page 20: Exploration with workbench with raml

This was a small demonstration of setting up our api-workbench IDE and designing our RAML file for creating and consuming RESTful APIs. This IDE will help us in bringing a modern and flexible development environment to design and structure our API based on a RAML specification (for both 0.8 and upcoming 1.0). It helps the API designer and the developer to manage the full API lifecycle in a simple and easy way.Hope you like the post and please do share your feedback and experiences in the below section for comments after using the IDE.

Page 21: Exploration with workbench with raml

Thank You