Skip to main content

CreateEvent

Description

Creating an Event can be done using the POST operator one the user_events url endpoint. The event will be created from the provided json data and the user which sends the request is assumed as the owner. Therefore, user authorization for the request is strictly necessary.

Endpoint

POST https://api.thenights.app/event_manager/user_events

Request

Headers

KeyValue
Content-Typeapplication/json

Body

The POST request has none additonal parameters which are provided to the server.

Data send in POST request

The Data send to the endpoint is in json format. The table below shows the options availabe to specifiy an event. The example Data provides a minimal version of a possible event creation. Not every json Value is required in order for the event creation to be successful. Further information can be found in the table specifiying the json values and descriptions.

ValueTypeRequiredhas DefaultDefaultDescription
event_nameStringyesno-Desired name of the event.
event_typeStringnoyesPARTYType of the event.
event_public_statusStringnoyesPUBLICPublic status of the event (public, semipublic, or private).
event_description_shortStringnono-Short event description.
event_description_longStringnono-Long event description.
event_startdatetimeDateTimenoyestimezone.now()Start date and time of the event.
event_enddatetimeDateTimenoyes6 hours from startEnd date and time of the event.
event_ageIntegernoyes18Minimum age requirement for the event.
event_imageStringnono-URL of the event image.
event_longitudeStringyesno-Longitude coordinates of the event location.
event_latitudeStringyesno-Latitude coordinates of the event location.
event_locationObjectyesno-Event location details (e.g., street name, postal code).
event_vibesArraynono-Vibes associated with the event.
event_genresArraynono-Genres associated with the event.
event_tagsArraynono-Tags related to the event.
event_faqsObjectnono-Frequently Asked Questions (FAQs) about the event.

Example Post Body

{
"event_name": "TestCreationEvent",
"event_description_short" : "Some event to test creation",
"event_description_long" : "The long description of an event could be used to describe things similar to: first we are going to have a barbecue. Later, we will let the bass do its job.",
"event_longitude" : 51.454306,
"event_latitude" : 7.561158,
"event_location" : {
"event_street_name" : "Hollyword Blvd. 123",
"event_postal_name" : "Los Angeles",
"event_postal_code" : "123456",
"event_state_long" : "California",
"event_state_short" : "CA",
"event_country_long" : "United States",
"event_country_short" : "USA"
},
"event_genres" : [
"Hip-Hop",
"Pop",
"Techno"
],
"event_vibes" : [
"Sit in",
"sexy"
],
"event_tags": [
"crazy",
"amazing",
"cool beats"
]
}

Response

Within the response the json object of the created event will be returned. Server generated information such as event_id are now available to the application.

Success Response

Code: 200 OK

ParameterTypeDescription
event_idUUIDId of the event.
event_nameStringName of the event.
event_typeStringType of the event.
event_public_statusStringPublic status of the event (public, semipublic, or private).
event_description_shortStringShort event description.
event_description_longStringLong event description.
event_startdatetimeDateTimeStart date and time of the event.
event_enddatetimeDateTimeEnd date and time of the event.
event_ratingIntegerEvent rating.
event_likecountIntegerNumber of likes for the event.
event_createdDateTimeDate and time when the event was created.
event_statusStringEvent status (e.g., UPCOMING, RUNNING).
event_ageIntegerMinimum age requirement for the event.
event_imageStringURL of the event image.
event_longitudeStringLongitude coordinates of the event location.
event_latitudeStringLatitude coordinates of the event location.
event_nrattendeesIntegerNumber of attendees at the event.
event_hasMediaBooleanIndicates if the event has media (true or false).
event_watchedIntegerNumber of times the event has been watched.
event_story_thumbStringURL of the event story thumbnail image.
event_locationObjectEvent location details (e.g., street name, postal code).
event_mediaobjectsObjectMedia objects related to the event.
event_vibesArrayVibes associated with the event.
event_genresArrayGenres associated with the event.
event_tagsArrayTags related to the event.
event_faqsObjectFrequently Asked Questions (FAQs) about the event.
event_attendeesObjectInformation about event attendees.
event_partner_logoStringPartner logo url for the event (if applicable).
event_club_idUUIDClub ID associated with the event (if applicable).
event_club_nameStringClub name associated with the event (if applicable).
event_att_rel_idUUIDEvent attendee relationship ID (if applicable).
event_user_statusStringUser status for the event (e.g., NONE, OWNER).
event_isLikedBooleanIndicates if the event is liked by the user.
event_likedidUUIDID of the like relation (if applicable).
event_chatArrayChat related to the event
event_mediaArrayList of media corresponding to the event

