Skip to content

Latest commit

 

History

History
119 lines (109 loc) · 2.8 KB

README.md

File metadata and controls

119 lines (109 loc) · 2.8 KB

IsroApp

Inter IIT Tech Meet ISRO Challenge IIT Kanpur backend repo

How to host

Installing Django and Django REST API Framework -

pip install Django
pip install djangorestframework

Hosting the server -

# make sure you are in this repository
python manage.py makemigrations
python manage.py migrate
python manage.py runserver

API endpoints

Fetch Data API

URL: /isro/getdata/
Method: GET
parameters: nothing

Successful: 200_OK
Unsuccessful: 404_NOT_FOUND

Response: [{'name','ra','dec','astrosat','dateobs','timeobs','srctype','prop_id',
          'obs_id','tgt_id','instrument','porb','flux','pubs':[{'id','title','link'}, ...]}, ...]

View Card API

URL: /isro/card/
Method: POST
parameters: {'ra','dec'} 

Successful: 200_OK
Unsuccessful: 404_NOT_FOUND

Response:{'name',
          'ra',
          'dec',
          'astrosat',
          'dateobs',
          'timeobs',
          'srctype',
          'prop_id',
          'obs_id',
          'tgt_id',
          'instrument',
          'porb',
          'flux',
          'pubs':[{'id','title','link'}, ...]
          }

Add Source API

URL: /isro/addSrc/
Method: POST
mandatory parameters: {'name',
             'ra',
             'dec',
             'astrosat',
             'dateobs',
             'timeobs',
             'srctype',
             'prop_id',
             'obs_id',
             'tgt_id',
             'instrument',
             'porb',
             'flux'
             }

Successful: 200_OK
Unsuccessful: If source with the same name already exists -> 406_NOT_ACCEPTABLE
              If wrong parameters -> 404_NOT_FOUND

No response field. Source is added to the database if operation is successful.

Add Publication API

URL: /isro/addPub/
Method: POST
parameters: {'title','link','sources'}

Successful: 200_OK
Unsuccessful: 404_NOT_FOUND

No response field. Publication is added to the database if operation is successful.