Skip to main content

NEAR

Description

This API endpoint allows users to receive events near them. It fetches the events within an radius and returns the first 24 results to the user. It is mostly used when setting up the app and loading the events for the front page.

Endpoint

GET https://api.thenights.app/event_manager/user_events?request_type=NEAR&paginated=TRUE&longitude=18.990621&latitude=50.254416&dist=10

Request

Headers

KeyValue
Content-Typeapplication/json

Body

ParameterTypeRequiredDescription
request_typeStringyesSet which event endpoint is contactes should be NEAR.
longitudeFloatyescurrent longitude of the center point.
latitudeFloatyescurrent latitude of the center point.
distIntegeryesthe distance one wants to fetch. In this case radiues of the circle.
paginatedBooleannoShould the events be paginated. Not necessary.

Response

Response depends on the data currently within the data base that satisfies the set conditions.

Success Response

Code: 200 OK

ParameterTypeDescription
resultsListList of events NEAR the request location.
nextStringdirect url link used for pagination. Returns the next 32 events near the location.

Example Response Body

{
"results": [
{
"event_id": "945388d4-27f7-45ae-ac6b-b8592a74712b",
"event_name": "Techno City",
"event_type": "PARTY",
"event_public_status": "PUBLIC",
"event_description_short": "Dive into the pulsating beats and hypnotic sounds of techno at Techno City, an immersive festival experience featuring world-renowned DJs, immersive stage designs, and non-stop dancing.",
"event_startdatetime": "2023-09-07T15:22:58.322000Z",
"event_enddatetime": "2023-09-07T21:22:58.316000Z",
"event_rating": 0,
"event_likecount": 0,
"event_created": "2023-09-07T15:22:58.322000Z",
"event_status": "UPCOMING",
"event_age": 18,
"event_image": "https://api.thenights.app/media/images/default/event12.jpg",
"event_longitude": "19.005645218027310000",
"event_latitude": "50.254350840095650000",
"event_nrattendees": 1,
"event_hasMedia": false,
"event_story_thumb": null,
"event_location": {
"event_street_name": "3 Maja 18",
"event_postal_name": "Katowice",
"event_postal_code": "40-096",
"event_state_long": "MOCK State",
"event_state_short": "MOCK",
"event_country_long": "Poland",
"event_country_short": "PL"
},
"event_partner_logo": null,
"event_club_id": null,
"event_club_name": null,
"event_isLiked": false,
"event_likedid": null
},
{
"event_id": "7f816ece-0df7-4b37-b8bb-f171f88372d6",
"event_name": "Katowice Street Dance Festival",
"event_type": "PARTY",
"event_public_status": "PUBLIC",
"event_description_short": "Experience the electrifying energy of street dance at the Katowice Street Dance Festival, featuring dance battles, showcases, workshops, and performances by world-renowned dancers.",
"event_startdatetime": "2023-09-07T15:22:58.608000Z",
"event_enddatetime": "2023-09-07T21:22:58.603000Z",
"event_rating": 0,
"event_likecount": 0,
"event_created": "2023-09-07T15:22:58.608000Z",
"event_status": "UPCOMING",
"event_age": 18,
"event_image": "https://api.thenights.app/media/images/default/event10.jpg",
"event_longitude": "19.006247780348210000",
"event_latitude": "50.255664633792240000",
"event_nrattendees": 1,
"event_hasMedia": false,
"event_story_thumb": null,
"event_location": {
"event_street_name": "3 Maja 18",
"event_postal_name": "Katowice",
"event_postal_code": "40-096",
"event_state_long": "MOCK State",
"event_state_short": "MOCK",
"event_country_long": "Poland",
"event_country_short": "PL"
},
"event_partner_logo": null,
"event_club_id": null,
"event_club_name": null,
"event_isLiked": false,
"event_likedid": null
}
],
"next": null
}

Error Response

Code: 400 Bad Request

ParameterTypeDescription
detailStringoccurs when parameter are missing or an invalid request_type was provided

Technical

The endpoint process fetches the an initial data dictonary from elasticsearch as elasticsearch allows efficient geo spatial queries. The dictonary includes the event_id of the event near the location. For each event the entire object is loaded from the json cache. If an event has not yet been stored into the cache it will be retrieved from the database and stored into the json cache. Furthermore, endpoint returns weather the event has been liked by the user and its corresponding liked_id from cache. Other conditional fields are not included.