WebApi for tracking transits and generating reports based on added data.
- .NET Core
- C#
- Entity Framework Core
Clone repository and build.
To have connection with Google Maps Distance Matrix API (required for dynamic distance calculations) generate your private key.
Then paste it in file:
TransitsTracker.API/ExternalServices/GoogleMaps/GoogleMapsService.cs
private const string API_KEY = "your_api_key";
Created and built with VS Enterprise 2017.
| Title | Get transits |
| Description | Returns all transits. |
| URL | /api/transits |
| Method | GET |
| Data params | None |
| Params | None |
| Success | Example: /api/transits Code: 200 Content: |
[ |
|
{ |
|
"source_address": { |
|
"city": "Warszawa", |
|
"street": "Poznańska", |
|
"house_number": "3" |
|
}, |
|
"destination_address": { |
|
"city": "Poznan", |
|
"street": "Bukowska", |
|
"house_number": "15" |
|
}, |
|
"price": 320, |
|
"date": "2018-03-15T00:00:00", |
|
"distance": 310 |
|
}, |
|
... |
|
] |
|
| Error | todo |
| Title | Get transit |
| Description | Returns transit with requested id. |
| URL | /api/transits/:id |
| Method | GET |
| Data params | None |
| Params | Required: id [integer] |
| Success | Example: /api/transits/1/ Code: 200 Content: |
{ |
|
"source_address": { |
|
"city": "Warszawa", |
|
"street": "Poznańska", |
|
"house_number": "3" |
|
}, |
|
"destination_address": { |
|
"city": "Poznan", |
|
"street": "Bukowska", |
|
"house_number": "15" |
|
}, |
|
"price": 320, |
|
"date": "2018-03-15T00:00:00", |
|
"distance": 310 |
|
} |
|
| Error | todo |
| Title | Create new transit |
| Description | Creates new transit. Distance between given addresses is calculating automatically. |
| URL | /api/transits |
| Method | POST |
| Data params | |
{ |
|
"source_address": { |
|
"city": "Warszawa", |
|
"street": "Poznańska", |
|
"house_number": "3" |
|
}, |
|
"destination_address": { |
|
"city": "Poznan", |
|
"street": "Bukowska", |
|
"house_number": "15" |
|
}, |
|
"price": 320, |
|
"date": "2018-03-15", |
|
} |
|
| Params | Required: todo Optional: todo |
| Success | Example: Code: 200 Content: None |
| Error | todo |
| Title | Get daily report |
| Description | Returns number of kilometers traveled and the money earned between the two dates. |
| URL | /api/reports/daily?start_date=:start_date&end_date=:end_date |
| Method | GET |
| Data params | todo |
| Params | Required: start_date [date], end_date [date] |
| Success | Example: api/reports/daily?start_date=2018-03-10&end_date=2018-03-15 Code: 200 Content: |
{ |
|
"total_distance": 310, |
|
"total_price": 320.00 |
|
} |
|
| Error | todo |
| Title | Get monthly report |
| Description | Returns the number of kilometers traveled, the average distance and the average payment for each day in current month |
| URL | /api/reports/monthly |
| Method | GET |
| Data params | None |
| Params | None |
| Success | Example: /api/reports/monthly Code: 200 Content: |
{ |
|
"items": [ |
|
{ |
|
"date": "2018-04-01T00:00:00", |
|
"total_distance": 0, |
|
"avg_distance": 0.0, |
|
"avg_price": 0.0 |
|
} |
|
] |
|
} |
|
| Error | todo |
- Google Maps Distance Matrix API
- xUnit - In progress.
- Git