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
| Key | Value |
|---|---|
| Content-Type | application/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.
| Value | Type | Required | has Default | Default | Description |
|---|---|---|---|---|---|
| event_name | String | yes | no | - | Desired name of the event. |
| event_type | String | no | yes | PARTY | Type of the event. |
| event_public_status | String | no | yes | PUBLIC | Public status of the event (public, semipublic, or private). |
| event_description_short | String | no | no | - | Short event description. |
| event_description_long | String | no | no | - | Long event description. |
| event_startdatetime | DateTime | no | yes | timezone.now() | Start date and time of the event. |
| event_enddatetime | DateTime | no | yes | 6 hours from start | End date and time of the event. |
| event_age | Integer | no | yes | 18 | Minimum age requirement for the event. |
| event_image | String | no | no | - | URL of the event image. |
| event_longitude | String | yes | no | - | Longitude coordinates of the event location. |
| event_latitude | String | yes | no | - | Latitude coordinates of the event location. |
| event_location | Object | yes | no | - | Event location details (e.g., street name, postal code). |
| event_vibes | Array | no | no | - | Vibes associated with the event. |
| event_genres | Array | no | no | - | Genres associated with the event. |
| event_tags | Array | no | no | - | Tags related to the event. |
| event_faqs | Object | no | no | - | 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
| Parameter | Type | Description |
|---|---|---|
| event_id | UUID | Id of the event. |
| event_name | String | Name of the event. |
| event_type | String | Type of the event. |
| event_public_status | String | Public status of the event (public, semipublic, or private). |
| event_description_short | String | Short event description. |
| event_description_long | String | Long event description. |
| event_startdatetime | DateTime | Start date and time of the event. |
| event_enddatetime | DateTime | End date and time of the event. |
| event_rating | Integer | Event rating. |
| event_likecount | Integer | Number of likes for the event. |
| event_created | DateTime | Date and time when the event was created. |
| event_status | String | Event status (e.g., UPCOMING, RUNNING). |
| event_age | Integer | Minimum age requirement for the event. |
| event_image | String | URL of the event image. |
| event_longitude | String | Longitude coordinates of the event location. |
| event_latitude | String | Latitude coordinates of the event location. |
| event_nrattendees | Integer | Number of attendees at the event. |
| event_hasMedia | Boolean | Indicates if the event has media (true or false). |
| event_watched | Integer | Number of times the event has been watched. |
| event_story_thumb | String | URL of the event story thumbnail image. |
| event_location | Object | Event location details (e.g., street name, postal code). |
| event_mediaobjects | Object | Media objects related to the event. |
| event_vibes | Array | Vibes associated with the event. |
| event_genres | Array | Genres associated with the event. |
| event_tags | Array | Tags related to the event. |
| event_faqs | Object | Frequently Asked Questions (FAQs) about the event. |
| event_attendees | Object | Information about event attendees. |
| event_partner_logo | String | Partner logo url for the event (if applicable). |
| event_club_id | UUID | Club ID associated with the event (if applicable). |
| event_club_name | String | Club name associated with the event (if applicable). |
| event_att_rel_id | UUID | Event attendee relationship ID (if applicable). |
| event_user_status | String | User status for the event (e.g., NONE, OWNER). |
| event_isLiked | Boolean | Indicates if the event is liked by the user. |
| event_likedid | UUID | ID of the like relation (if applicable). |
| event_chat | Array | Chat related to the event |
| event_media | Array | List 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
| Parameter | Type | Description |
|---|---|---|
| detail | String | occurs 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.