Skip to content

Create New Event

Fancy Foxx edited this page Nov 25, 2023 · 1 revision

Create a New Event

Create a new event with the provided details.

HTTP Request

URI: /event
Method: POST

Request Parameters

Body Parameters

Content Type: application/x-www-form-urlencoded

Name Type Description Required
summery String A short title or subject for the event.

<= 256 characters
Example: Field Day
!
description String A more complete description of the event.

<= 2048 characters
Example: An outing with friends at the park.
!
location String The intended venue for the event.

<= 256 characters
Example: The Park
!
organizer Integer<int64> ID number of Member putting together the event. !
allDay Boolean Whether the event is scheduled for full days without specific start or end times.

Example: false
!
dateTimeStart String<date-time> Date and time when the event is scheduled to commence. For all-day events, the time portion is set to 00:00:00.

Example: 2023-07-01 09:30:00
!
dateTimeEnd String<date-time> Date and time when the event is scheduled to conclude. For all-day events, the time portion is set to 00:00:00.

Example: 2023-07-01 14:30:00
!

Responses

Success

201: CREATED

Successfully created a new event.

Content Type: application/json

Schema
{
  status: Integer<int32>
  message: String
  data: {
    id: Integer<int64>
    summery: String
    description: String
    location: String
    organizer: Integer<int32>
    allDay: Boolean
    dateTimeStart: String<date-time>
    dateTimeEnd: String<date-time>
  }
}
JSON Response Example
{
  "status": 201
  "message": "Successfully created event",
  "data": {
    "id": 420,
    "summery": "Field Day",
    "description": "An outing with friends at the park.",
    "location": "The Park",
    "organizer": 69,
    "allDay": false,
    "dateTimeStart": "2023-07-01 09:30:00",
    "dateTimeEnd": "2023-07-01 14:30:00`"
  }
}

Failure

400: BAD REQUEST

Unable to create an event with the provided details.

Content Type: application/json

Schema
{
  status: Integer<int32>
  message: String
  data: {
    erroneousFields: [
      {
        name: String
        message: String
      }
    ]
  }
}
JSON Response Example
{
  "status": 400
  "message": "Failed to create event",
  "data": {
    "erroneousFields": [
      {
        "name": "description",
        "message": "Description too long."
      }, {
        "name": "startDate",
        "message": "Not a valid date-time string."
      }
    ]
  }
}
401: UNAUTHORIZED

Unauthorized attempt to create an event. Users must be authenticated, first.

Content Type: application/json

Schema
{
  status: Integer<int32>
  message: String
}
JSON Response Example
{
  "status": 401
  "message": "Unauthorized action. Please authenticate before trying again.",
}

Error

500: INTERNAL SERVER ERROR

A server error occurred creating the event.
* data object only returned in non-production environments.

Content Type: application/json

Schema
{
  status: Integer<int32>
  message: String
  data: [
    {
      name: String
      message: String
      cause: Error{}
    }
  ]
}
JSON Response Example
{
  "status": 500
  "message": "A server error occurred creating the event. Please try again.",
  "data": [
    {
      "name": "DatabaseConnectionError",
      "message": "Unable to connect to the database."
      "cause": {}
    }
  ]
}