Techfesia2019

General notes

API for Techfesia.

API detail

User Auth

User Auth modes

curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001/auth_modes"
GET /users/test_user_001/auth_modes HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
Content-Typeapplication/json
{
    "password": true,
    "o-auth": [
        "google",
        "github",
        "facebook"
    ]
}

Create Password

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" -d '{
	"password":"Hello World"
}' "http://localhost:8000/users/test_user_001/password/"
POST /users/test_user_001/password/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token

{
	"password":"Hello World"
}
Status201 Created
{
    "message": "new password created"
}

Change Password

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" -d '{
	"oldPassword":"old_passord",
	"newPassword":"new_password"
}' "http://localhost:8000/users/test_user_001/password/"
PUT /users/test_user_001/password/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token

{
	"oldPassword":"old_passord",
	"newPassword":"new_password"
}

Reset Password

curl -X PATCH -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"resetToken":"sampled_reset_token",
	"newPassword":"password"
}' "http://localhost:8000/users/test_user_001/password/"
PATCH /users/test_user_001/password/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"resetToken":"sampled_reset_token",
	"newPassword":"password"
}
Status200 OK
{
    "message": "Password reset successfully"
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": {
        "resetToken": "token is invalid, expired or already used. Please get a new token"
    }
}

Users

Get Users (Staff only)

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/users?limit=10"
GET /users?limit=10 HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_staff_token
Status400 Bad Request
Content-Typeapplication/json
{
    "message": "This page does not exist",
    "pageSize": 10,
    "noOfPages": 5
}
Status200 OK
Content-Typeapplication/json
{
    "currentPage": 2,
    "noOfPages": 5,
    "users": [
        {
            "publicId": "sampleId1",
            "username": "test_user_001",
            "firstName": "Test",
            "lastName": "User",
            "email": "test_user_001@testers.techfesia.iiits.in",
            "phoneNumber": "+911234567890",
            "collegeName": "Test College 123",
            "profilePicture": "url_to_profile_pic",
            "dateJoined": "date_time_in_iso_format",
            "lastLogin": "date_time_in_iso_format"
        },
        {
            "publicId": "sampleId2",
            "username": "test_user_002",
            "firstName": "Test",
            "lastName": "User2",
            "email": "test_user_002@testers.techfesia.iiits.in",
            "phoneNumber": "+911234567890",
            "collegeName": "Test College 123",
            "profilePicture": "url_to_profile_pic",
            "dateJoined": "date_time_in_iso_format",
            "lastLogin": "date_time_in_iso_format"
        },
        {
            "publicId": "sampleId3",
            "username": "test_user_003",
            "firstName": "Test",
            "lastName": "User",
            "email": "test_user_003@testers.techfesia.iiits.in",
            "phoneNumber": "+911234567890",
            "collegeName": "Test College 123",
            "profilePicture": "url_to_profile_pic",
            "dateJoined": "date_time_in_iso_format",
            "lastLogin": "date_time_in_iso_format"
        }
    ]
}

Get User details

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001"
GET /users/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_token
Status200 OK
Content-Typeapplication/json
{
    "publicId": "sampleId123",
    "username": "test_user_001",
    "firstName": "Test",
    "lastName": "User",
    "email": "test_user_001@testers.techfesia.iiits.in",
    "phoneNumber": "+911234567890",
    "collegeName": "Test College 123",
    "profilePicture": "url_to_profile_pic",
    "dateJoined": "date_time_in_iso_format",
    "lastLogin": "date_time_in_iso_format"
}

Get User State (Staff Only)

curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/users/test_user_001/privileges"
GET /users/test_user_001/privileges HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token
Status200 OK
Content-Typeapplication/json
{
    "state": "normal"
}
Status200 OK
{
    "state": "staff",
    "privileges": {
        "model_name": [
            "array",
            "of",
            "privileges"
        ],
        "user": [
            "read"
        ],
        "event": [
            "read",
            "create",
            "update",
            "delete"
        ],
        "firebaseUser": []
    }
}
Status200 OK
Content-Typeapplication/json
{
    "state": "superuser"
}

