# Музыкальный Сервис

## HTTP API

### Create New Track

---

Создаёт новый трек.

```http title="Request"
PUT /api/tracks HTTP/1.1
Accept: application/json
```

```json title="Request Body Example"
{
  "title": "My Track Title",
  "author": "Me",
  "duration": 123000
}
```

```json title="Response Body Example"
{
  "id": 1,
  "title": "My Track Title",
  "author": "Me",
  "duration": 123000,
  "auditions": 0
}
```

### Get Track

---

Возвращает трек по идентификатору.

```http title="Request"
GET /api/tracks/{id} HTTP/1.1
```

```json title="Response Body Example"
{
  "id": 1,
  "title": "My Track Title",
  "author": "Me",
  "duration": 123000,
  "auditions": 0
}
```

### Increment auditions

---

Увеличивает число прослушиваний трека на 1.

```http title="Request"
POST /api/tracks/auditions/{id} HTTP/1.1
```

```json title="Response Body Example"
{
  "auditions": 1
}
```

### Top Tracks

---

Возвращает список из десяти наиболее прослушиваемых треков.

```http title="Request"
GET /api/tracks/top HTTP/1.1
```

```json title="Response Body Example"
[
  {
    "id": 1,
    "title": "My Track Title",
    "author": "Me",
    "duration": 123000,
    "auditions": 0
  },
  {
    "id": 2,
    "title": "My Track Title",
    "author": "Me",
    "duration": 123000,
    "auditions": 0
  },
  ...
]
```