Instructions to consume API

    api origin

    Use this origin for the following requests:

    https://img-store-api.nika-nishnianidze.online

    upload image

    Description

    This endpoint is used to upload an image by providing image file and access type

    Request

    • Method: POST
    • Pathname: /image/upload
    • Content-Type: multipart/form-data
    • Body Parameters:
      • access: The type of access for the uploaded image public or private.
      • image: The image file to be uploaded.
    • Headers:
      • Authorization: Bearer token (API token)

    Response

    The response of this request is in JSON format with the following schema:

    • message: A message indicating the status of the upload.
    • image_name: The name of the uploaded image.

    delete image

    Description

    This endpoint is used to delete an image by providing the image name in the URL.

    Request

    • Method: DELETE
    • Pathname: /image/:name
    • Pathname Parameters:
      • name: The name of the image to be deleted.
    • Headers:
      • Authorization: Bearer token (API token)

    Response

    The response is in JSON format with the following schema:

    • Status: 200
    • Content-Type: application/json
    • message: A message indicating the status of the deletion.
    • deleted_image_name: The name of the image that was deleted.

    get all images

    Description

    This endpoint is used to retrieve information about all images.

    Request

    • Method: GET
    • Pathname: /image/all
    • Headers:
      • Authorization: Bearer token (API token)
    • Query Params:
      • access: public or private

    Response

    The response of this request is a JSON array containing objects with the following schema:

    • _id: The unique identifier of the image.
    • owner: The identifier of the user who owns the image.
    • name: The name of the image.
    • read_access: The access level of the image (private, public, etc.).
    • created_at: The timestamp indicating when the image was created.

    get image

    Description

    This endpoint is used to retrieve a specific image by its name. Images with access set to public can be accessed by anyone, while images with access set to private require a valid API token provided in the request headers as a Bearer token.

    Request

    • Method: GET
    • Pathname: /image/:name
    • Pathname Parameters:
      • name: The name of the image.
    • Headers?:
      • Authorization: Bearer token (API token)

    Response

    The response of this request is the binary image data, with the following additional headers:

    • Content-Type:
      • Examples: image/png image/jpeg image/gif etc

    change image access

    Description

    This endpoint is used to change the access level of an image by its name.

    Request

    • Method: PATCH
    • Pathname: /image/:name
    • Pathname Parameters:
      • name: The name of the image whose access level needs to be changed.
    • Body Parameters:
      • access: public or private
    • Headers:
      • Authorization: Bearer token (API token)

    Response

    The response of this request is in JSON format with the following schema:

    • message: A message indicating the status of the access change.
    • image_name: The name of the image whose access level was changed.
    • new_access: The new access level of the image.