https://github.com/nunohpinheiro/pnia-api
Phone Number Info Aggregate API - .NET Core 3.0 with Docker
https://github.com/nunohpinheiro/pnia-api
csharp dotnet-core rest-api
Last synced: over 1 year ago
JSON representation
Phone Number Info Aggregate API - .NET Core 3.0 with Docker
- Host: GitHub
- URL: https://github.com/nunohpinheiro/pnia-api
- Owner: nunohpinheiro
- Created: 2019-11-09T12:35:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T06:23:47.000Z (over 3 years ago)
- Last Synced: 2025-02-07T07:32:02.935Z (over 1 year ago)
- Topics: csharp, dotnet-core, rest-api
- Language: C#
- Homepage:
- Size: 1.79 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README_PniaAPI_NunoPinheiro.md
Awesome Lists containing this project
README
# pnia v1.1 - Resolution, by Nuno Pinheiro
This exercise was solved with:
- C# .NET Core v3.0
- Docker v19.03.2
# Phone number information aggregator API
**Endpoint:** `/aggregate` (POST)
**Requests:** The requests' body must be an array of phone numbers, as described by the exercise.
**Responses:**
1. Successful response, with content: HTTP status **200**, with the formatted data in the responses' body.
2. Successful response, without content: HTTP status **204**, without body. If no valid input is given in the request, there will be any matching content, so, the responses' body is empty.
3. Unsuccessful response, with error: HTTP status **500**, showing the occurring error within the application.
- A valid input was defined as any phone number that:
- Is interpreted as it;
- Matches a prefix in the list;
- Matches a sector returned by the business sector API.
**Settings:**
In the project's file *appsettings.json*, some custom settings are available, in order to change behaviors within the application:
| Settings Section | Setting | Meaning | Allowed values | Default value |
|------------------|----------|---------|-------------------|---------------|
| CacheOptions | UseCache | Use cache or not | true/false (bool) | true |
| | ExpireTimeMinutes | Cache expiration time (minutes) | double | 5 minutes |
| ServiceEndpoints | PhoneBusinessSector | Endpoint to search a phone number's business sector | string | --- |
- When the use of cache is set, the content from `prefixes.txt` file is cached.
# Deployment
- Please, use Docker, running: `docker-compose up pniaapi`
- The endpoint will be reachable through: `http://localhost:8080/aggregate`