-
Notifications
You must be signed in to change notification settings - Fork 8
Practice App API Documentation
Bahrican Yesil edited this page May 20, 2022
·
10 revisions
- Endpoint: /user/signup
- Definition: Users will signup into the system with their email, password, and names.
- Query Parameters: None
- Body Data: email: string, password: string, name: string and all of them are required
- Example request body:
{
"email": "[email protected]",
"password": "bahrideneme123",
"name": "Bahrican Yesil"
}
- Example response body:
{
"resultMessage": "User is successfully signed up.",
"user": {
"email": "[email protected]",
"name": "Bahrican Yesil",
"createdAt": "2022-05-05T00:13:32.250Z",
"updatedAt": "2022-05-05T00:13:32.250Z",
"id": "627316ac45085c7197668fe9"
}
}
Postman Documentation *** Created By: Bahrican Yesil
- Endpoint: /user/login
- Definition: Users will login into the system with their email and password.
- Query Parameters: None
- Body Data: email: string, password: string. All of them are required
- Example request body:
{
"email": "[email protected]",
"password": "12345678"
}
- Example response body:
{
"resultMessage": "Successfully logged in.",
"user": {
"email": "[email protected]",
"name": "example",
"createdAt": "2022-05-17T18:47:14.458Z",
"updatedAt": "2022-05-17T18:47:14.458Z",
"id": "6283edb24da593a8186f5960"
}
}
- Endpoint: /user/enrolled/drop
- Definition: Users will drop lessons they want with their user ids and lesson ids.
- Query Parameters: None
- Body Data: user_id: ObjectId, lesson_id: ObjectId and all of them are required
- Example request body:
{
"user_id": "6280e289fed5174e18c40848",
"lesson_id": "62800034ba1d9c19fee948e3"
}
- Example response body:
"resultMessage": "Lesson is successfully dropped.",
"user": {
"email": "email1",
"name": "name1",
"enrolledLessons": [
"627fc0d6ba1d9c19fee948c3",
"627fc0f4ba1d9c19fee948c4"
],
"updatedAt": "2022-05-15T11:26:10.274Z",
"id": "6280e289fed5174e18c40848"
},
"lesson": {
"name": "lesson4",
"category_id": "62800034ba1d9c19fee948e3",
"id": "62800034ba1d9c19fee948e3"
}
- Endpoint: /user/enroll
- Definition: Users will enroll lessons they want with their user ids and lesson ids.
- Query Parameters: None
- Body Data: user_id: ObjectId, lesson_id: ObjectId and all of them are required
- Example request body:
{
"user_id": "62875e31bda2ad3f5a542a72",
"lesson_id": "6287b549fb9a4a0a6de05caf"
}
- Example response body:
{
"resultMessage": "Lesson is successfully dropped.",
"user": {
"attendedEvents": [],
"email": "[email protected]",
"name": "hasan",
"enrolledLessons": [
"6287b549fb9a4a0a6de05caf"
],
"createdAt": "2022-05-20T09:24:01.375Z",
"updatedAt": "2022-05-20T15:48:09.891Z",
"id": "62875e31bda2ad3f5a542a72"
},
"lesson": {
"name": "Lesson1",
"category_id": "62855d4acf6a0fb2ca9351d7",
"id": "6287b549fb9a4a0a6de05caf"
}
}
- Endpoint: /category
- Definition: Creates category
- Query Parameters: none
- Body Data: title is required
- Example request body:
http://localhost:3000/category/filter?title=mat
{ "title" : "sports" }
{
"resultMessage": "Category successfully created.",
"category": {
"title": "Calculus",
"description": "Calculus, originally called infinitesimal calculus or \"the calculus of infinitesimals\", is the mathematical study of continuous change, in the same way that geometry is the study of shape, and algebra is the study of generalizations of arithmetic operations.",
"lectures": [],
"_id": "6276a9260688f7bc8dafba22",
"__v": 0,
"id": "6276a9260688f7bc8dafba22"
}
}
- Endpoint: /category/filter
- Definition: Users can search categories by providing keyword.
- Query Parameters: filter is required
- Body Data: none
- Example request query:
http://localhost:3000/category/filter?title=mat
- Example response body:
{
"resultMessage": "Categories are successfully filtered by title.",
"categories": [
{
"id": "62855d5bcf6a0fb2ca9351da",
"title": "Mathematics",
"description": "Mathematics is an area of knowledge that includes the study of such topics as numbers, formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes. There is no general consensus about its exact scope or epistemological status.",
"lectures": []
}
]
}
- Endpoint: /event/createEvent
- Definition: Creates an event with parameters of: title : title of the event (required) description : description of the event (optional) date : date of the event, must be in format of MM-DD-YYY (required) location : location of the event, can be detailed or simple (required) host_id : id of the user, who is hosting the event (required) lesson_id : id of the lesson, which is related to the event (required) Given location is converted into a full address, using Google's Geocoding API. Then, an event is created with given properties. There might be five different types of return status codes can be encountered:
- 200: event is successfully created and is returned alongside the result message.
- 400: any required field in the request body is missing or invalid, an error message is returned.
- 404: trying to create event for a non-existing lesson (with invalid lesson_id), an error message is returned.
- 500: internal server error, an error message is returned.
- 503: there is a problem regarding to the Google API call, expired or invalid API key etc, an error message is returned. Note that all error messages and result message mentioned above are returned with "resultMessage" key in JSON object.
- Query Parameters: none
- Body Data: title: string, description: string, date: string, location: string, host_id: string, lesson_id: string
- Example request body:
{
"title": "Top of the Alps",
"description": "We will be testing the edges of our adrenaline levels and climb up to the top of Mont Blanc for our course Introduction to Mountaineering.",
"date": "10-22-2022",
"location": "Mont Blanc",
"host_id": "6283b4abb2bfe69a7025f2f6",
"lesson_id": "6283b6deb5a032a244f75018"
}
- Example response body:
{
"resultMessage": "Event successfully created.",
"event": {
"title": "Top of the Alps",
"date": "2022-10-21T21:00:00.000Z",
"location": "Mont Blanc",
"host_id": "6283b4abb2bfe69a7025f2f6",
"lesson_id": "6283b6deb5a032a244f75018",
"_id": "6283ded144aecdddaa0b0ff6",
"__v": 0
}
}
- Endpoint: /event/details
- Definition: Users can get the details of a specific event with the given event id.
- Query Parameters: event_id: ObjectId and it is required
- Body Data: None
- Example request query:
http://localhost:3000/event/details?event_id=6283cf8e75db501f6c0a7cc6
- Example response body:
{
"resultMessage": "Event is successfully fetched.",
"event": [
{
"_id": "6283cf8e75db501f6c0a7cc6",
"date": "2022-01-01T00:00:00.000Z",
"description": "sss",
"location": "sss",
"title": "sss",
"host_id": "62823a914cbe43107e565a58",
"lesson_id": "628239824cbe43107e565a4e"
}
]
}
- Endpoint: /user/attendedEvents
- Description: When given a parameter of a valid user_id, fetches all the events that the user with that user_id attends. A JSON object with two keys: resultMessage and events is returned upon request, where events is an array of JSON objects. Each element in the events array is a JSON object for events and has the structure:
{
"_id": "",
"title": "",
"date": "",
"location": "",
"host_id": "",
"lesson_id": "",
"__v": 0
}
- Query Parameters: user_id: string
- Body Data: None
- Example Request Query Parameter:
{
"user_id": "6283b4abb2bfe69a7025f2f8"
}
- Example Response Body:
{
"resultMessage": "Events are successfully fetched.",
"events": [
[
{
"_id": "6284e90a4677d5f44115e84f",
"title": "Top of the Alps",
"date": "2023-10-21T21:00:00.000Z",
"location": "Mont Blanc",
"host_id": "6283b4abb2bfe69a7025f2f6",
"lesson_id": "6283b6deb5a032a244f75018",
"__v": 0
}
],
[
{
"_id": "6285069d3a913991af6f0e9d",
"title": "Visiting the British Museum",
"date": "2022-12-11T21:00:00.000Z",
"location": "Great Russell St, London WC1B 3DG, UK",
"host_id": "6283b4abb2bfe69a7025f2f6",
"lesson_id": "6283b6deb5a032a244f75018",
"__v": 0
}
],
[
{
"_id": "628506c23a913991af6f0ea0",
"title": "Picnic & Gathering",
"date": "2022-07-20T21:00:00.000Z",
"location": "Bebek Yolu Sokağı, 34470 Sarıyer/İstanbul, Turkey",
"host_id": "6283b4abb2bfe69a7025f2f6",
"lesson_id": "6283b6deb5a032a244f75018",
"__v": 0
}
]
]
}
- Endpoint: /user/attend
- Definition: Users will attend events they want with their user ids and event ids.
- Query Parameters: None
- Body Data: user_id: ObjectId, event_id: ObjectId and all of them are required
- Example request body:
{
"user_id": "6283d4be1bccda81eb97e793",
"event_id": "6283cf8e75db501f6c0a7cc6"
}
- Example response body:
{
"resultMessage": "Event is successfully attended.",
"user": {
"email": "[email protected]",
"name": "John",
"enrolledLessons": [],
"attendedEvents": [
"6283cf8e75db501f6c0a7cc6"
],
"createdAt": "2022-05-17T17:00:46.738Z",
"updatedAt": "2022-05-17T17:12:16.389Z",
"id": "6283d4be1bccda81eb97e793"
},
"event": {
"_id": "6283cf8e75db501f6c0a7cc6",
"date": "2022-01-01T00:00:00.000Z",
"description": "",
"location": "",
"title": "",
"host_ID": "62823a914cbe43107e565a58",
"related_lesson": "628239824cbe43107e565a4e"
}
}
- Endpoint: /lesson/byCategory
- Definition: Fetches the lessons with the given category id.
- Query Parameters: category_id
- Body Data: none
- Example request query parameter:
{
"category_id": "6273bc3b3a3750aa3aa141af"
}
- Example response body:
{
"resultMessage": "Lessons are successfully fetched.",
"lessons": [
{
"name": "Basketball",
"category_id": "6273bc3b3a3750aa3aa141af",
"createdAt": "2022-05-05T11:59:56.001Z",
"updatedAt": "2022-05-05T11:59:56.001Z",
"id": "6273bc3c3a3750aa3aa141b1"
},
{
"name": "Football",
"category_id": "6273bc3b3a3750aa3aa141af",
"createdAt": "2022-05-05T11:59:56.026Z",
"updatedAt": "2022-05-05T11:59:56.026Z",
"id": "6273bc3c3a3750aa3aa141b3"
}
]
}
Postman Documentation *** Created By: Bahrican Yesil
- Endpoint: /lesson/events
- Definition: Returns all events of a specified lesson.
- Query Parameters: lesson_id: ObjectId
- Body Data: None
- Example request query:
/lesson/events/?lesson_id=628239074cbe43107e565a47'
- Example response body:
{
"resultMessage": "Events are successfully fetched.",
"events": [
{
"date": "2022-01-01T00:00:00.000Z",
"description": "",
"duration": 0,
"participation_limit": 100,
"host_ID": "62823b054cbe43107e565a59",
"geolocation_lat": 0,
"geolocation_lon": 0,
"participants": [],
"num_of_participants": 0,
"related_lesson": "628239074cbe43107e565a47",
"isCompleted": false,
"id": "62823dd34cbe43107e565a78"
}
]
}
- Endpoint: /lesson/byName
- Definition: Fetches the lessons with the given name.
- Query Parameters: name
- Body Data: none
- Example request query parameter:
{
"name": "cmpe352"
}
- Example response body:
{
"resultMessage": "Lessons are successfully fetched.",
"lessons": [
{
"name": "cmpe352",
"category_id": "6283c6c2990d3de17b0de51b",
"createdAt": "2022-05-17T15:33:58.719Z",
"updatedAt": "2022-05-17T15:33:58.719Z",
"id": "6283c066a91ea4cbd29f8ffa"
}
]
}
Group Members
Meeting Notes of 451
Mobile Team Meeting Notes
Back-End Team Meeting Notes
Front-End Team Meeting Notes
Meeting Notes of 352
- Meeting #1 (04.03.2022)
- Meeting #2 (10.03.2022)
- Meeting #3 (17.03.2022)
- Meeting #4 (24.03.2022)
- Meeting #5 (31.03.2022)
- Meeting #5.1 (02.04.2022)
- Meeting #5.2 (05.04.2022)
- Meeting #6 (07.04.2022)
- Meeting #6.1 (12.04.2022)
- Meeting #7 (14.04.2022)
- Meeting #8 (21.04.2022)
- Meeting #9 (01.05.2022)
- Meeting #10 (12.05.2022)
- Practice App Requirements
- Practice App Use Case Diagram
- Practice App Sequence Diagram
- Practice App API Documentation
CMPE451 Milestones
- Will be added when ready