How to Design an API in Mulesoft

In this post I’m sharing my notes for spec driven development and cover the basics on creating an API specification. Spec driven development is a development process where your application is built in two distinct phases.

  • creation of the specification (design)
  • development of code to match the spec(development)

What are the phases for spec driven development in the Mulesoft world?

  • Design
  • Simulate
  • Feedback
  • Validate

So what is an API Specification and how to create one?

– API specification and definition are interchangeble. API Specification is much more concerned with the overall behavior of the API, and how it links to other APIs.

– To create API Specification we use a language called RAML.

  • RAML is a language for the definition of HTTP-based APIs that embody most or all of the principles of Representational State Transfer (REST).
  • It is a non-proprietary language to build API specifications
  • Data structure is hierarchical and by indentation not markup

Source: https://github.com/raml-org/raml-spec

Where can you start creating RAML?

  • Design Center on the Anypoint Platform
  • You can use Anypoint Studio
  • API Workbench – installed as an Atom package – http://apiworkbench.com/

Some key design features of creating an API Spec on the Anypoint Platform

  • Documentation is created from the RAML and shown in the API console
  • A mocking service can be used in the API console to test the API
  • Make an API discoverable by publishing it to the Private Exchange
  • You can publish to the public(needs Mulesoft review)
  • API portals are auto generated
  • Automatically generated api endpoint is created that uses mocking service
  • API portals can be shared to internal or external users
  • Share the API to external developers by making portal public
  • You can customize the public portal
    • logo
    • favicon
    • welcome text
    • fonts
    • image

What is a mocking service?

  • it is an auto generated api endpoint to use for testing

Those are just the basics and will cover more on upcoming posts.

Leave a Reply

Your email address will not be published. Required fields are marked *