-
-
Notifications
You must be signed in to change notification settings - Fork 493
URL Endpoints
/api/login
Form data: user_name, password Returns a auth token in response header for a successful login
/api/user
Headers: Content-type : Application/JSON, token:
JSON: {"user_name":"<username>", "password":"<password>", "auth":<authleval>, "email":"<email>"}
Auth levels
- 0:ADMIN
- 1:STUDENT
- 2:ACADEMIC
- 3:NONACADEMIC
Headers: token: Returns a JSON of all the users
/api/user/<username>
Deletes the user from system. Adviced not to use.
/api/user/<username>
Headers: Content-type : Application/JSON, token:
JSON: {"user_name":"<username>", "password":"<password>", "auth":<authleval>, "email":"<email>"}
Update the given user
/api/regularuser
Headers: Content-type : Application/JSON
JSON: {"user_name":"<username>", "password":"<password>", "email":"<email>"}
/api/user/blocked
Headers: token: Returns a JSON of all the blocked users
/api/user/blocked/<username>
Headers: token:
Blocks the given user
/api/download
Headers: Content-type : Application/JSON, token:
JSON: {"link":"<download link>"}
/api/download/<page>
Headers: token:
Returns JSON of all the completed downloads. Page contains 15 records ordered by added time. Page number is a int.
Status
- 0:DEFAULT- not started
- 1:STARTED - started ot finished yet
- 2:DELETED - download completed but deleted from disk
- 3:COMPLETED - download completed
- 4:ERROR - download error
/api/download/<id>
Deletes the download only if it is not started.
/api/download/rate/
Headers: Content-type : Application/JSON, token:
JSON: {"rate":"<rating between 0-5>"}
Adds the rating to download. If exists, update.
/api/user/downloads/
Headers: token: Returns a JSON of all the downloads of current user. Page contains 15 records ordered by added time. Page number is a int.
/api/download/
Headers: token: Returns file as multipart form data. Does not return a new auth token header
/api/user/requests
Headers: token: Returns a JSON of all the users who has signed up and not been approved yet
/api/user/approve/
Headers: Content-type : Application/JSON, token: Approve the user with given username
There are two types of storage entities, folders and files. The endpoint structure is similar for both, distinguished only by the type
query parameter. It takes two values:
-
fr
for Folders -
fl
for Files
/api/user/:user_id/drive/:id/children
Returns a list of two objects, for file and folder children respectively. Each object contains a list of names of the corresponding entity.
GET /api/user/1/drive/1/children HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
/api/user/:user_id/drive/:id/children
Returns a list containing a single object with entity details (id, name, type)
GET /api/user/1/drive/1?type=fr HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
/api/user/:user_id/drive/:parent_id/add
Adds entity with <parent_id> as the parent. Returns a success status object
POST /api/user/1/drive/1/add?type=fr HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Content-Type: application/x-www-form-urlencoded
name=<entity_name>
/api/user/:user_id/drive/:id/move
Moves entity with id to a different folder having name=parent_name
POST /api/user/1/drive/5/move?type=fr HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Content-Type: application/x-www-form-urlencoded
parent_name=<name of new parent>
/api/user/:user_id/drive/:id/edit
Edit entity name by id. Returns a success status object.
PUT /api/user/1/drive/5/edit?type=fr HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Content-Type: application/x-www-form-urlencoded
new_name=<new_name>
/api/user/:user_id/drive/:id/remove
Remove entity by id.
DELETE /api/user/1/drive/2/remove?type=fl HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
There are 3 types of permissions, owner
, read
and write
. Read and Write are granted by owners to other users for certain entities.
/api/user/:user_id/drive/:id/check
Check read/write access to an entity for a user
GET /api/user/2/drive/1/check?type=fr HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
/api/user/:user_id/drive/shared
Fetch all the shared entities of the user
GET /api/user/1/drive/shared HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
/api/user/drive/:id>/grant
Grant access to a user to an entity
POST /api/user/drive/1/grant?type=fl HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
user_name=<username>&access=<access_level>
/api/user/:user_id/drive/:parent_id/upload
A file object comes in the request object as multipart form data and is uploaded to the server, according to the config specs.
/api/user/:user_id/notifications Poll for notifications of a user
GET /api/user/1/notifications HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Cache-Control: no-cache
/api/user/:user_name/notification/add
Save notification for actions for a user
POST /api/user/rand/notification/add HTTP/1.1
Host: 0.0.0.0:5000
token: <auth_token>
Content-Type: application/x-www-form-urlencoded
notif=<sample_notification_string>