Notes: Module 2: Mule 3 Fundamentals: Designing APIs

Spec driven development:
- A development process where your application is built in two distinct phases:
--- The creation of a spec (the design phase)
--- Development of code to match the spec (the development phase)

Approaches to API design:
- Hand Coding
- Swagger
- Blueprint (Apiary)

2-1) Introducing RAML

RAML: RESTful API Modelling Language
- A simple, structured, and succinct way of describing RESTful APIs
- Encourages reuse, enables discovery and pattern-sharing, and aims for merit-based emergence of best practices
- A non-proprietary, vendor neutral open spec

RAML is based on broadly-used standards such as YAML and JSON.
Data structure hierarchy is specified by indentation.

2-2) Using API Designer to define APIs

Image: Using API Designer to define APIs

2-3) Testing API without writing code

‘Mocking Service’ introduces a baseUri.

2.4) Using RAML to define specifications for requests and responses

Responses must be a map of one or more HTTP status codes.
For each response, specify possible return data types along with descriptions, examples, or schemas.
For a request, similarly specify the possible request data types along with description, examples and/or schemas.

2.5) Creating API portals (using API Manager)

API Portal:
“Publishing an API portal allows you to expose documentation and other content that can help developers understand how to use your API.”

2.6) Adding APIs to the Exchange

Anypoint Exchange is a library of connectors, templates, examples, RAMLs, WSDLs, and more...