Create New User

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"test_user_001",
	"firstName":"Test",
	"lastName":"User",
	"email":"test_user_001@testers.techfesia.iiits.in",
	"password":"Hello World",
	"phoneNumber":"+911234567890",
	"collegeName":"Test College 123",
	"profilePicture":"url_to_profile_pic"
}' "http://localhost:8000/users/"
POST /users/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"test_user_001",
	"firstName":"Test",
	"lastName":"User",
	"email":"test_user_001@testers.techfesia.iiits.in",
	"password":"Hello World",
	"phoneNumber":"+911234567890",
	"collegeName":"Test College 123",
	"profilePicture":"url_to_profile_pic"
}
Status201 Created
Content-Typeapplication/json
{
    "publicId": "sampleId123",
    "username": "test_user_001",
    "firstName": "Test",
    "lastName": "User",
    "email": "test_user_001@testers.techfesia.iiits.in",
    "phoneNumber": "+911234567890",
    "collegeName": "Test College 123",
    "profilePicture": "url_to_profile_pic",
    "dateJoined": "date_time_in_iso_format",
    "lastLogin": "date_time_in_iso_format"
}
Status400 Bad Request
Content-Typeapplication/json
{
    "errors": {
        "username": "missing required field"
    }
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "errors": {
        "username": "This username already exists"
    }
}

Update User Details

curl -X PUT -H "Content-Type: application/json" -H "accept: application/json" -H "Authorization: Bearer sample_token" -d '{
	"username":"test_user_001",
	"firstName":"Test",
	"lastName":"User",
	"email":"test_user_001@testers.techfesia.iiits.in",
	"phoneNumber":"+911234567890",
	"collegeName":"Test College 123",
	"profilePicture":"url_to_profile_pic"
}' "http://localhost:8000/users/test_user_001?="
PUT /users/test_user_001?= HTTP/1.1
Host: localhost:8000
Content-Type: application/json
accept: application/json
Authorization: Bearer sample_token

{
	"username":"test_user_001",
	"firstName":"Test",
	"lastName":"User",
	"email":"test_user_001@testers.techfesia.iiits.in",
	"phoneNumber":"+911234567890",
	"collegeName":"Test College 123",
	"profilePicture":"url_to_profile_pic"
}
Status200 OK
{
    "publicId": "sampleId123",
    "username": "test_user_001",
    "firstName": "Test",
    "lastName": "User",
    "email": "test_user_001@testers.techfesia.iiits.in",
    "phoneNumber": "+911234567890",
    "collegeName": "Test College 123",
    "profilePicture": "url_to_profile_pic"
}

Update profile picture (O-Auth)

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" -d '{
	"provider":"google"
}' "http://localhost:8000/users/test_user_001/picture"
PUT /users/test_user_001/picture HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token

{
	"provider":"google"
}
Status200 OK
{
    "message": "Profile Picture updated"
}

Disable User (Staff Only)

curl -X PUT -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/users/test_user_001/disable"
PUT /users/test_user_001/disable HTTP/1.1
Host: localhost:8000
Authorization: Bearer sample_staff_token

Delete User (Staff Only)

curl -X DELETE -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/users/test_user_001/"
DELETE /users/test_user_001/ HTTP/1.1
Host: localhost:8000
Authorization: Bearer sample_staff_token
Status200 OK

Update Profile Photo

curl -X PUT -H "Accept: application/json" -H "Content-Type: multipart/form-data" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001/pictureupload"
PUT /users/test_user_001/pictureupload HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: multipart/form-data
Authorization: Bearer sample_token
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Only image type data allowed"
}
Status202 Accepted
{
    "message": "Profile Picture Updated"
}

Authentication

User Token Pair Obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"test_user_001",
	"password":"Hello World"
}' "http://localhost:8000/auth/token/"
POST /auth/token/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"test_user_001",
	"password":"Hello World"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

User Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_token"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

