Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (41 loc) · 1.17 KB

RESTAPI_contract.md

File metadata and controls

44 lines (41 loc) · 1.17 KB

#API Contract


###Getting all images Homepage startup triggers downloading all images from database.
Frontend makes following request
GET v1/images
The endpoint returns the following JSON
[{ id: "#", title: "#", content: base64, status: "#" },{},...]
The endpoint returns the following HTTP codes:

  • 200 (if request succeeded)
  • 500 (if failed)

###Adding an image User adds a new image
POST v1/images
The endpoint returns the following JSON
{id: UUID}
The endpoint returns the following HTTP codes:

  • 202 (if request accepted)
  • 500 (if failed)
  • 400 (if bad input)

###Getting an image User clicks on an image
GET v1/images/{id}
The endpoint returns the following JSON
[{ id: "#", title: "#", content: base64, description: {JSON from GCP}, status: "#" }]
The endpoint returns the following HTTP codes:

  • 200 (if processing is done)
  • 202 (if processing is in progress)
  • 500 (if failed)

###Updating an image Image details in database are being updated with values (e.g. recognized labels on photo) returned from GCP
PUT v1/images/{id}
The endpoint returns the following HTTP codes:

  • 200 (if processing is done)
  • 404 (if record does not exist)
  • 500 (if failed)