Skip to content

Middleware Technologies for Distributed Systems - Backend API's for REST API project

Notifications You must be signed in to change notification settings

limone-eth/mw-images-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Docs

❗ Important to know

  • 🚫 means that the endpoint is authenticated, this means that the user needs to include the Bearer token in the header field "Authorization"

  • 👮 means that the endpoint relates only to objects belonging to the user (e.g., you cannot download images that does not belong to you)

Auth

Signup

Endpoint: POST /auth/signup

Body:

{
  "first_name": "string",
  "last_name": "string",
  "email": "string (email format)",
  "password": "string (min 8 chars)"
}

Response: users_id and token to authorize subsequent HTTP calls

{
  "authentication": {
    "token": "string"
  },
  "user": {
    "id": "integer"
  }
}

Login

Endpoint: POST /auth/login

Body:

{
  "email": "string",
  "password": "string"
}

Response: users_id and token to authorize subsequent HTTP calls

{
  "authentication": {
    "token": "string"
  },
  "user": {
    "id": "integer"
  }
}

Logout 🚫

Endpoint: POST /auth/logout

Users

Retrieve User Profile 🚫 👮

Endpoint: GET /users

Response: a list of users objects with their images

[
  {
    "id": "integer",
    "first_name": "string",
    "last_name": "string",
    "email": "string",
    "images": [
      {
        "id": "integer",
        "key": "string",
        "title": "string"
      }, 
      {
        "...": "..."
      }
    ]
  }
]

Retrieve Users List 🚫

Endpoint: GET /users/:id

Response: user object including the list of images belonging to him

{
  "id": "integer",
  "first_name": "string",
  "last_name": "string",
  "email": "string"
}

Images

Upload Image 🚫

Endpoint: POST /images

Body:

{
  "title": "string",
  "image_base64": "string (base64)"
}

Response: array of images belonging to the user

[
  {
    "id": "integer",
    "key": "string",
    "title": "string"
  }, 
  {
    "...": "..."
  }
]

Retrieve Images List 🚫 👮

Endpoint: GET /images

Body:

{
  "title": "string",
  "image_base64": "string (base64)"
}

Response: array of images belonging to the user

[
  {
    "id": "integer",
    "key": "string",
    "title": "string"
  }, 
  {
    "...": "..."
  }
]

Update Image 🚫 👮

Endpoint: PUT /images/:id

Body:

{
  "title": "string",
}

Response: array of images belonging to the user (including the updated one)

[
  {
    "id": "integer",
    "key": "string",
    "title": "string"
  }, 
  {
    "...": "..."
  }
]

Delete Image 🚫 👮

Endpoint: DELETE /images/:id

Response: array of images belonging to the user (not including the deleted one)

[
  {
    "id": "integer",
    "key": "string",
    "title": "string"
  }, 
  {
    "...": "..."
  }
]

Download Image 🚫 👮

Endpoint: GET /images/:id

Response: download the requested image

About

Middleware Technologies for Distributed Systems - Backend API's for REST API project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published