DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Operator Overloading in Java
  • RBAC With API Gateway and Open Policy Agent (OPA)
  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Competing Consumers With Spring Boot and Hazelcast

Trending

  • Operator Overloading in Java
  • RBAC With API Gateway and Open Policy Agent (OPA)
  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Competing Consumers With Spring Boot and Hazelcast
  1. DZone
  2. Data Engineering
  3. Databases
  4. Creating an API Specification in a Design Center

Creating an API Specification in a Design Center

Look at how to create an API specification in a design center.

Ramesh janga user avatar by
Ramesh janga
·
Jan. 10, 19 · Tutorial
Like (3)
Save
Tweet
Share
12.02K Views

Join the DZone community and get the full member experience.

Join For Free

Start by clicking into a design in the Anypoint platform:

  1. Click the create button-->API specification.

  2. Fill out the modal's text field with a name for API specification.

  3. Choose "Start with API Designer"

  4. Click create.

Image title

It will load a new API specification window in API Designer allowing you to create your API specification:-

  1. Remove the default text in the textbox so it's empty.

  2. Copy and paste the RAML below into a blank API designer textbox.

#%RAML 1.0
title: DevRel-Quick Start Products API
version: v1.0

securitySchemes:
  basic:
    description: |
      This API supports Basic Authentication.
    type: Basic Authentication


securedBy: [basic]

types:
  product:
    properties:
      identifier?: string
      identifiers: IdentifierMap
      brand: string
      model: string
      rating: number
      description?: string
      pictures: string[]
      price: price

  price:
    properties:
      amount: amount
      salesUnit: salesUnit

  amount:
    properties:
      currency: string
      currencyValue: number
      name : string

  salesUnit:
    properties:
      code: string
      name: string

  Identifier:
    type: string
    pattern: ^[0-9A-Za-z-]+
    minLength: 3
    maxLength: 36

  IdentifierMap:
    type: array
    items:
      type: object
      properties:
        /[0-9A-Z-]+/:
          type: Identifier

/products:
  /{productId}:
      uriParameters:
        productId: string
      get:
        responses: 
          200:
            body:
              application/json:
                type: product
                example: |
                  {
                    "brand": "Anypoint",
                    "identifier": "eb8c8ca7-3c42-4489-a820-3aa138430b75",
                    "identifiers": [{
                      "SKU": "UGG-BB-PUR-06"
                    }],
                    "model": "Smart Slim Micro Stripe Shirt",
                    "rating": 5,
                    "description": "Shirt by ASOS Tall. Stripe woven fabric. Added stretch for comfort. Spread collar. Button placket. Slim fit - cut close to the body. Machine wash. 98% Cotton, 2% Elastane. Our model wears a size Medium Long and is 193cm/6'4\" tall",
                    "pictures": [
                      "https://launderkart.com/wp-content/uploads/2016/07/Shirt.jpg",
                      "https://cdni.llbean.net/is/image/wim/251423_47_41?wid=428&hei=494"
                    ],
                    "price": {
                      "amount": {
                        "currency": "USD",
                        "currencyValue": 34.90,
                        "name": "Amount"
                      },
                        "salesUnit": {
                        "code": "EA",
                        "name": "Each"
                      }
                    }
                  }
          404:
            body: 
              application/json:
                properties:
                  message: string
                example: |
                  {
                    "message" : "Product not found"
                  }

If you see the above specification, that clearly shows you the total API from top to bottom

It demonstrates the access process and sends it globally for every endpoint that is secured by a Mulesoft parameter.

The feature designs a data-type of product with its parameters and methods of it. Below, you can check data types like map identifiers, sales units, and costs. By selecting these data types, they can Re_Implement by referring them to the complete RAML file.

Browsing further, the feature shows the endpoint and what it takes from the requester like content type, item ID, and query parameters with its responses. Last but not least, we can see one exception error with a status code as 404 Not found. On the off chance that you are intending to get into the API integration design, you ought to complete a Mulesoft training

API Design

Opinions expressed by DZone contributors are their own.

Trending

  • Operator Overloading in Java
  • RBAC With API Gateway and Open Policy Agent (OPA)
  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Competing Consumers With Spring Boot and Hazelcast

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: