Created
March 13, 2025 09:02
-
-
Save pubudu538/fd97e5e7b1cdbff5939fb287b2e050ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Train Ticket Management API | |
description: API for managing train ticket bookings, schedules, and user details. | |
version: 1.0.0 | |
servers: | |
- url: https://api.traintickets.com/v1 | |
description: Production server | |
paths: | |
/trains: | |
get: | |
summary: Get available trains | |
description: Retrieve a list of available trains with schedules. | |
responses: | |
'200': | |
description: Successfully retrieved train list | |
/trains/{trainId}: | |
get: | |
summary: Get train details | |
description: Retrieve detailed information about a specific train. | |
parameters: | |
- name: trainId | |
in: path | |
required: true | |
schema: | |
type: string | |
responses: | |
'200': | |
description: Successfully retrieved train details | |
/tickets: | |
post: | |
summary: Book a train ticket | |
description: Create a booking for a train ticket. | |
responses: | |
'201': | |
description: Ticket successfully booked | |
/tickets/{ticketId}: | |
delete: | |
summary: Cancel a ticket | |
description: Cancel a booked train ticket. | |
parameters: | |
- name: ticketId | |
in: path | |
required: true | |
schema: | |
type: string | |
responses: | |
'200': | |
description: Ticket successfully cancelled | |
/users: | |
post: | |
summary: Register a user | |
description: Create a new user account. | |
responses: | |
'201': | |
description: User successfully registered | |
/payments: | |
post: | |
summary: Process a payment | |
description: Make a payment for a booked train ticket. | |
responses: | |
'201': | |
description: Payment successfully processed | |
/stations: | |
get: | |
summary: Get train stations | |
description: Retrieve a list of all train stations. | |
responses: | |
'200': | |
description: Successfully retrieved station list | |
/schedules: | |
get: | |
summary: Get train schedules | |
description: Retrieve train departure and arrival schedules. | |
responses: | |
'200': | |
description: Successfully retrieved train schedules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment