https://github.com/vandlj/osslicensesapi
OSSLicensesAPI is a comprehensive API designed to provide information and insights on various open-source software licenses. Built using C# and Python, this API facilitates easy access to license data for developers and organizations.
https://github.com/vandlj/osslicensesapi
api api-rest csharp licences open-source oss python software-licensing
Last synced: about 2 months ago
JSON representation
OSSLicensesAPI is a comprehensive API designed to provide information and insights on various open-source software licenses. Built using C# and Python, this API facilitates easy access to license data for developers and organizations.
- Host: GitHub
- URL: https://github.com/vandlj/osslicensesapi
- Owner: VandlJ
- Created: 2024-03-01T09:31:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-21T21:37:26.000Z (over 2 years ago)
- Last Synced: 2025-02-02T14:13:49.925Z (over 1 year ago)
- Topics: api, api-rest, csharp, licences, open-source, oss, python, software-licensing
- Language: C#
- Homepage:
- Size: 53.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
This C# project is a RESTful API designed to manage and query compatibility data between software licenses. It utilizes ASP.NET Core framework for building web applications and Entity Framework Core for database operations.
## Overview
The API includes functionality for checking compatibility between two licenses, retrieving unique license names, and managing license compatibility records. The compatibility data is stored in a MySQL database.
## Database Setup
The MySQL database is used to store license compatibility data. The database schema includes a table named `license_compatibility` with columns for the first license (`License1`), the second license (`License2`), and the compatibility status (`Compatibility`). The database is populated using a Python script (`populate_database.py`) that reads data from a CSV file (`matrix.csv`) and inserts it into the `license_compatibility` table.
## API Endpoints
### Check Compatibility
- **GET** `/api/CompatibilityMatrix/CheckCompatibility`:
- This endpoint accepts query parameters representing two license names (`license1` and `license2`) and returns the compatibility result as a `CompatibilityResponseModel` JSON object.
### Get Unique License Names
- **GET** `/api/CompatibilityMatrix/GetLicenses`:
- This endpoint retrieves a list of unique license names stored in the database and returns them as a JSON array of strings.
### Swagger UI
The API is documented using Swagger/OpenAPI specification and can be explored interactively in a web browser by accessing the following URL: [http://localhost:5191/swagger](http://localhost:5191/swagger).
## Project Structure
- `Program.cs`: Configures the application and sets up the HTTP request pipeline.
- `InLicenses.cs`: Defines the input model for licenses.
- `LicenseCompatibility.cs`: Defines the model for license compatibility records.
- `ApplicationDbContext.cs`: Represents the database context for Entity Framework Core.
- `CompatibilityMatrixController.cs`: Implements the API endpoints for license compatibility management.
- `populate_database.py`: Python script to populate the MySQL database with license compatibility data from a CSV file.
## Usage
To use the API:
1. Set up a MySQL database and configure the connection string in `appsettings.json`.
2. Run the Python script `populate_database.py` to populate the database with license compatibility data.
3. Run the C# project to start the API.
4. Explore the API endpoints and interact with them using Swagger UI.
## Notes
- This project demonstrates how to build a RESTful API using ASP.NET Core, Entity Framework Core, and MySQL database.
- The Python script `populate_database.py` is provided as an example of how to automate the process of populating the database with data from a CSV file.
- For more information on configuring and using Swagger/OpenAPI with ASP.NET Core, refer to [Swashbuckle documentation](https://github.com/domaindrivendev/Swashbuckle.AspNetCore).