Session 2 Assignment

Task for the day:
Design a RAML for below mentioned resources
Note :
• All examples and schema should be in separate files and should me included in main RAML.
• Design properly, check what are mandatory and what are not mandatory .
- Test if it ’s working as expected before submitting .
- Submit the mock url in the google docs form
Resource name : /OrderDetails
Method : GET
Request : No request needed
Response : Output type should be Array of JSON Objects. Eg :
[
{
Id : 123,
productName : “Sweat Shirt”,
productType : “Clothing”,
quantiyAvailable : 20,
pricePerItem : 2500
},
{
Id : 245,
productName : “TV”,
productType : “Television”,
quantiyAvailable : 40,
pricePerItem : 150000
},
{
Id : 123,
productName : “Stove”,
productType : “Kitchen appliances”,
quantiyAvailable : 10,
pricePerItem : 25200
}
]
Success Status : 200
Resource name : /getOrderDetails/{orderId}
Method : GET
Request : pass “id” , “orderType” as uri param
Response : Output type should be Single JSON Object. Eg :
{
Id : 123,
productName : “Sweat Shirt”,
productType : “Clothing”,
quantiyAvailable : 20,
pricePerItem : 2500
}
Validations Required: id is mandatory .
Success Status : 200
Author: Sravan Lingam
MuleSoft for Absolute Beginners 2 of 3
Resource name : /createOrder
Method : POST
Request : “orderType” as queryParam (mandatory )
body :
{
Id : 123,
productName : “Sweat Shirt”,
quantiyAvailable : 20,
pricePerItem : 2500
}
Validations/schema for body:
id = Number and required
productName= string and required . Min length is 3 , max is 10
quantiyAvailable = number , default 0
price per item = number , not mandatory
Response : Output type should be Single JSON Object. Eg :
{
message : “Order 123 created successfully “
}
Success Status : 201
================================================================================
Resource name : /updateOrder
Method : PUT
Request : “orderId” ,“orderType” as queryParam (mandatory )
body :
{
productName : “Sweat Shirt”,
quantiyAvailable : 20,
pricePerItem : 2500
}
Validations/schema for body:
productName= string and required . Min length is 3 , max is 10
quantiyAvailable = number , default 0
price per item = number , not mandatory
Response : Output type should be Single JSON Object. Eg :
{
message : “Order 123 updated successfully “
}
Success Status : 202
Author: Sravan Lingam
MuleSoft for Absolute Beginners 3 of 3
Resource name : /updateOrder
Method : DELETE
Request : “orderId” as queryParam (mandatory )
Response : Output type should be Single JSON Object. Eg :
{
message : “Order 123 deleted successfully “
}