# SMART RESTful API Gateway
https://articonf1.itec.aau.at:30401/api/ui/ 

The API Gateway serves as an interface to external applications. Here, users are authenticated and blockchain transactions are added.

## Authentication
```POST https://articonf1.itec.aau.at:30401/api/tokens``` with body:
```
{
  "password": "password",
  "username": "regular@articonf1.itec.aau.at"
}
```
returns the JWT token for authentication, e.g. 
```
{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
```
This token is used for authentication as _regular user_ on all microservices currently supporting authentication. Therefore the authentication header "```Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...```" has to be added to the request.

## Blockchain transactions
```POST https://articonf1.itec.aau.at:30401/api/trace``` with body:
```
{
  "ApplicationType": "use-case identifier as string",
  "key": "value",
  ...
}
```
adds a blockchain transaction entry for ApplicationType with all the keys and values. These will be converted and stored in our own format for creating multilayers and communities.

# Business Logic Microservice
https://articonf1.itec.aau.at:30420/api/ui

This microservice contains use-case specific informations, like schemas and contexts.

## Schema information
```GET https://articonf1.itec.aau.at:30420/api/use-cases/{use-case}/schema``` returns all schema mappings for the use-case identifier. The mapping is used to flatten nested input from the blockchain.

## Context information
```GET https://articonf1.itec.aau.at:30420/api/use-cases/{use-case}/layers``` returns all layers from the schema used for clustering interally.

# Role Stage Discovery Microservice
https://articonf1.itec.aau.at:30103/api/ui

This microservice contains the communities based on clusters and similarities between communities.

The endpoints are currently refactored, I will describe them once we are finished and processed data is available.