Skip to content

API Endpoints for Tour Guide Manager

Code tour guide

Endpoints are defined in main.py. When an endpoint is called, the corresponding ros service is also called. Such services are defined in ros_com.py.

Endpoints

  • GET /tour : returns all the tour names.
  • GET /tour/{tour_name} : returns the tour object with the tour_name.
  • POST /tour/ : creates a new tour using the tour in the request body. Will fail if a tour with the same name already exists!
  • PUT /tour/ : updates an existing tour using the tour in the request body. Will fail if no tour exists with the tour.tour_name.
  • DELETE /tour/{tour_name} : deletes a tour with the tour_name. Fails if no tour exists with tour_name.

But I am a visual learner

sequenceDiagram
  participant ui as Tour Guide Manager UI App
  participant http as HTTP Endpoints on helloric_ui_com
  participant ros as ROS

  ui ->> ui: User opens app - request all tour names
  ui ->> http: GET /tour
  http ->> ros: /tour_list: Empty - Service list_tour
  ros ->> ros: Queries all tour names from DB
  http ->> ui: RESPONSE tour_list: List[]

  ui ->> ui: User clicks on a tour - Request a tour
  ui ->> http: GET /tour/{name}
  http ->> ros: /tour_get: String - Service get_tour
  ros ->> ros: Queries Tour from DB with names
  http ->> ui: RESPONSE tour: TourModel

  ui ->> ui: User creates new tour
  ui ->> http: POST /tour BODY TourModel
  http ->> ros: /tour_create: Tour - Service create_tour
  ros ->> ros: Inserts new tour in DB
  http ->> ui: RESPONSE success: Bool

  ui ->> ui: User updates an existing tour
  ui ->> http: PUT /tour/{name}
  http ->> ros: /tour_update: Tour - Service update_tour
  ros ->> ros: Updates existing tour in DB
  http ->> ui: RESPONSE success: Bool

  ui ->> ui: User deletes a Tour
  ui ->> http: DELETE /tour/{name}
  http ->> ros: /tour_delete: String - Service delete_tour
  ros ->> ros: Deletes tour in DB
  http ->> ui: RESPONSE success: Bool