An API made for GDSC TIU website
https://gdcs-backend.herokuapp.com/
- User Authentication
- Session Managemenet
- Blogs
- Gallery
GET /api/accounts/
GET /api/accounts/memeber/
GET /api/accounts/student/
GET /api/accounts/admin/
GET /api/accounts/{uid}
parameter | Type | Description |
---|---|---|
uid |
string |
Required. uid of the user |
GET /api/accounts/currentuser/
POST /api/accounts/register/
data | Type | Description |
---|---|---|
name |
string |
Required |
email |
string |
Required |
password |
string |
Required |
gender |
string |
Required |
batch |
string |
Required |
stream |
string |
Required |
college_id |
number |
Required |
phone_number |
string |
Required |
linkedin_id |
string |
Optional |
github_id |
string |
Optional |
POST /api/accounts/login/
data | Type | Description |
---|---|---|
email |
string |
Required |
password |
string |
Required |
Endpoints are protected with Token Authentication. so you have to be a authorised user to get information from the database. There are two ways to do it.
1. Http Only Cookie ( Recomended ) : Whenever a user successfully log in, the uuid of the user will be autometically saved in a http only cookie. you have to just send the cookies with the request.
Like in Axios, use : withCredentials: true
import 'axios';
axios
.get(
'/cookie-auth-protected-route',
{ withCredentials: true } // this should be added
)
.then(res => res.data)
.catch(err => { /* not hit since no 401 */ })
2. Authorization Header : You can save the uuid of the logged in user
and pass the token in the header as Token
with the request. But as it is
not secure to save the Token in local storages or cookie, it is
not the recomended way.
import 'axios';
const token = '..your token..'
axios.get(url, {
//...data
}, {
headers: {
'Token': `${token}`
}
})
GET /api/blogs/get/all/
POST /api/blogs/post/
Field | Description | Is Required |
---|---|---|
caption | Blog Caption | Yes |
image | Image File for Cover | Yes |
description | Blog Short Description | Yes |
link | Valid URL for detailed blog (3rd party page) | Yes |
POST /api/gallery/post/
Field | Description | Is Required |
---|---|---|
thumbnail | Image File | Yes |
caption | Image Caption | Yes |
description | Long Text Description | Yes |
GET /api/gallery/get/