Example Response Body

{
"event_id": "81eb76da-73c6-4828-8c71-d5924ed12278",
"event_name": "TestCreationEvent",
"event_type": "PARTY",
"event_public_status": "PUBLIC",
"event_description_short": "Some event to test creation",
"event_description_long": "The long description of an event could be used to describe things similar to: first we are going to have a barbecue. Later, we will let the bass do its job.",
"event_startdatetime": "2023-09-20T08:46:40.520450Z",
"event_enddatetime": "2023-09-20T14:46:40.515140Z",
"event_rating": 0,
"event_likecount": 0,
"event_created": "2023-09-20T08:46:40.520463Z",
"event_status": "UPCOMING",
"event_age": 18,
"event_image": "https://api.thenights.app/media/images/default/event10.jpg",
"event_longitude": "51.454306000000000000",
"event_latitude": "7.561158000000000000",
"event_nrattendees": 1,
"event_hasMedia": false,
"event_watched": 0,
"event_story_thumb": null,
"event_location": {
"event_street_name": "Hollyword Blvd. 123",
"event_postal_name": "Los Angeles",
"event_postal_code": "123456",
"event_state_long": "California",
"event_state_short": "CA",
"event_country_long": "United States",
"event_country_short": "USA"
},
"event_mediaobjects": {},
"event_vibes": [
"Sit in",
"sexy"
],
"event_genres": [
"Hip-Hop",
"Pop",
"Techno"
],
"event_tags": [
"crazy",
"amazing",
"cool beats"
],
"event_faqs": {},
"event_attendees": {
"56bffc52-a44d-400f-b6e7-db6388d036d8": {
"event_user_rel_id": "56bffc52-a44d-400f-b6e7-db6388d036d8",
"user_id": "ee6988e2-9c40-4cee-9e3c-a72cdfa08a4d",
"event_user_rel_type": "OWNER",
"event_user_rel_created": "2023-09-20T08:46:40.520017Z",
"event_user_rel_lastedit": "2023-09-20T08:46:40.520025Z",
"event_user_rel_profile": {
"profile_name": "JackSparrow",
"profile_firstname": "Johnny",
"profile_surname": "Depp",
"profile_phone": "+4956664288",
"profile_bio": null,
"profile_driplvl": null,
"profile_drip": 0.010958904109589041,
"profile_profileimage": "/media/profile_images/1d2f850e-a4d5-4e58-97e7-15ff80a14070.png",
"profile_userobj_id": "ee6988e2-9c40-4cee-9e3c-a72cdfa08a4d"
}
}
},
"event_partner_logo": null,
"event_club_id": null,
"event_club_name": null,
"event_att_rel_id": null,
"event_user_status": "NONE",
"event_isLiked": null,
"event_likedid": null,
"event_chat": null,
"event_media": null
}

Error Response

The error response should occure when either the values have incorect fomrat or required values are missing. Values which do not effect the event object are simply ignored.

Code: 400 Bad Request

ParameterTypeDescription
detailStringoccurs when provided json was incomplete. The detail string should provide which values are missing

Technical

The endpoint is used to create an event and write it into the database. The creation process initilizes the event in all 3 Databases. It creates an object with tracking data in elasticsearch and writes the full data object into the cassandra database. Furthermore, a minimal static object of the event is also created in Postgresql to allow for database (event - user relation) to be created and checked if necessary. Moreover, the data within Postgre is used to compute simple aggregations over time such as the user statistics. Additionally, to the standard event creation procedure. The event permission objects are created and linked to the already created event object. Due to the performance needed in fetching the permissions and status of a user at a particular event.The Elessandra combination is once again used. After finishing of the creation process the event is returned as a serial to the application. During the entire process the event is not cached.