Staff token pair obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"test_staff_user_001",
	"password":"Hello Staff Password"
}' "http://localhost:8000/auth/token/"
POST /auth/token/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"test_staff_user_001",
	"password":"Hello Staff Password"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

Staff Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_staff_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_staff_token"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

SuperUser Token Pair obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"sample_superuser_001",
	"password":"Hello Superuser Password"
}' "http://localhost:8000/auth/token/"
POST /auth/token/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"sample_superuser_001",
	"password":"Hello Superuser Password"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

SuperUser Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_superuser_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_superuser_token"
}
Status0
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

Revoke All Tokens (Sign Out from all devices)

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/auth/token/"
DELETE /auth/token/ HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
Content-Typeapplication/json
{
    "tokens_deleted": 5
}

Revoke one token (Signout from one device)

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" -d '{
	"token":"sample_token"
}' "http://localhost:8000/auth/token/"
PUT /auth/token/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token

{
	"token":"sample_token"
}
Status200 OK
Content-Typeapplication/json
{
    "tokens_deleted": 1
}

Category

Category: Every event is associated with a category. For Example: Hackathon, Workshop, Coding, Designing, Exhibition.

Get list of categories

curl -X GET -H "Accept: application/json" "http://localhost:8000/events/category"
GET /events/category HTTP/1.1
Host: localhost:8000
Accept: application/json
Status0
[
    {
        "name": "Hackathon",
        "description": "This events are contests to test your innovation and speed."
    },
    {
        "name": "Coding Event",
        "description": "Code, Code and code."
    }
]

Add a new Category

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"name": "Name of Category",
	"description": "Description about the Category (Optional)"
}' "http://localhost:8000/events/category"
POST /events/category HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"name": "Name of Category",
	"description": "Description about the Category (Optional)"
}
Status201 Created
{
    "name": "Hackathon",
    "description": "Contest for testing your problem solving skills."
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "This category already exist."
}

Edit a Category Description

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"description": "Update the description for this category."
}' "http://localhost:8000/events/tags/sample_category_name"
PUT /events/tags/sample_category_name HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"description": "Update the description for this category."
}
Status202 Accepted
{
    "name": "Hackathon",
    "description": "Very difficult to win prizes in it."
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Category does not exist."
}

Delete a Category

curl -X DELETE -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdHVkZW50SUQiOiJ0aGlzaWQiLCJzdHVkZW50RW1haWwiOiJyYW1kQGdtYWlsLmNvbSIsImlhdCI6MTU1NDM5NzYyMiwiZXhwIjoxNTU0NDA0ODIyfQ.bfmiEvKyoqP_y0R1yxYHXHWZIduYlyAKRJWHgQt-hM0" "http://localhost:8000/events/category/sample_category_name"
DELETE /events/category/sample_category_name HTTP/1.1
Host: localhost:8000
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdHVkZW50SUQiOiJ0aGlzaWQiLCJzdHVkZW50RW1haWwiOiJyYW1kQGdtYWlsLmNvbSIsImlhdCI6MTU1NDM5NzYyMiwiZXhwIjoxNTU0NDA0ODIyfQ.bfmiEvKyoqP_y0R1yxYHXHWZIduYlyAKRJWHgQt-hM0
Status204 No Content
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "This category does not exixt."
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Cant delete a category that is in use."
}

Tags

Tags: A small highlight about a event. For Example: Free, Difficult, Special. It is optional.

Get list of Tags

curl -X GET -H "Accept: application/json" "http://localhost:8000/events/tags"
GET /events/tags HTTP/1.1
Host: localhost:8000
Accept: application/json
Status0
[
    {
        "name": "Begineer",
        "description": "Good for begineers."
    },
    {
        "name": "Free",
        "description": "This event is free."
    }
]

Add a new Tag

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"name": "Name of Tag",
	"description": "Description about use of Tag (Optional)"
}' "http://localhost:8000/events/tags"
POST /events/tags HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"name": "Name of Tag",
	"description": "Description about use of Tag (Optional)"
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Tag already exist."
}
Status201 Created
{
    "name": "Begineer",
    "description": "Event is good for begineers."
}

