Skip to content

Instantly share code, notes, and snippets.

@hpatoio
Last active November 28, 2022 10:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save hpatoio/3aeea8159fb9046a2feba75d39a8d21e to your computer and use it in GitHub Desktop.
Save hpatoio/3aeea8159fb9046a2feba75d39a8d21e to your computer and use it in GitHub Desktop.

TUI Musement | Backend tech homework

Musement API has the endpoint GET /api/v3/cities that returns the cities where TUI Musement has activities to sell. We now need to add weather information for each city available in TUI Musement's catalogue.

Step 1 | Development

The candidate must write an CLI application that:

  • gets the list of the cities from TUI Musement's API
  • for each city gets the forecast for the next 2 days using http://api.weatherapi.com and print to STDOUT "Processed city [city name] | [weather today] - [wheather tomorrow]"

Example:

Processed city Milan | Heavy rain - Partly cloudy

Processed city Rome | Sunny - Sunny

FAQs

  • Do I need a DB? No, for this project a DB is not needed
  • Do I need a webserver? No, the requirement is a CLI application not an API

Step 2 | API design (no code required)

Now that we have a service that reads the forecast for a city, we want to save this info in the TUI Musement's API. The endpoint that receives information about weather for a city does not exist, we only have these 2 endpoints for cities

GET /api/v3/cities
GET /api/v3/cities/{id}

Please provide the design for:

  • endpoint/s to set the forecast for a specific city
  • endpoint/s to read the forecast for a specific city

Please consider that we need to answer questions like :

  • What's the weather in [city] today ?
  • What will it be the weather in [city] tomorrow ?
  • What was the weather in [city] on [day] ?

For each endpoint provide all required information: endpoint, payload, possible responses etc and description about the behavior.

FAQs

  • Do I have to describe the API design using a .md or .txt file? You're free to use any tool you think can be useful to complete this step.

Notes:

  • weatherapi.com has a free plan. Create your own account to get a key
  • we suggest to use the call http://api.weatherapi.com/v1/forecast.json?key=[your-key]&q=[lat],[long]&days=2 to get the forecast for a city but feel free to use the one you prefer
  • we are only interested in the information under "condition" from weatherapi.com
  • OpenAPI specs and doc for TUI Musement's API are here https://partner-api.musement.com/reference/
  • let's pretend that all the TUI Musement cities are returned by GET /api/v3/cities and you don't need to paginate
  • latitude and longitude set for cities in TUI Musement database are not always accurate. For Amsterdam we have 52.374 and 4.9 so when you query weatherapi.com using these values you get "De Wallen". Let's forget about this and let's pretend it is ok

Evaluation

How and what we evaluate and some general hints

  • Focus on the requirements, read them again if necessary
  • We do not consider the resolution time an important element
  • We do not evaluate only code but the solution as a whole
  • Feel free to attach a document to the solution to explain/describe your design/implementation choices
  • Develop the test as you should release it as OSS on GitHub
  • Second step we evaluate design approach and documentation, consider your API design will be used by a colleague that will implement it.

Must and nice to have

A good test:

  • Must have a clear README with all needed info about the project (how to install, how to run and any useful information)
  • Must have a consistent coding standard and a tool configured to prove it
  • Must have a clear GIT history that let people understand the evolution of the project
  • Should have a static code analyser with the higher level possible (for interpreted languages)
  • Should have a good test coverage that allows people to change pieces of code without being afraid to introduce/reintroduce bugs
  • Should provide a docker environment to easily set up the needed dev environment

Sharing

Please share a bundled/archived repository showing your commit history.

Git example for sending us a standalone bundle:

 git bundle create <yourname>.bundle --all --branches

VERY IMPORTANT

Specify in the README:

  • your name and surname
  • If you are going to work for TUI Musement through a consulting company please specify the name of the company
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment