|
| 1 | +# API |
| 2 | + |
| 3 | +The API calls to PictoPy are done via HTTP requests since we are hosting our backend on a Flask server. This was done to ensure low coupling between the frontend and the backend. |
| 4 | +Follow this [Link](https://www.postman.com/cryosat-explorer-62744145/workspace/pictopy/overview) to get example request and response. |
| 5 | +## Table of Contents |
| 6 | +1. [Albums](#albums) |
| 7 | +2. [Image](#image) |
| 8 | +3. [Face Recognition and Tagging](#face-recognition-and-tagging) |
| 9 | + |
| 10 | +## Albums |
| 11 | + |
| 12 | +We briefly discuss the endpoints related to albums, all of these fall under the `/albums` route |
| 13 | + |
| 14 | +### Create Album |
| 15 | +- **Endpoint**: `POST /albums/create-album` |
| 16 | +- **Description**: Creates a new album with the given name and optional description. |
| 17 | +- **Request Format**: |
| 18 | + ```json |
| 19 | + { |
| 20 | + "name": "string", |
| 21 | + "description": "string" (optional) |
| 22 | + } |
| 23 | + ``` |
| 24 | +- **Response**: Message confirming album creation. |
| 25 | + |
| 26 | +### Delete Album |
| 27 | +- **Endpoint**: `DELETE /albums/delete-album` |
| 28 | +- **Description**: Deletes an existing album by name. |
| 29 | +- **Request Format**: |
| 30 | + ```json |
| 31 | + { |
| 32 | + "name": "string" |
| 33 | + } |
| 34 | + ``` |
| 35 | +- **Response**: Message confirming album deletion. |
| 36 | + |
| 37 | +### Add Multiple Images to Album |
| 38 | +- **Endpoint**: `POST /albums/add-multiple-to-album` |
| 39 | +- **Description**: Adds multiple images to an existing album. |
| 40 | +- **Request Format**: |
| 41 | + ```json |
| 42 | + { |
| 43 | + "album_name": "string", |
| 44 | + "paths": ["string", "string", ...] |
| 45 | + } |
| 46 | + ``` |
| 47 | +- **Response**: Message confirming images were added to the album. |
| 48 | + |
| 49 | +### Remove Image from Album |
| 50 | +- **Endpoint**: `DELETE /albums/remove-from-album` |
| 51 | +- **Description**: Removes a single image from an album. |
| 52 | +- **Request Format**: |
| 53 | + ```json |
| 54 | + { |
| 55 | + "album_name": "string", |
| 56 | + "path": "string" |
| 57 | + } |
| 58 | + ``` |
| 59 | +- **Response**: Message confirming image removal from the album. |
| 60 | + |
| 61 | +### View Album Photos |
| 62 | +- **Endpoint**: `GET /albums/view-album` |
| 63 | +- **Description**: Retrieves all photos in a specified album. |
| 64 | +- **Query Parameters**: `album_name` (string) |
| 65 | +- **Response**: JSON object containing album name and list of photos. |
| 66 | + |
| 67 | +### Edit Album Description |
| 68 | +- **Endpoint**: `PUT /albums/edit-album-description` |
| 69 | +- **Description**: Updates the description of an existing album. |
| 70 | +- **Request Format**: |
| 71 | + ```json |
| 72 | + { |
| 73 | + "name": "string", |
| 74 | + "description": "string" |
| 75 | + } |
| 76 | + ``` |
| 77 | +- **Response**: Message confirming album description update. |
| 78 | + |
| 79 | +### View All Albums |
| 80 | +- **Endpoint**: `GET /albums/view-all` |
| 81 | +- **Description**: Retrieves a list of all albums. |
| 82 | +- **Response**: JSON object containing a list of all albums. |
| 83 | + |
| 84 | +## Image |
| 85 | +We briefly discuss the endpoints related to images, all of these fall under the `/images` route |
| 86 | +### Get All Images |
| 87 | +- **Endpoint**: `GET /images/all-images` |
| 88 | +- **Description**: Retrieves a list of all image files in the system. |
| 89 | +- **Response**: JSON object containing a list of image file paths. |
| 90 | + |
| 91 | +### Add Multiple Images |
| 92 | +- **Endpoint**: `POST /images/images` |
| 93 | +- **Description**: Adds multiple images to the system and processes them in the background. |
| 94 | +- **Request Format**: |
| 95 | + ```json |
| 96 | + { |
| 97 | + "paths": ["string", "string", ...] |
| 98 | + } |
| 99 | + ``` |
| 100 | +- **Response**: Message indicating that images are being processed. |
| 101 | + |
| 102 | +### Delete Image |
| 103 | +- **Endpoint**: `DELETE /images/delete-image` |
| 104 | +- **Description**: Deletes a single image from the system. |
| 105 | +- **Request Format**: |
| 106 | + ```json |
| 107 | + { |
| 108 | + "path": "string" |
| 109 | + } |
| 110 | + ``` |
| 111 | +- **Response**: Message confirming image deletion. |
| 112 | + |
| 113 | +### Get All Image Objects |
| 114 | +- **Endpoint**: `GET /images/all-image-objects` |
| 115 | +- **Description**: Retrieves all images and their associated object classes. |
| 116 | +- **Response**: JSON object mapping image paths to their object classes. |
| 117 | + |
| 118 | +### Get Class IDs |
| 119 | +- **Endpoint**: `GET /images/class-ids` |
| 120 | +- **Description**: Retrieves the object classes for a specific image. |
| 121 | +- **Query Parameters**: `path` (string) - full path to the image |
| 122 | +- **Response**: JSON object containing the classes detected in the image. |
| 123 | + |
| 124 | +### Add Folder |
| 125 | +- **Endpoint**: `POST /images/add-folder` |
| 126 | +- **Description**: Adds all images from a specified folder to the system and processes them in the background. |
| 127 | +- **Request Format**: |
| 128 | + ```json |
| 129 | + { |
| 130 | + "folder_path": "string" |
| 131 | + } |
| 132 | + ``` |
| 133 | +- **Response**: Message indicating the number of images being processed from the folder. |
| 134 | + |
| 135 | +## Face Recognition and Tagging |
| 136 | +We briefly discuss the endpoints related to face tagging and recognition, all of these fall under the `/tag` route |
| 137 | +### Face Matching |
| 138 | +- **Endpoint**: `GET /tag/match` |
| 139 | +- **Description**: Finds similar faces across all images in the database. |
| 140 | +- **Response**: JSON object containing pairs of similar images and their similarity scores. |
| 141 | + |
| 142 | +### Face Clusters |
| 143 | +- **Endpoint**: `GET /tag/clusters` |
| 144 | +- **Description**: Retrieves clusters of similar faces across all images. |
| 145 | +- **Response**: JSON object containing clusters of images with similar faces. |
| 146 | + |
| 147 | +### Related Images |
| 148 | +- **Endpoint**: `GET /tag/related-images` |
| 149 | +- **Description**: Finds images with faces related to the face in the given image. |
| 150 | +- **Query Parameters**: `path` (string) - full path to the image |
| 151 | +- **Response**: JSON object containing a list of related image paths. |
0 commit comments