Edit a tag description

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"description": "Update the description for this tag."
}' "http://localhost:8000/events/tags/sample_tags_name"
PUT /events/tags/sample_tags_name HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"description": "Update the description for this tag."
}
Status202 Accepted
{
    "name": "Begineer",
    "description": "Good for begineers but no prizes in this event."
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Tag does not exist."
}

Delete a Tag

curl -X DELETE -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/tags/sample_tags_name"
DELETE /events/tags/sample_tags_name HTTP/1.1
Host: localhost:8000
Authorization: Bearer sample_staff_token
Status204 No Content
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Cant delete a tag that is in use."
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "This tag does not exixt."
}

Events

Event Endpoints. Allow to create new Events, Delete them and update details.

Get list of events

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/events?limit&page&category&order&tags"
GET /events?limit&page&category&order&tags HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
{
    "events": [
        {
            "publicId": "1",
            "eventPicture": "some url",
            "eventLogo": "some url",
            "name": "Codechef Elektra",
            "description": "A 3 hour long competitive coding contest which tests your problem solving and coding skills.",
            "date": "2019-09-24",
            "time": "09:30",
            "venue": "Computer Lab",
            "category": [
                "Coding",
                "Contest"
            ],
            "tags": [
                "Prime Event",
                "Special Prizes"
            ]
        },
        {
            "publicId": "2",
            "name": "Reverse Coding",
            "description": "Find questions from answer by solving riddles.",
            "date": "2019-09-21",
            "time": "17:30",
            "venue": "Computer Lab",
            "category": [
                "Coding",
                "Hackathon"
            ],
            "tags": [
                "Begineer",
                "Special Prizes"
            ]
        }
    ]
}

Create a new Event

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
    "name": "Name of the Event",
    "description": "Event Description",
    "date": "YYYY-MM-DD",
    "time": "HH:MM",
    "venue": "Event Venue",
    "fees": "Participation Fee",
    "prize": ["First Prize", "Second Prize", "Prize for innovation"],
    "teamEvent": true,
    "minSize": 3,
    "maxSize": 8,
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Question with multiple Answers",
            "Answer"
        ],
        [
            "Put Question 2",
            "Put Answer here"
        ]
    ],
    "category": [
        "Defaults to Others",
        "Can be an array of valid categories"
    ],
    "tags": [
        "Optional",
        "Can be an array of valid tags"
    ]
}' "http://localhost:8000/events"
POST /events HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
    "name": "Name of the Event",
    "description": "Event Description",
    "date": "YYYY-MM-DD",
    "time": "HH:MM",
    "venue": "Event Venue",
    "fees": "Participation Fee",
    "prize": ["First Prize", "Second Prize", "Prize for innovation"],
    "teamEvent": true,
    "minSize": 3,
    "maxSize": 8,
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Question with multiple Answers",
            "Answer"
        ],
        [
            "Put Question 2",
            "Put Answer here"
        ]
    ],
    "category": [
        "Defaults to Others",
        "Can be an array of valid categories"
    ],
    "tags": [
        "Optional",
        "Can be an array of valid tags"
    ]
}
Status201 Created
{
    "name": "Codechef Elektra",
    "description": "A 3 hour long competitive coding contest which tests your problem solving and coding skills.",
    "date": "2019-09-24",
    "time": "09:30",
    "venue": "Computer Lab",
    "fees": "Rs 300",
    "prize": [
        "First Prize: 2000",
        "Second Prize: 1500",
        "Third Prize: 1000",
        "100 Ladoos to top 15 coders"
    ],
    "teamEvent": true,
    "minSize": 3,
    "maxSize": 8,
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Why laptop is required?",
            "To code"
        ],
        [
            "What are pre-requirements",
            "Have an Hackerrank ID"
        ]
    ],
    "category": [
        "Coding",
        "Contest"
    ],
    "tags": [
        "Prime Event",
        "Special Prizes"
    ]
}

Delete a Particular Event

curl -X DELETE -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/sample_event_id"
DELETE /events/sample_event_id HTTP/1.1
Host: localhost:8000
Authorization: Bearer sample_staff_token
Status200 OK

Get details for a particular event

curl -X GET -H "Accept: application/json" "http://localhost:8000/events/sample_event_id"
GET /events/sample_event_id HTTP/1.1
Host: localhost:8000
Accept: application/json
Status200 OK
{
    "publicId": "1",
    "name": "Codechef Elektra",
    "eventPicture": "some url",
    "eventLogo": "some url",
    "description": "A 3 hour long competitive coding contest which tests your problem solving and coding skills.",
    "date": "2019-09-24",
    "time": "09:30",
    "venue": "Computer Lab",
    "fees": 300,
    "prize": [
        "First Prize: 2000",
        "Second Prize: 1500",
        "Third Prize: 1000",
        "100 Ladoos to top 15 coders"
    ],
    "teamEvent": true,
    "teamEventProperties": {
        "minSize": 3,
        "maxSize": 8
    },
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Why laptop is required?",
            "To code"
        ],
        [
            "What are pre-requirements",
            "Have an Hackerrank ID"
        ]
    ],
    "category": [
        "Coding",
        "Contest"
    ],
    "tags": [
        "Prime Event",
        "Special Prizes"
    ]
}

Edit Event Details

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
    "name": "Name of the Event",
    "description": "Event Description",
    "date": "YYYY-MM-DD",
    "time": "HH:MM",
    "venue": "Event Venue",
    "fees": "Participation Fee",
    "prize": ["First Prize", "Second Prize", "Prize for innovation"],
    "teamEvent": true,
	"teamProperties":{
   		"minSize": 3,
    	"maxSize": 8
	},
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Question with multiple Answers",
            "Answer1"
        ],
        [
            "Put Question 2",
            "Put Answer here"
        ]
    ],
    "category": [
        "Defaults to Others",
        "Can be an array of valid categories"
    ],
    "tags": [
        "Optional",
        "Can be an array of valid tags"
    ]
}' "http://localhost:8000/events/sample_event_id"
PUT /events/sample_event_id HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
    "name": "Name of the Event",
    "description": "Event Description",
    "date": "YYYY-MM-DD",
    "time": "HH:MM",
    "venue": "Event Venue",
    "fees": "Participation Fee",
    "prize": ["First Prize", "Second Prize", "Prize for innovation"],
    "teamEvent": true,
	"teamProperties":{
   		"minSize": 3,
    	"maxSize": 8
	},
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Question with multiple Answers",
            "Answer1"
        ],
        [
            "Put Question 2",
            "Put Answer here"
        ]
    ],
    "category": [
        "Defaults to Others",
        "Can be an array of valid categories"
    ],
    "tags": [
        "Optional",
        "Can be an array of valid tags"
    ]
}
Status202 Accepted
{
    "eventid": "1",
    "name": "Elektra 4.0",
    "description": "Difficult Questions are waiting for you.",
    "date": "2019-09-24",
    "time": "09:30",
    "venue": "Computer Lab",
    "fees": "Rs 300",
    "prize": [
        "First Prize: 2000",
        "Second Prize: 1500",
        "Third Prize: 1000",
        "100 Ladoos to top 15 coders"
    ],
    "teamEvent": true,
    "minSize": 3,
    "maxSize": 8,
    "rules": [
        "Everyone should Participate",
        "Good Work etc etc"
    ],
    "faq": [
        [
            "Why laptop is required?",
            "To code"
        ],
        [
            "What are pre-requirements",
            "Have an Hackerrank ID"
        ]
    ],
    "category": [
        "Others"
    ],
    "tags": [
        "Prime Event",
        "Special Prizes"
    ]
}

Add/Edit photos for event

curl -X POST -H "Content-Type: multipart/form-data" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/sample_event_id/photo"
POST /events/sample_event_id/photo HTTP/1.1
Host: localhost:8000
Content-Type: multipart/form-data
Accept: application/json
Authorization: Bearer sample_staff_token
Status200 OK

Event Registration

Get User/Team Registration Details for a Event

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/sample_event_id/registrations"
GET /events/sample_event_id/registrations HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_staff_token
Status0
{
    "eventPublicId": "event Id",
    "eventType": "team",
    "registrations": [
        {
            "teamId": "abc",
            "status": "confirmed"
        },
        {
            "teamId": "def",
            "status": "payment pending"
        },
        {
            "teamId": "xyz",
            "status": "waiting"
        }
    ]
}
Status200 OK
{
    "eventPublicId": "event Id",
    "eventType": "single",
    "registrations": [
        {
            "registrationId": "some id",
            "userId": "abc",
            "status": "confirmed"
        },
        {
            "registrationId": "some id",
            "userId": "def",
            "status": "payment pending"
        },
        {
            "registrationId": "some id",
            "userId": "xyz",
            "status": "waiting"
        }
    ]
}

Register for an Event

curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_token" -d '{
	"teamId": "2"
}' "http://localhost:8000/events/sample_event_id/register/"
POST /events/sample_event_id/register/ HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_token

{
	"teamId": "2"
}
Status201 Created
{
    "message": "Successfully registered"
}
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "message": "Team already registered for event",
    "eventId": "1",
    "teamId": "2",
    "status": "registered"
}

Get registration details

curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/events/sample_event_id/registrations/sample_registration_id"
GET /events/sample_event_id/registrations/sample_registration_id HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
{
    "registrationId": "some id",
    "userId": "abc",
    "status": "confirmed"
}

Teams

Get List of Teams

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://{{hostname}}/teams?limit&page&event&user"
failed to parse url
parse http://{{hostname}}/teams?limit&page&event&user: invalid character "{" in host name
Status200 OK
{
    "pages": 5,
    "currentpage": 1,
    "result": [
        {
            "teamid": "2",
            "leader": "user",
            "members": [],
            "invitees": [],
            "events": [
                "1"
            ]
        },
        {
            "teamid": "4",
            "leader": "user_01",
            "members": [
                "23d",
                "user2",
                "user30"
            ],
            "invitees": [],
            "events": [
                "3",
                "4"
            ]
        }
    ]
}
Status200 OK
{
    "pages": 2,
    "currentpage": 1,
    "result": [
        {
            "teamid": "2",
            "leader": "user",
            "members": [],
            "invitees": [],
            "events": [
                "1"
            ]
        },
        {
            "teamid": "4",
            "leader": "user_01",
            "members": [
                "23d",
                "user2",
                "user30"
            ],
            "invitees": [],
            "events": [
                "1"
            ]
        }
    ]
}

Create a new Team

curl -X POST -H "Accept: application/json" -H "Authorization: Bearer sample_token" -H "Content-Type: application/json" -d '{
	"name":"The Gingers"
}' "http://localhost:8000/teams/"
POST /teams/ HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Content-Type: application/json

{
	"name":"The Gingers"
}
Status201 Created
{
    "teamid": "1",
    "name": "The Gingers",
    "leader": "test_user_001",
    "members": [],
    "events": [],
    "invitees": []
}

Delete a Team

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/teams/sample_team_id"
DELETE /teams/sample_team_id HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status204 No Content

Edit Team Details

curl -X PUT -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_token" -d '{
    "name": "The Flockers"
}' "http://localhost:8000/teams/sample_team_id"
PUT /teams/sample_team_id HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_token

{
    "name": "The Flockers"
}
Status200 OK
{
    "teamid": "1",
    "name": "The Flockers",
    "leader": "test_user_002",
    "members": [
        "username_01",
        "username_02"
    ],
    "event": [
        "1",
        "3"
    ],
    "invitees": []
}

Get Details of a Particular Team

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/teams/sample_team_id"
GET /teams/sample_team_id HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
{
    "teamid": "4",
    "leader": "user_01",
    "members": [
        "23d",
        "user2",
        "user30"
    ],
    "invitees": [],
    "events": [
        "1"
    ]
}

View Team Invitations

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001/invitation"
GET /users/test_user_001/invitation HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
[
    {
        "teamid": "1",
        "name": "The Rookies",
        "leader": "1",
        "status": "accepted"
    },
    {
        "teamid": "2",
        "name": "The Sweet",
        "leader": "2",
        "status": "rejected"
    },
    {
        "teamid": "4",
        "name": "The Three Musketeers",
        "leader": "2",
        "status": "pending"
    }
]

Accept Team Invitation

curl -X PUT -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001/invitation/sample_team_id/accept/"
PUT /users/test_user_001/invitation/sample_team_id/accept/ HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Already Accepted"
}
Status200 OK
{
    "status": "invitation accepted",
    "teamid": "1",
    "name": "The Rookies"
}

Reject Team Invitation

curl -X PUT -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001/invitation/sample_team_id/reject/"
PUT /users/test_user_001/invitation/sample_team_id/reject/ HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
{
    "status": "invitation rejectedd",
    "teamid": "1",
    "name": "The Rookies"
}

New Team Invitation

curl -X POST -H "Authorization: Bearer sample_token" -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username": "test_user_001"
}' "http://{{hostname}}/teams/sample_team_id/invitations"
failed to parse url
parse http://{{hostname}}/teams/sample_team_id/invitations: invalid character "{" in host name
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Not from same college/Already invited/Already a member/Wrong Username"
}
Status201 Created
{
    "teamid": "1",
    "name": "The Gingers",
    "leader": "User",
    "members": [
        "user_001",
        "user_002"
    ],
    "invitees": [
        "test_user_001",
        "test_user_003"
    ],
    "events": []
}

Delete Member

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/teams/sample_team_id/test_user_001"
DELETE /teams/sample_team_id/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status204 No Content

Delete Invitation

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/teams/sample_team_id/invitations/test_user_001"
DELETE /teams/sample_team_id/invitations/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status422 Unprocessable Entity (WebDAV) (RFC 4918)
{
    "error": "Does not exist/ Already Accepted"
}
Status204 No Content

Tickets

View all Tickets

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/ticket?limit&page&user&topic&status"
GET /ticket?limit&page&user&topic&status HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_staff_token
Status200 OK
{
    "pages": 2,
    "currentpage": 1,
    "result": [
        {
            "ticketid": "23",
            "title": "New Issue",
            "description": "Fix it Fast",
            "openedBy": "sample_user_id",
            "openingdate": "2019-12-1",
            "solution": {
                "status": "solved",
                "solvedBy": "user_233",
                "solvingDate": "2019-12-30",
                "content": "This is a simple issue. It is solved."
            }
        },
        {
            "ticketid": "34",
            "title": "Another Issue",
            "description": "Fix it Faster",
            "openedBy": "sample_user_id",
            "openingDate": "2019-11-29",
            "solution": {
                "status": "unsolved"
            }
        }
    ]
}

View Public Tickets

curl -X GET -H "Accept: application/json" "http://localhost:8000/ticket/public?limit&page&status=&topic"
GET /ticket/public?limit&page&status=&topic HTTP/1.1
Host: localhost:8000
Accept: application/json
Status200 OK
Acceptapplication/json

View User Ticket

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/ticket/test_user_001"
GET /ticket/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
{
    "pages": 2,
    "currentpage": 1,
    "result": [
        {
            "ticketid": "23",
            "title": "New Issue",
            "description": "Fix it Fast",
            "openedBy": "sample_user_id",
            "openingdate": "2019-12-1",
            "solution": {
                "status": "solved",
                "solvedBy": "user_233",
                "solvingDate": "2019-12-30",
                "content": "Solution"
            }
        }
    ]
}

Open a Tiicket

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_token" -d '{
    "title": "Another Issue",
    "description": "Fix it Faster",
    "view": "public or private"
}' "http://localhost:8000/ticket/"
POST /ticket/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_token

