SreemanthG / Meetings-API

Schedule Meetings with API. Built with Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Meetings API


MeetApi


Schedule Meetings with API. Built with Golang

Golang     MongoDB


Table of Contents


Introduction

This is a basic version of API managing and scheduling meetings. This is my task done for appointy internship using golang and mongodb.

Features

A few of the things you can do with MeetAPI:

  • Schedules Meetings
  • Lists all meetings within a time frame
  • Create non overlapping meetings
  • List all meetings of a participant
  • Thread Safe

Running Locally

Make sure you have Go and the Mongodb installed.

git clone https://github.com/SreemanthG/Meetings-API-Appointy.git
cd meetings-api-appointy
go get
go run main.go

RESTful URLs

Good URL examples

Bad URL examples


Requests and Responses

API Resources

POST /meetings

Example: http://localhost/meetings Note: start_Time, end_Time should be in UNIX format Request body(JSON):

  {
  
    "title": "My new Meeting",
    "participants": [
        {"name":"sreemanth1","email":"sreemanth1@gmail.com","rsvp":"yes"},
        {"name":"sreemanth2","email":"sreemanth2@gmail.com","rsvp":"yes"}
    ],
    "start_Time": 1603188000,
    "end_Time": 1603202400
  
  }

Response body:

Success:

  {
  "InsertedID":"5f8d36b26199472986f1a690"
  }

Failure:

  One of the participants with email sreemanth1@gmail.com timings are clashing

GET /meeting/[id]

Example: http://localhost/meeting/5f8d36b26199472986f1a690

Response body:

  {
    "_id": "5f8d36b26199472986f1a690",
    "title": "My new Meeting",
    "participants": [
        {
            "name": "sreemanth1",
            "email": "sreemanth1@gmail.com",
            "rsvp": "yes"
        },
        {
            "name": "sreemanth2",
            "email": "sreemanth2@gmail.com",
            "rsvp": "yes"
        }
    ],
    "start_Time": 1603188000,
    "end_Time": 1603202400,
    "creation_Timestamp": "2020-10-19T06:48:18.325Z"
  }

GET /meetings?start=[start time here]&end=[end time here]

Example: http://localhost/meetings?start=1602255600&end=1603202400

Response body:

    [
      {
          "_id": "5f8c81b85fe813d139bcb1bf",
          "title": "My new test Meeting",
          "participants": [
              {
                  "name": "sreemanth",
                  "email": "sreemanth@gmail.com",
                  "rsvp": "yes"
              },
              {
                  "name": "daksh",
                  "email": "daksh@gmail.com",
                  "rsvp": "no"
              },
              {
                  "name": "pranav",
                  "email": "pranav@gmail.com",
                  "rsvp": "maybe"
              }
          ],
          "start_Time": 1602255600,
          "end_Time": 1602273600,
          "creation_Timestamp": "2020-10-18T17:56:08.676Z"
      },
      {
          "_id": "5f8c88ed089352ae924e7c84",
          "title": "My new test2 Meeting",
          "participants": [
              {
                  "name": "daksh",
                  "email": "daksh@gmail.com",
                  "rsvp": "no"
              },
              {
                  "name": "pranav",
                  "email": "pranav@gmail.com",
                  "rsvp": "maybe"
              }
          ],
          "start_Time": 1602255600,
          "end_Time": 1602273600,
          "creation_Timestamp": "2020-10-18T18:26:53.235Z"
      },
      {
          "_id": "5f8ca61c67bd98c1c301d19b",
          "title": "My new test2 Meeting",
          "participants": [
              {
                  "name": "daksh",
                  "email": "daksh@gmail.com",
                  "rsvp": "yes"
              },
              {
                  "name": "pranav",
                  "email": "pranav@gmail.com",
                  "rsvp": "yes"
              }
          ],
          "start_Time": 1602255600,
          "end_Time": 1602273600,
          "creation_Timestamp": "2020-10-18T20:31:23.395Z"
      },
      {
          "_id": "5f8d36b26199472986f1a690",
          "title": "My new Meeting",
          "participants": [
              {
                  "name": "sreemanth1",
                  "email": "sreemanth1@gmail.com",
                  "rsvp": "yes"
              },
              {
                  "name": "sreemanth2",
                  "email": "sreemanth2@gmail.com",
                  "rsvp": "yes"
              }
          ],
          "start_Time": 1603188000,
          "end_Time": 1603202400,
          "creation_Timestamp": "2020-10-19T06:48:18.325Z"
      }
    ]

GET /meetings?participant=[email]

Example: http://localhost/meetings?participant=[email]

Response body:

    [
      {
          "_id": "5f8c81b85fe813d139bcb1bf",
          "title": "My new test Meeting",
          "participants": [
              {
                  "name": "sreemanth",
                  "email": "sreemanth@gmail.com",
                  "rsvp": "yes"
              },
              {
                  "name": "daksh",
                  "email": "daksh@gmail.com",
                  "rsvp": "no"
              },
              {
                  "name": "pranav",
                  "email": "pranav@gmail.com",
                  "rsvp": "maybe"
              }
          ],
          "start_Time": 1602255600,
          "end_Time": 1602273600,
          "creation_Timestamp": "2020-10-18T17:56:08.676Z"
      }
    ]    

GET /meetings?participant=[email]&offset=[]&offset=[offset]&limit=[limit]

Example: http://localhost/meetings?participant=[email]&limit=1&offset=0

Response body:

   [
      {
          "_id": "5f8c81b85fe813d139bcb1bf",
          "title": "My new test Meeting",
          "participants": [
              {
                  "name": "sreemanth",
                  "email": "sreemanth@gmail.com",
                  "rsvp": "yes"
              },
              {
                  "name": "daksh",
                  "email": "daksh@gmail.com",
                  "rsvp": "no"
              },
              {
                  "name": "pranav",
                  "email": "pranav@gmail.com",
                  "rsvp": "maybe"
              }
          ],
          "start_Time": 1602255600,
          "end_Time": 1602273600,
          "creation_Timestamp": "2020-10-18T17:56:08.676Z"
      }
  ]    

Database and Structure

Feedback

Feel free to send feedback on Twitter or file an issue. Feature requests are always welcome. You can contact me at sreemanth2001@gmail.com

About

Schedule Meetings with API. Built with Golang


Languages

Language:Go 100.0%