Create an API Spec

Creating an API Spec in Design Center

Let's start by going into Design Center in Anypoint Platform. The Design Center is your cloud-based environment for building API specifications and Mule applications. For this project, we focus on API specifications.

  1. Sign in to MuleSoft
  2. Once you’re signed in to MuleSoft, go to the Design Center and select Start designing. The Anypoint Platform splash screen with an arrow pointing to the Start designing button.
  3. Select the Create New button, then Create API specification.
  4. Enter QuickStart-Store in the Name field.
  5. Check the Text editor button.
  6. Make sure RAML 1.0 is the selected Language.
  7. Make sure Design Center is selected for the Save location option.
  8. Click Create Specification. The New Specification window with the options indicated in the steps above

This loads a new API Specification window in API Designer. This is where you design your API specification.

  1. Delete the default text in the textbox so it’s empty.
  2. Copy and paste the RAML found here into the blank API Designer textbox.

Understand the Specification

The specification you just entered starts by describing the overall API from the top-level.

It then defines the authentication methods supported (basic auth) and then assigns that globally for all endpoints and methods with the securedBy parameter.

The specification creates a data type of product with its parameters and types within it. Below that, you can find data types such as IdentifierMap, price, sales unit, and more. By specifying these data types, they can be reused by referencing them throughout the RAML file.

Scrolling further, the spec describes the endpoint /products/{productId} and what it expects from the requester—the item ID, content-type, and enumerated query parameters—and its responses. A successful 200 outputs the data types specified for the JSON body, along with an example of the 200 response. At the very end, there’s also one exception error with a status code of 404 Not Found.

We won't check any of your setup. Click Verify Step to go to the next step in the project.