Skip to content

Events Backend Functions

Julian Poyourow edited this page May 17, 2015 · 1 revision

Events:

GET '/events'

  • JSON/Variables: None.
  • Functionality/Return: Object containing a maximum of 200 public events sorted by event date.

GET '/events/user/:id'

  • JSON/Variables: Desired user ID URL parameter.
  • Functionality/Return: Public events where that user is the host, sorted by event date, and limited to 200.

POST '/events/me'

  • JSON/Variables: session_token.
  • Functionality/Return: All events by the current logged user, ordered by event date and limited to 200.

GET '/events/:id'

  • JSON/Variables: Desired event ID URL parameter, session_token.
  • Functionality/Return: Currently returns all data about a specified event ID regardless of invitation status. In future, will return an allotted amount of event data based on RSVP stage.

POST '/events'

  • JSON/Variables: session_token, int public (0,1), String name, String category, String description, DateTime start_time, DateTime end_time.
  • Functionality/Return: Adds a new event with the specified information. Returns the original submitted JSON in addition to the newly generated event id (for page redirection).

PUT '/events/:id'

  • JSON/Variables: Desired event ID URL parameter, session_token, int public, String name, String category, String description, DateTime start_time, DateTime end_time, make sure to pass all of these variables even if they will be the same.
  • Functionality/Return: Updates event with specified information. Returns updated event details.

DELETE '/events/:id'

  • JSON/Variables: Desired event ID URL parameter, session_token.
  • Functionality/Return: Deletes an event with the specified ID if the user is authenticated. Returns nothing.

POST '/events/rsvp/request'

  • JSON/Variables: session_token, int event_id.
  • Functionality/Return: Adds a request to be RSVPd to the specified event id. Returns original unmodified JSON.

POST '/events/rsvp/invite'

  • JSON/Variables: session_token, int event_id, int friend_id.
  • Functionality/Return: For a specified event (event_id) that you are the host of, this function adds an invitation RSVP for a specified user id (friend_id) to attend the event. Returns original unmodified JSON.

POST '/events/rsvp/accept'

  • JSON/Variables: session_token, int event_id.
  • Functionality/Return: As an event host, this function accepts a pending user RSVP to a specified event. Returns nothing.

POST '/events/rsvp/attend'

  • JSON/Variables: session_token, int event_id.
  • Functionality/Return: As an attendee, this function accepts an RSVP invitation sent by the event host corresponding to a specified event id.

POST '/events/rsvp/cancel'

  • JSON/Variables: session_token, int event_id, String/int attendee_id.
  • Functionality/Return: If attendee_id is an integer, you are presumed to be a host deleting an RSVP (at any status) by a specified user id attending your event. If attendee_id is a String equal to "me", you are presumed to be a user, deleting their RSVP (at any status) to a specified event.

POST '/events/rsvp/hosted'

  • JSON/Variables: session_token.
  • Functionality/Return: Gets all events with requested/invited/confirmed RSVP statuses for the current user. Will return data in the format: {current:{EVENTDATA},sent:{EVENTDATA},invited:{EVENTDATA}}. Whereas current contains confirmed events, sent contains events where the user has sent an unconfirmed request, and invited contains events where a host has invited the user.

POST '/events/rsvp'

  • JSON/Variables: session_token, event_id.
  • Functionality/Return: Returns attendees that have requested/invited/confirmed RSVPs
Clone this wiki locally