{
    "title": "Another Issue",
    "description": "Fix it Faster",
    "view": "public or private"
}
Status201 Created
{
    "ticketid": "34",
    "title": "New Issue",
    "description": "Fix it Fast",
    "openedBy": "sample_user_id",
    "openingDate": "2019-11-29",
    "solution": {
        "status": "unsolved"
    }
}

Close a Ticket

curl -X PUT -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -H "Content-Type: application/json" -d '{
    "content": "This is my solution"
}' "http://localhost:8000/ticket/sample_ticket_id/close"
PUT /ticket/sample_ticket_id/close HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_staff_token
Content-Type: application/json

{
    "content": "This is my solution"
}
Status200 OK
{
    "ticketid": "23",
    "title": "New Issue",
    "description": "Fix it Fast",
    "openedBy": "sample_user_id",
    "openingdate": "2019-12-1",
    "solution": {
        "status": "solved",
        "solvedBy": "user_233",
        "solvingDate": "2019-12-30",
        "content": "This is my solution"
    }
}

Organisers

Get organisers for a event

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/events/sample_event_id/organisers"
GET /events/sample_event_id/organisers HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
[
    {
        "username": "test_user_001",
        "role": "Lead Member"
    },
    {
        "username": "test_user_003",
        "role": "Member"
    },
    {
        "username": "test_user_002",
        "role": "Head"
    }
]

Add a new organiser

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"username": "user_001",
	"role": "role"
}' "http://localhost:8000/events/sample_event_id/organisers"
POST /events/sample_event_id/organisers HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"username": "user_001",
	"role": "role"
}
Status0
[
    {
        "username": "user",
        "role": "Member"
    },
    {
        "username": "user_001",
        "role": "Leader"
    },
    {
        "username": "user_002",
        "role": "Head of Comittee"
    },
    {
        "username": "user_004",
        "role": "Member"
    }
]

Delete a Organiser

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/sample_event_id/organisers/test_user_001"
DELETE /events/sample_event_id/organisers/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_staff_token
Status204 No Content

Volunteers

Get Volunteers for a event

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/events/sample_event_id/volunteers"
GET /events/sample_event_id/volunteers HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_token
Status200 OK
[
    {
        "username": "test_user_001",
        "task": [
            "Do this",
            "Do that"
        ]
    },
    {
        "username": "test_user_003",
        "task": [
            "Do this",
            "Do that"
        ]
    },
    {
        "username": "test_user_002",
        "task": [
            "Do this",
            "Do that"
        ]
    }
]

Add a new volunteers

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"username": "user_5",
	"task": ["Arrange Rooms", "Take Attendence"]
}' "http://localhost:8000/events/sample_event_id/volunteers"
POST /events/sample_event_id/volunteers HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"username": "user_5",
	"task": ["Arrange Rooms", "Take Attendence"]
}
Status0
[
    {
        "username": "test_user_001",
        "task": [
            "Do this",
            "Do that"
        ]
    },
    {
        "username": "test_user_003",
        "task": [
            "Do this",
            "Do that"
        ]
    },
    {
        "username": "test_user_002",
        "task": [
            "Do this",
            "Do that"
        ]
    },
    {
        "username": "user_5",
        "task": [
            "Arrange Rooms",
            "Take Attendence"
        ]
    }
]

Delete a Volunteer

curl -X DELETE -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/events/sample_event_id/volunteers/test_user_001"
DELETE /events/sample_event_id/volunteers/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Authorization: Bearer sample_staff_token
Status204 No Content

Change Tasks for Volunteer

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer sample_staff_token" -d '{
	"task": ["Task1", "Task2"]
}' "http://localhost:8000/events/sample_event_id/volunteers/test_user_001"
PUT /events/sample_event_id/volunteers/test_user_001 HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json
Authorization: Bearer sample_staff_token

{
	"task": ["Task1", "Task2"]
}
Status0
{
    "eventid": "2",
    "volunteer": "user_01",
    "task": [
        "task1",
        "task2"
    ]
}