@@ -15,6 +15,88 @@ For examples how to use the CLI check out the file code/sample-cli-execution.sh,
python./code/cli.py--help
```
# REST-API
For using the REST-API please execute the file json_api.py.
Then a local server starts and you can use the following API-Endpoints. You may use tools like Postman to test the API. Many functions are also easily accessible via your browser.
## ocel-upload
### GET
```http
GET http://127.0.0.1:5000/ocel-upload
```
Returns a json with a list of already uploaded files.
### POST
```http
POST http://127.0.0.1:5000/ocel-upload
```
Using the key-field "file" (which is per default used in a file-upload formular in HTML) a new file is uploaded to the system. If the file already exists an error occurs.
## ocel-upload/\<filename\>
### DELETE
```http
POST http://127.0.0.1:5000/ocel-upload/<filename>
```
Deletes the file with the name 'filename'.
## ocel-cluster/\<filename\>
### POST
```http
POST http://127.0.0.1:5000/ocel-cluster/<filename>
```
Applies the core clustering algorithm for the file described via the filename.
Parameters of the algorithm can be described in the body of the request as json. The following is an example.
```json
{
"data":{
"object-type":"customers",
"mode":"all",
"max-cluster-count":4,
"attr-weights":{
"cflow":2
}
}
}
```
A list of all possible parameters:
- _object-type_: type of object to apply the clustering algorithm on.
- _mode_: either "all" or "existence" which defines how the assignment of events to object clusters is done.
- _attr-weights_: A JSON-object to define the weights of attributes (including the pseudo-attribute "cflow" which described the control-flow of events corresponding to a object in the ocel-file).
- _cluster-algorithm_: Defines the clustering-technique to be used. Default is kmeans. possible is also agglomerative or spectral
- _max-cluster-count_: Defines the maximum cluster count. This value can be -1 for auto-maximum (which is the default value) or anything greater or equal to two. ATTENTION: This parameter highly affects the runtime! Be careful/patient with using high values.
- _cluster-count_: If its set to 2 or greater (default is -1 which means automatic) the cluster-count is fixed and max-cluster-count is ignored.
## ocel-cluster/\<filename\>/clusters
### GET
```http
GET http://127.0.0.1:5000/ocel-cluster/<filename>/clusters
```
Returns a list of the found cluster-ids.
## ocel-cluster/\<filename\>/clusters/\<number\>
### GET
```http
GET http://127.0.0.1:5000/ocel-cluster/<filename>/clusters/<number>
```
Returns the ocel-file corresponding to the cluster with the index "number".