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 button, then API Specification.
  4. Enter QuickStart-Store in the text field.
  5. Select Start with API designer.
  6. Click Create. The New API Specification setup screen with “QuickStart-Store” in the name field.

This loads a new API Specification window in API Designer, which lets you create 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 identifiersMap, 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—as well as it’s 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.

retargeting