Professional Documents
Culture Documents
/hotels:
get:
post:
/{hotelId}:
get:
put:
delete:
6. Add query parameters to /hotels GET operations as shown below
/hotels:
get:
queryParameters:
city:
type: string
required: true
enum:
- Hyderabad
- Mumbai
- Delhi
- Bangalore
priceUnder:
type: integer
required: false
example: 2500
startDate:
type: string
pattern: ^(([0-9])|([0-2][0-9])|([3][0-1])) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4}$
example: 25 Oct 2020
required: false
endDate:
type: string
pattern: ^(([0-9])|([0-2][0-9])|([3][0-1])) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4}$
required: false
example: 28 Oct 2020
7. Click on the + button in the Files browser and create two folders with name examples and
dataTypes as shown below
8. Click on kebab menu (3 vertical dots menu) on the dataTypes folder import
HotelDataType.raml file from ‘…\Training Data\Oyo Hotels\’ folder. Click on kebab menu on
examples folders import HotelExample.raml and HotelsExample.raml files from ‘…\Training
Data\Oyo Hotels\’ folder as shown below
9. Define custom data type with name Hotel in the RAML by using below RAML definition. Use
yellow colour highlighted text from ‘Complete RAML’ word document that is attached below
FYR.
types:
Hotel: !include dataTypes/
HotelDataType.raml
10. Add responses to /hotels GET operation. FYR use either the below snippet or open the below
file, use the yellow highlighted text from it
responses:
200:
body:
application/json:
example: !include examples/
HotelsExample.raml
type: Hotel[]
11. Add request body and responses to /hotels POST operation as shown below or use the file FYR
post:
body:
application/json:
example: !include examples/
HotelExample.raml
type: Hotel
responses:
201:
body:
application/json:
example:
message: Hotel has been added
/{hotelId}:
get:
responses:
200:
body:
application/json:
example: !include examples/
HotelExample.raml
type: Hotel
put:
body:
application/json:
example: !include examples/
HotelExample.raml
type: Hotel
responses:
200:
body:
application/json:
example:
message: Hotel has been updated