CYTO is my Individual Project developed for assignment purposes. It is an application that can be accessed here:
This app has :
- RESTful endpoint for asset's CRUD operation
- JSON formatted response
Register new user
Request Header
not needed
URL Params
not needed
Data Params
not needed
Request Body
{
"username": "string",
"email": "string",
"password": "string",
}
Response (201 - Created)
{
"id": integer,
"username": "string"
}
Response (400 - Bad Request)
{
"message": "Email cannot be Empty!"
OR
"message": "Email should be written in email format!"
OR
"message": "Password cannot be Empty!"
OR
"message": "Minimum password length is 8"
}
User login
Request Header
not needed
URL Params
not needed
Data Params
not needed
Request Body
{
"email": "string",
"password": "string"
}
Response (200 - OK)
{
"access_token": "string"
}
Response (400 - Bad Request)
{
"message": "Error invalid email or password"
}
Response (401 - Unauthorized)
{
"message": "User not found or Password not matched"
}
User login via Google Account
Request Header
"g_token"
URL Params
not needed
Data Params
not needed
Request Body
{
"email": "string",
"username": "string",
"password": "string"
}
Response (200 - OK)
{
"access_token": "string"
}
Get All Recipes
Request Header
{"Authorization": "Bearer <access_token>"}
URL Params
not needed
Data Params
not needed
Request Body
not needed
Response (200 - OK)
[
{
"id": "string",
"name": "string",
"description": "string",
"prepareTime": "string",
"cookTime": "string",
"ingredients": [
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string"
],
"steps": [
"string",
"string",
"string",
"string",
"string",
"string",
"string",
],
"nutrients": {
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer
},
"image": "string"
},
...
]
Get One Recipe by Id
Request Header
{"Authorization": "Bearer <access_token>"}
URL Params
id: integer [required]
Data Params
not needed
Request Body
not needed
Response (200 - OK)
{
"id": "string",
"name": "string",
"description": "string",
"prepareTime": "string",
"cookTime": "string",
"ingredients": [
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string"
],
"steps": [
"string",
"string",
"string",
"string",
"string",
"string",
"string",
],
"nutrients": {
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer,
"string": integer
},
"image": "string"
}
Response (404 - Not Found)
{
"message": "Recipe not found"
}
Send Message to the CYTO team
Request Header
{"Authorization": "Bearer <access_token>"}
URL Params
not needed
Data Params
not needed
Request Body
{
"username":"string",
"email": "string",
"message": "string"
}
Response (200 - OK)
{
"message": "Your message sent successfully"
}
Response (400 - Bad Request)
{
"message": "Please fill the required form!"
}
Get all comments/posts
Request Header
{"Authorization": "Bearer <your access token>"}
URL Params
not needed
Data Params
not needed
Request Body
not needed
Response (200 - OK)
[
{
"imgUrl": "string",
"username": "string",
"description": "string",
"userId": integer
"createdAt": "date",
"updatedAt": "date"
},
...
]
Create new comment/post
Request Header
{"Authorization": "Bearer <your access token>"}
URL Params
not needed
Data Params
not needed
Request Body
{
"imgUrl": "string",
"username": "string",
"description": "string",
"userId": integer
}
Response (201 - Created)
{
"id": integer,
"username": "string",
"description": "string",
"userId": integer,
"createdAt": "date",
"updatedAt": "date"
}
Edit comment/post by id
Request Header
{"Authorization": "Bearer <your access token>"}
URL Params
id: integer [required]
Data Params
not needed
Request Body
{
"description": "string",
}
Response (201 - Created)
{
"id": integer,
"username": "string",
"description": "string",
"userId": integer,
"createdAt": "date",
"updatedAt": "date"
}
Response (404 - Not Found)
{
"message": "Comment not found"
}
Delete comment/post by id
Request Header
{"Authorization": "Bearer <your access token>"}
URL Params
id: integer [required]
Data Params
not needed
Request Body
not needed
Response (200 - OK)
{
"message": "Comment success to delete"
}
Response (404 - Not Found)
{
"message": "Comment not found"
}
Response (401 - Unauthorized)
{
"message": "Unauthenticated"
}
Response (403 - Forbidden)
{
"message": "You are not authorized"
}
Response (500 - Internal Server Error)
{
"message": "Internal Server Error"
}