0% found this document useful (0 votes)
848 views

DIY Exercise 3-1 - Create An API Specification With RAML

The document provides instructions for creating an API specification using RAML. The objective is to create a RAML specification for a customer accounts API that separates data type definitions into reusable files. Specifically, it outlines requirements for the API to have GET and POST methods on an /accounts resource, define query parameters and headers, and include examples of request and response bodies. The task is to create the RAML specification in Design Center, publish it to Anypoint Exchange, and test it using the API Console and public portal.

Uploaded by

Rakkammal Rama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
848 views

DIY Exercise 3-1 - Create An API Specification With RAML

The document provides instructions for creating an API specification using RAML. The objective is to create a RAML specification for a customer accounts API that separates data type definitions into reusable files. Specifically, it outlines requirements for the API to have GET and POST methods on an /accounts resource, define query parameters and headers, and include examples of request and response bodies. The task is to create the RAML specification in Design Center, publish it to Anypoint Exchange, and test it using the API Console and public portal.

Uploaded by

Rakkammal Rama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DIY Exercise 3-1: Create an API specification with RAML

Time estimate: 1 hour

Objectives
In this exercise, you create an API specification using RAML. You will:
• Appropriately specify GET and POST methods.
• Appropriately define URI parameters, query parameters, and headers.
• Restrict possible values using an enumeration.

Scenario
Your company needs to expose a customer accounts database as a System API for the rest of the
organization. The first step is to create the RAML specification and post it to your company’s private
Anypoint Exchange so all stakeholders can review and provide feedback. This RAML specification
needs to separate out data type definitions from the main API RAML file into separate reusable RAML
files.

Create the API specification


In Design Center, create a RAML specification called Accounts API with the following requirements:
• The API has a resource called accounts.
• All client requests must include the required header Requester-ID. This header helps identify the
person in the organization making account requests.
• The /accounts resource has a GET method with a required queryParameter named type, where
type must be either personal or business. The type query parameter is used to return records
that match that account's type.
• The GET method for the /accounts resource has two optional string queryParameters named
name and country. The name query parameter value is used to filter and return all account
records for a particular account owner. The country query parameter value is used to filter and
return records matching the account owner's country of residence.
• The GET method’s response data is an array of Account objects. To represent the response
data, define and use an Account data type that contain the following fields: id, firstName,
lastName, address, postal, country, miles, creationDate, and type. The creationDate field is of
type datetime and miles is of type integer.
• The API defines and uses a data type for the Account object that is stored in a separate RAML
file.
• The Account data type definition has a corresponding example that is included in the main API
RAML file or in the Account data type RAML file.

1
• The /accounts resource has a POST method that accepts an array of Account objects (with no
id and no creationDate field) in JSON format and returns a JSON message: {"message":
"Account created (but not really)"}. This Account object is represented as a new data type that
does not have id or creationDate fields, makes the type field required, and has a corresponding
example.
• Each method should have a description.
• Each method should have a custom 400 error status message example in JSON format.

Publish the API to Anypoint Exchange


Publish the API to Anypoint Exchange and then test the mocked endpoint using the API Console and
create a public portal for the API.

Verify your solution


Load the solution /files/module03/accounts-mod03-api-solution.zip (in the MUFundamentals4.x DIY
Files zip that you can download from the Course Resources) and compare your solution.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy