One of our developers built a simple weather reporting app. The app has a list of locations with weather information. Locations are fetched using a HTTP GET but the server is a bit flakey and sometimes fail.
Unfortunately the app is not complete and it's up to you to complete it. There is a backlog of features to implement and some nice to have (bonus) features.
The backend server is a bit unstable which the app needs to handle.
We need 2 new features in this task: add and remove locations.
All API requests require a X-Api-Key
HTTP header. One X-Api-Key
is generated for you on app install and is used when fetching current stored locations.
Implement the functionality to add a new location.
URL : https://app-code-test.kry.pet/locations
Required header: X-Api-Key
Method: POST
Data constraints
Provide name of location and weather together with temperature. All fields are required except id
. If id
is omitted, one will be created for you.
{
"id": "optional string",
"name": "location name",
"status": "SUNNY",
"temperature": 20
}
Code : 200
Content :
{
"id": "optional string",
"name": "location name",
"status": "SUNNY",
"temperature": 20
}
Condition : If required field is missing
Code : 400
Code : 500
Implement the functionality to remove a location. Parameter :id
is required to identify which location should be deleted.
URL : https://app-code-test.kry.pet/locations/:id
Required header: X-Api-Key
Method: DELETE
Data constraints
id
of location
Code : 200
Condition : If id
missing or invalid.
Code : 400
Code : 500
We want the project to follow good coding principles, the aim should be for the code to be testable, easy to maintain and easy to understand. Make sure you factor the time limit into your planning, prioritise bigger architectural refactorings over smaller style improvements.
At least one unit test that covers one of the usecases explained above. If you have enough time, bonus points are awarded if you write tests for each public function exposed by the class(es) that handle your business logic
- Add nice animations
Spend three to six hours working on this assignment - make sure to finish the issues you start.
Put the code in a GitHub repository and send us the link (niklas.holmqvist@kry.se) when you're done.
Good luck!