Skip to content

WildCodeSchool/2209-wns-rivest-groupe3-images-service

Repository files navigation

Images-services API

Routes for an User

This routes allows you to perform CRUD operations on an user.

Upload an Avatar Image

Method: POST
Route: /upload/avatar
Description: Uploads a new avatar image for the user.
Headers: An authorization token is required to use this route.
Request Body: A file (newFile) containing the avatar image.

Read an Avatar Image

Method: GET
Route: /users/:userId/avatars/:filename
Description: Retrieves the specified avatar image for the user.
Path Parameters:

  • userId: The id of the user.
  • filename: The name of the file.

Update an Avatar Image

Method: PUT
Route: /update-avatar/:oldFilename
Description: Updates the specified avatar image for the user.
Headers: An authorization token is required to use this route.
Path Parameters:

  • oldFilename: The name of the file to be updated.

Request Body: A file (newFile) containing the new avatar image.

Delete an Avatar Image

Method: DELETE
Route: /delete/avatars/:filename
Description: Deletes the specified avatar image for the user.
Headers: An authorization token is required to use this route.
Path Parameters:

  • filename: The name of the file to be deleted.

Delete all files for a User

Method: DELETE
Route: /delete-user
Description: Deletes all images for the user. Headers: An authorization token is required to use this route.

Routes for a blog

This routes allows you to perform CRUD operations on a blog.

Upload a Blog Cover Image

Method: POST
Route: /upload/blog/:blogId/cover
Description: Uploads a new cover image for the blog.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.

Request Body: A file (newCoverImg) containing the cover image.

Read a Blog Cover Image

Method: GET
Route: /users/:userId/blogs/:blogId/covers/:filename
Description: Retrieves the specified cover image for the blog.
Path Parameters:

  • userId: The id of the user.
  • blogId: The id of the blog.
  • filename: The name of the file.

Update a Blog Cover Image

Method: PUT
Route: /update/blogs/:blogId/covers/:oldFilename
Description: Updates the specified cover image for the blog.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.
  • oldFilename: The name of the file to be updated.

Request Body: A file (newCoverImg) containing the new cover image.

Delete a Blog Cover Image

Method: DELETE
Route: /delete/blogs/:blogId/covers/:filename
Description: Deletes the specified cover image for the blog.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.
  • filename: The name of the file to be deleted.

DELETE "/delete-blog/:blogId"

Routes for an article

This routes allows you to perform CRUD operations on article images.

Upload an Article Image

Method: POST
Route: /upload/blog/:blogId/article/:articleId
Description: Uploads a new image for the article.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.
  • articleId: The id of the article.

Request Body: A file (newArticleImg) containing the article image.

Read an Article Image

Method: GET
Route: /users/:userId/blogs/:blogId/articles/:articleId/files/:filename
Description: Retrieves the specified image for the article.
Path Parameters:

  • userId: The id of the user.
  • blogId: The id of the blog.
  • articleId: The id of the article.
  • filename: The name of the file.

Update an Article Image

Method: PUT
Route: /update/blogs/:blogId/articles/:articleId/files/:oldFilename
Description: Updates the specified image for the article.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.
  • articleId: The id of the article.
  • oldFilename: The name of the file to be updated.

Request Body: A file (newArticleImg) containing the new article image.

Delete an Article Image

Method: DELETE
Route: /delete/blogs/:blogId/articles/:articleId/files/:filename
Description: Deletes the specified image for the article.
Headers: An authorization token is required to use this route.
Path Parameters:

  • blogId: The id of the blog.
  • articleId: The id of the article.
  • filename: The name of the file to be deleted.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •