# Canvas Creation Module API This repository contains the server-side code for the Canvas Creation Module API. The API provides endpoints for submitting and managing 3D and AI image tasks, as well as retrieving their statuses and previews. ## Table of Contents - [Installation](#installation) - [Endpoints](#endpoints) - [Submit 3D Image Task](#submit-3d-image-task) - [Submit AI Image Task](#submit-ai-image-task) - [Update 3D Image Task Status](#update-3d-image-task-status) - [Update AI Image Task Status](#update-ai-image-task-status) - [Get Latest 3D Image Status](#get-latest-3d-image-status) - [Get Latest AI Image Status](#get-latest-ai-image-status) - [Upload 3D Image Preview](#upload-3d-image-preview) - [Upload AI Image Preview](#upload-ai-image-preview) - [Get Latest 3D Image Task Preview](#get-latest-3d-image-task-preview) - [Get Latest AI Image Task Preview](#get-latest-ai-image-task-preview) - [Get 3D Image Task by ID](#get-3d-image-task-by-id) - [Get AI Image Task by ID](#get-ai-image-task-by-id) ## Installation ## Endpoints ### Submit 3D Image Task - **URL:** `/creation-module/3d-image/submit` - **Method:** `POST` - **Description:** Submits a new 3D image task. - **Request Body:** ```json { "user_id": "string", "project_id": "string", "scene_data": "object" } ``` - **Response:** ```json { "status": "success", "data": { "message": "Task successfully submitted", "job_id": "string" } } ``` ### Submit AI Image Task - **URL:** `/creation-module/ai-image/submit` - **Method:** `POST` - **Description:** Submits a new AI image task. - **Request Body:** ```json { "user_id": "string", "project_id": "string", "rendered_image_id": "string", "ai_scene_data": "object" } ``` - **Response:** ```json { "status": "success", "data": { "message": "Task successfully submitted", "job_id": "string" } } ``` ### Update 3D Image Task Status - **URL:** `/creation-module/3d-image/update-status` - **Method:** `POST` - **Description:** Updates the status of a 3D image task. - **Request Body:** ```json { "row_id": "string", "new_status": "integer" } ``` - **Response:** ```json { "status": "success", "data": { "row": "string", "status": "integer" } } ``` ### Update AI Image Task Status - **URL:** `/creation-module/ai-image/update-status` - **Method:** `POST` - **Description:** Updates the status of an AI image task. - **Request Body:** ```json { "row_id": "string", "new_status": "integer" } ``` - **Response:** ```json { "status": "success", "data": { "row": "string", "status": "integer" } } ``` ### Get Latest 3D Image Status - **URL:** `/creation-module/3d-image/status/:project_id` - **Method:** `GET` - **Description:** Retrieves the latest status of a 3D image task for a given project ID. - **Response:** ```json { "status": "success", "data": { "status": "integer" } } ``` ### Get Latest AI Image Status - **URL:** `/creation-module/ai-image/status/:project_id` - **Method:** `GET` - **Description:** Retrieves the latest status of an AI image task for a given project ID. - **Response:** ```json { "status": "success", "data": { "status": "integer" } } ``` ### Upload 3D Image Preview - **URL:** `/creation-module/3d-image/upload-preview` - **Method:** `POST` - **Description:** Uploads a preview image for a 3D image task. - **Request Body:** ```json { "row_id": "string", "image_base64": "string" } ``` - **Response:** ```json { "status": "success", "message": "Preview uploaded successfully" } ``` ### Upload AI Image Preview - **URL:** `/creation-module/ai-image/upload-preview` - **Method:** `POST` - **Description:** Uploads a preview image for an AI image task. - **Request Body:** ```json { "row_id": "string", "image_base64": "string" } ``` - **Response:** ```json { "status": "success", "message": "Preview uploaded successfully" } ``` ### Get Latest 3D Image Task Preview - **URL:** `/creation-module/3d-image/preview/:project_id` - **Method:** `GET` - **Description:** Retrieves the latest preview image for a 3D image task for a given project ID. - **Response:** ```json { "status": "success", "data": "string" } ``` ### Get Latest AI Image Task Preview - **URL:** `/creation-module/ai-image/preview/:project_id` - **Method:** `GET` - **Description:** Retrieves the latest preview image for an AI image task for a given project ID. - **Response:** ```json { "status": "success", "data": "string" } ``` ### Get 3D Image Task by ID - **URL:** `/creation-module/3d-image/:row_id` - **Method:** `GET` - **Description:** Retrieves a 3D image task by its row ID. - **Response:** ```json { "status": "success", "data": "object" } ``` ### Get AI Image Task by ID - **URL:** `/creation-module/ai-image/:row_id` - **Method:** `GET` - **Description:** Retrieves an AI image task by its row ID. - **Response:** ```json { "status": "success", "data": "object" } ``` ## License This project is licensed under the MIT License.