Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+

To Create and Publish an API Fragment

Requires November 2017 Release

  1. In Anypoint Platform, click Design Center. Set up a project to create a new API fragment:

    • In Projects, click Create. Select API Fragment.

    • In New API Fragment, type a name for your new project. For example, type myFragment.

  2. In Fragment Type, select a type from the list of types. For this example, select Example.

    • Trait

    • Resource Type

    • Library

    • Type

    • User Documentation

    • Example

    • Annotation Type

    • Security Scheme

  3. Click Create.

  4. In the editor located in the middle panel, below the generated fragment name #%RAML 1.0 NamedExample, on line 2 after value:, enter the example code you want to reuse. For example, use the following code:

    #%RAML 1.0 NamedExample
    value: [{
                    "id": 3,
                    "name": "Clementine Bauch",
                    "username": "Samantha",
                    "email": "",
                    "address": {
                      "street": "Douglas Extension",
                      "suite": "Suite 847",
                      "city": "McKenziehaven",
                      "zipcode": "59590-4157",
                      "geo": {
                        "lat": "-68.6102",
                        "lng": "-47.0653"
                    "phone": "1-463-123-4447",
                    "website": "",
                    "company": {
                      "name": "Romaguera-Jacobson",
                      "catchPhrase": "Face to face bifurcated interface",
                      "bs": "e-enable strategic applications"
                    } }]
  5. Click Publish to Exchange Publish to Exchange icon.

  6. In Publish API Fragment to Exchange, accept the defaults, and click Publish.

In this topic: