REST API Reference
Contents
REST API Reference#
The exposed REST API is based on the Django REST Framework. The dependencies are included in both requirements.txt file and environment.yml file.
Usage#
In case there is a need for generating an authorization token, the following steps must be followed:
from the terminal, in the project directory, run:
python manage.py migrate authtoken
after running the authtoken migration, generate the authorization token for a specific user:
python manage.py drf_create_token <user_name>
The example in this package are made to work with the admin@scampml user so the token is specificallygenerated for that user.
REST API Documentation#
The entire REST API documentation is available on Swagger (http://127.0.0.1:8000/api/docs/), packed with try-it-on examples. A short description is also provided below.
Get the result of a scheduling algorithm on all POs in the DB. Currently only LETSA and B-Split are supported.
http
GET api/alg/<str:alg_name>/scheduling/ HTTP/1.1
Host: http://127.0.0.1:8000/
Accept: application/json
Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337
curl
curl -i -X GET 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/' -H "Accept: application/json" -H "Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337"
wget
wget -S -O- 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/' --header="Accept: application/json" --header="Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337"
httpie
http 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/' Accept:application/json Authorization:"Token 0bb226d80850463933e798e68424c6e2596a2337"
python-requests
requests.get('https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/', headers={'Accept': 'application/json', 'Authorization': 'Token 0bb226d80850463933e798e68424c6e2596a2337'})
Get the result of a scheduling algorithm for a specific PO from DB. Currently only LETSA and B-Split are supported.
http
GET api/alg/<str:alg_name>/scheduling/<int:po_rowid> HTTP/1.1
Host: http://127.0.0.1:8000/
Accept: application/json
Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337
curl
curl -i -X GET 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/<int:po_rowid>' -H "Accept: application/json" -H "Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337"
wget
wget -S -O- 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/<int:po_rowid>' --header="Accept: application/json" --header="Authorization: Token 0bb226d80850463933e798e68424c6e2596a2337"
httpie
http 'https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/<int:po_rowid>' Accept:application/json Authorization:"Token 0bb226d80850463933e798e68424c6e2596a2337"
python-requests
requests.get('https://http://127.0.0.1:8000/api/alg/<str:alg_name>/scheduling/<int:po_rowid>', headers={'Accept': 'application/json', 'Authorization': 'Token 0bb226d80850463933e798e68424c6e2596a2337'})