-
Notifications
You must be signed in to change notification settings - Fork 2
API design
The API currently has 2 endpoints: register, run. In order to interact with our API endpoints, you must have a permission, this authorization takes the form of a token. This token allows API to authenticate the user and is passed through as an Authorization Token in the HTTP header, and this for any request to our API.
| name | type | length | description |
|---|---|---|---|
| username | string | no limit | name of the client user |
| model | string | no limit | the name of the simulation model |
| progress | integer | [0,100] | running simulation progress from 0 to 100 |
| runId | string | 8 | the running simulation id which is unique for each running simulation |
| token | string | 32 | a random string which allows API to authenticate the client user |
| host | string | no limit | the hostname where the simulation is running |
Each HTTP-header must contain the following mandatory information Content-Type: application/json. The API will always respond in JSON.
| Method | Path | Description |
|---|---|---|
| POST | /api/register | Allow user to register a simulation |
This call to the API requires the following arguments:
{
"username": <string>,
"model": <string>,
"progress": <float>,
}The response data will be in the following format:
{
"runId": <string>,
"token": <string>
}The url field will have the following format "/runs/:runId" simulation-number is randomly generated by the API.
| Name | Method | Path | Description |
|---|---|---|---|
| listing | GET | /api/runs | Return the list of all simulations |
| read | GET | /api/:runID | Return information on a specific run designed by the runID argument |
| update | PUT | /api/:runID | Refresh state of a running simulation |
| delete | DELETE | /api/:runID | Delete a specific simulation |
The API will return all running simulations informations.
[
{
"username": <string>,
"model": <string>,
"progress": <float>,
"runId": <string>
},
{
"username": <string>,
"model": <string>,
"progress": <float>,
"runId": <string>
},
.
.
.
]The API will return all the information of a specific running simulation. Example with the call : /run/1223
[
{
"username": <string>,
"model": <string>,
"progress": <float>,
"runId": <string> -> 1223
}
]
This call to our API requires the following argument:
- progress
- token
This call to our API requires the following argument:
- token