Authenticate existing user
Route (GET '/auth/')
Successful auth returns:
{ id, blogName, email, profilePictureUrl }
Unsuccessful auth returns:
{'message': 'No logged in user'}
status = 401
Route (POST '/auth/login')
Successful login returns:
{ id, blogName, email, profilePictureUrl }
Unsuccessful login returns:
{
'Email is required'
'Password is required'
'Email provided was not found',
'No such user exists',
'Password was incorrect',
'Password must be at least 8 characters long'
}
status = 401
Route (GET '/auth/logout')
Successful logout returns:
{'message': 'User logged out'}
Route (POST '/auth/signup')
Successful signup returns:
{ id, blogName, email, profilePictureUrl }
Unsuccessful signup returns:
{
'Email is required'
'Blog name is required'
'Password is required'
'Email address is already in use'
'Blog name is already in use'
'Password must be minimum 8 characters'
'Must be an image file with an allowed extension'
}
status = 400
Route (GET '/auth/unauthorized')
Returns:
{ 'errors': {'message': 'Unauthorized'} }
status = 401
Route (GET '/users/')
Successful return:
{
id1: { id1, blogName, email, profilePictureUrl },
id2: { id2, blogName, email, profilePictureUrl },
id3: { id3, blogName, email, profilePictureUrl },
...
}
Route (GET '/users/string:blog_name')
Successful return:
{ id, blogName, email, profilePictureUrl, postsByUser, reblogsByUser }
{ 'error': 'User was not found' }
status = 404
Route (GET '/posts/')
Successful return:
{
id1: { id, title, content, caption, userId, likes, tags, postType, previousPostId, createdAt, creator, creatorImage },
id2: { id, title, content, caption, userId, likes, tags, postType, previousPostId, createdAt, creator, creatorImage },
id3: { id, title, content, caption, userId, likes, tags, postType, previousPostId, createdAt, creator, creatorImage },
...
}
Route (POST '/posts/')
Successful return:
{ id, title, content, caption, userId, likes, tags, postType, previousPostId, createdAt, creator, creatorImage }
{
'Max title length is 255 characters'
'Tag can be a maximum of 1000 characters long'
'Post must be text, photo, video, or audio'
}
status = 400
Route (POST '/posts/file')
Successful return:
{
'File is required',
'File allowed {'pdf', 'gif', 'png', 'jpg', jpeg', 'webp', avif', 'mp4', 'mov', 'mp3'}'
}
status = 400
Route (POST '/posts/file/remove')
Successful return:
{ 'message': 'Successfully removed file' }
{ 'error': 'File was not able to be removed' }
status = 500
Route (PUT '/posts/int:id')
Successful return:
{ id, title, content, caption, userId, likes, tags, postType, previousPostId, createdAt, creator, creatorImage }
{
'Max title length is 255 characters'
'Tag can be a maximum of 1000 characters long'
'Post must be text, photo, video, or audio'
}
status = 400
Route (DELETE '/posts/int:id')
Successful return:
{ 'message': 'Successfully deleted' }
{ 'message': 'Post was not found' }
status = 404
Route (GET '/reblogs/')
Successful return:
{
id1: { id, userId, postId, commentContent, caption, tags, postType, rebloggedFrom, createdAt, reblogCreator, originalPost },
id2: { id, userId, postId, commentContent, caption, tags, postType, rebloggedFrom, createdAt, reblogCreator, originalPost },
id:3 { id, userId, postId, commentContent, caption, tags, postType, rebloggedFrom, createdAt, reblogCreator, originalPost },
...
}
Route (POST '/reblogs/')
Successful return:
{ id, userId, postId, commentContent, caption, tags, postType, rebloggedFrom, createdAt, reblogCreator, originalPost }
Route (DELETE '/reblogs/int:id')
Successful return:
{ 'message': 'Successfully deleted' }
{ 'message': 'Reblog was not found'}
status = 404