Skip to content

πŸ“‘ REST API to fetch data from Amizone using puppeteer

License

Notifications You must be signed in to change notification settings

PawanKolhe/amizone-fetch-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Amizone Fetch

REST API to fetch data from Amizone using puppeteer

Table of Contents

πŸ“‘ Endpoint

Live endpoint : https://amizone-fetch.herokuapp.com

or

You can deploy your own instance on Heroku:

Deploy

🧰 Tech Used

βš™οΈ Environment Setup

Install dependencies

npm install

Run locally

npm run dev

πŸ“œ API Docs

Getting Started

  • Use POST request method for all requests.
  • Pass the following JSON body for all requests:
{
    "username": "<YOUR-AMIZONE-USERNAME>",
    "password": "<YOUR-AMIZONE-PASSWORD>"
}

These Amizone login credentials are required for authentication while fetching data.

Resources

/courses

Get all courses

Response

[
    {
        "code": "IFTXXXX",
        "name": "Android Programming",
        "type": "Compulsory",
        "attendance": {
            "attended": 17,
            "total": 17,
            "unattended": 0,
            "percent": 100
        }
    },
    ...
]

/credentials

Get all credentials available on the amizone home page

Response

{
    "amityEmail": {
        "id": "",
        "password": ""
    },
    "msTeams": {
        "id": "",
        "password": ""
    },
    "opac": {
        "id": "",
        "password": ""
    },
    "formNumber": ""
}

/faculty

Get faculty info

Response

[
    {
        "subjectShort": "[Android Progr]  [IFTXXXX]",
        "subject": " Android Programming [Android Progr]  [IFTXXXX] ",
        "facultyPhoto": "https://...",
        "name": "Dr Someone"
    },
    ...
]

/grades

Get grades info

Response

[
    {
        "semester": "1",
        "sgpa": "9.36",
        "cgpa": "",
        "backPapers": "0"
    },
    {
        "semester": "2",
        "sgpa": "9.44",
        "cgpa": "9.40",
        "backPapers": "0"
    },
    ...
]

/photo

Get photo link

Response

{
    "photoUrl": "https://..."
}

/reginfo

Get registration info

Response

{
    "semester": "5",
    "photo": "https://...",
    "enrollmentno": "A...",
    "name": "John Doe",
    "program": "B.Sc. Comp. Sci.",
    "batch": "2018-2021",
    "dob": "",
    "email": "",
    "contactaddress": "",
    "contactpincode": "",
    "contactphone": "",
    "contactmobile": "",
    "fax": "",
    "fathername": "",
    "permanentaddress": "",
    "permanentpincode": "",
    "permanentphone": "",
    "permanentfax": "",
    "hostel": "",
    "homeaddress": "",
    "homecity": "",
    "homepincode": "",
    "hometelephone": "",
    "homemobile": "",
    "homeemail": ""
}

/schedule/today

Get today's schedule

Response

[
    {
        "courseTitle": "ASP.NET with C# Programming",
        "courseCode": "IFTXXXX",
        "facultyName": "Mr Someone",
        "start": "9/15/2020 9:10:00 AM",
        "end": "9/15/2020 10:00:00 AM",
        "roomNumber": "320",
        "attendanceColor": "#3a87ad",
        "allDay": false
    },
    ...
]

/schedule/week

Get weekly schedule (Sunday to Saturday)

Response

{
    "Monday": [
        {
            "fromTime": "09:10",
            "toTime": "10:00",
            "courseCode": "IFTXXXX",
            "courseTeacher": "Mr Someone",
            "classLocation": "120"
        },
        ...
    ],
    "Tuesday": [
        {
            "fromTime": "09:10",
            "toTime": "10:00",
            "courseCode": "IFTXXXX",
            "courseTeacher": "Ms Someone",
            "classLocation": "230" 
        }
        ...
    ],
    ...
}

Error Response

HTTP Code: 408

{
    "error": "Request Timeout"
}

❔ How to use

JavaScript

You can use the browser's Fetch API

const endpoint = 'https://amizone-fetch.herokuapp.com';

fetch(`${endpoint}/courses`, {
    method: 'POST',
    body: JSON.stringify({
        'username': '<YOUR-AMIZONE-USERNAME>',
        'password': '<YOUR-AMIZONE-PASSWORD>'
    }),
    headers: {
        'Content-Type': 'application/json'
    }
})
.then(response => response.json())
.then(data => {
    console.log(data);
});

or you can choose to use the axios library

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
axios.post(`/courses`, {
    'username': '<YOUR-AMIZONE-USERNAME>',
    'password': '<YOUR-AMIZONE-PASSWORD>'
  },{
    baseURL: 'https://amizone-fetch.herokuapp.com'
  })
  .then(function (response) {
    console.log(response.data);
  });

Python

Install requests library

pip install requests

Make request

import requests
response = requests.post("https://amizone-fetch.herokuapp.com/courses", data = {
    'username': '<YOUR-AMIZONE-USERNAME>',
    'password': '<YOUR-AMIZONE-PASSWORD>'
})
print(response.json())

πŸ“œ License

This software is open source, licensed under the MIT License.

About

πŸ“‘ REST API to fetch data from Amizone using puppeteer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published