---
# System prepended metadata

title: Untitled

---

## REST Car Store by Relaxy Limited

Your task is to write a backend API service that can be used to store and retrieve car information.

It will have the REST APIs to create and fetch cars. You should also provide the ability to "tag" cars with model years and also be able to retrieve cars based on one or more model years.

e.g. an API to create a car with the make "Toyota" and model "Corolla"
and an API to attach a "year" information with it to identify model year (2006, 2010 etc.)

The API spec is as follows.

### `POST /cars`

Request:
```
{
    "make": <car brand>,
    "model": <car model>
}
```
### Response:
Status: `<Use Appropriate HTTP Status Code>`
```
{
    "id": <id>
}
```
### `GET /cars/{id}`
### Response:
Status: `<Use Appropriate HTTP Status Code>`
```
{
    "id": <id>
    "info": '<make> <model>'
    "years": [<year 1>, <year 2>, ...]
}
```
### `POST /cars/{id}/years`
### Request:
```
{
    "years": [<year 1>, <year 2>, ...],
    "expiry": <miliseconds>        
}
```
### Response:
Status: `<Use Appropriate HTTP Status Code>`
```
{ "success": true|false }
```
### `GET /cars?years=<year1>,<year2>,<year3>`
### Response:
Status: `<Use Appropriate HTTP Status Code>`
```
{
    "cars": [
        {
            "id": <id 1>,
            "name": "<make model year 1>",
            "years": [<year 1>, <year 2>]
        },
    ]
}
```
### Constraints:

- Has to be fast. Make appropriate optimizations.
- Must Dockerize the entire application (Optional)
- Entire codebase must be tracked in a Git Repository.
- Use appropiate status codes for all responses.


### Notes

Pay attention to performance and adherence to the specification provided above. You can use any technology you deem appropriate.

This will test your ability to infer expectations based on specified requirements. Having a shell script to boot up the service, populate the data and test random APIs is a big plus.

Please provide link to Github/Gitlab repository when done.

### Deadline 

5 Days.
