Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Approach the MuleSoft API Design Using RAML 0.8

DZone's Guide to

How to Approach the MuleSoft API Design Using RAML 0.8

This article highlights the approaches and questions required to design an API using RAML 0.8 on the MuleSoft API designer.

· Integration Zone ·
Free Resource

Continue to drive demand for API management solutions that address the entire API life cycle and bridge the gap to microservices adoption.  

In the software world, API (Application Programming Interface) is a well-known term. In this blog, we will learn how to approach an API design using RAML 0.8 and Mulesoft.

The first step is to know the expectation the API design. Below are some common questions that arise when setting the expectations.

  • Is the API is going to be deployed on a DMZ (demilitarized) zone or within an enterprise zone? The answer to this will depend on whether the API is going to be public or private.
  • What will be the input and the output content type of the API? The answer to this will depend upon the entity (device/system) that will be consuming the API.
  • Which MuleSoft layer is the API going to fit in? The answer to this will depend upon whether API is going to be a source of the raw data (System Layer), a source of the orchestrated data (Process Layer), or encapsulated data to be provided across different channels (Experience Layer).
  • Is the API required in order to have RAML contract? In most use cases, a contract would be preferred, as it forms the base specification of the API.

Below is an example API spec that is developed for the following USE CASE using RAML 0.8 specifications on Mulesoft API designer.

Use Case Description

Develop an interface that can be used consumed by both mobile and web platform to track the equipment in the inventory. Below are the steps to approach this use case using RAML 0.8 specifications on the MuleSoft API designer.

Identify the operations that are required for the use case. This can be formulated by discussing them with the target audience of the API. In this example, the expectations of the API are CRUD operations. GET, POST, PUT, and DELETE are used.

Set the Base URI and Resource URI of the API. See the screenshot below.

Image title

Define the Request and Response schema and its corresponding examples. See the example screenshot below.

Image title

Define the error schema and its corresponding examples. See the example screenshot below.

Image title

Define resource types for the Resource URI. See the example screenshot below.

Image title

Define the behaviors of the API. See the example screenshot below.

  • Image title
  • The example API is deployed in the  Cloud hub for reference.

    This article highlights the approaches and questions required to design an API using RAML 0.8 on the MuleSoft API designer. We will continue expanding this example of API development with Anypoint Studio in the next article.

    Discover how organizations are modernizing their application architectures for speed and agility from the growing API economy

    Topics:
    raml ,mulesoft ,tutorial ,apis ,integration ,api design

    Opinions expressed by DZone contributors are their own.

    {{ parent.title || parent.header.title}}

    {{ parent.tldr }}

    {{ parent.urlSource.name }}