Skip to content

API Overview

Simon Gibson edited this page Sep 4, 2024 · 3 revisions

GoWebServer API Specification

Table of Contents

  1. Authentication
  2. User Account Management
  3. Scene Management
  4. Debug Routes

Authentication

All routes except for login and register require a valid JWT token in the Authorization header.

Format: Authorization: Bearer <token>

User Account Management

Login

Authenticates a user and returns a JWT token.

  • URL: /user/account/login
  • Method: POST
  • Request Body:
    {
      "username": "string",
      "password": "string"
    }
  • Success Response:
    • Code: 200
    • Content: { "jwtToken": "string" }

Register

Creates a new user account.

  • URL: /user/account/register
  • Method: POST
  • Request Body:
    {
      "username": "string",
      "password": "string"
    }
  • Success Response:
    • Code: 201
    • Content: { "success": true }

Update Username

Updates the username of the authenticated user.

  • URL: /user/account/update/username
  • Method: PATCH
  • Request Body:
    {
      "password": "string",
      "new_username": "string"
    }
  • Success Response:
    • Code: 200
    • Content: { "message": "Username updated" }

Update Password

Updates the password of the authenticated user.

  • URL: /user/account/update/password
  • Method: PATCH
  • Request Body:
    {
      "old_password": "string",
      "new_password": "string"
    }
  • Success Response:
    • Code: 200
    • Content: { "message": "Password updated" }

Delete User

Deletes the authenticated user's account.

  • URL: /user/account/delete
  • Method: DELETE
  • Request Body:
    {
      "password": "string"
    }
  • Success Response:
    • Code: 200
    • Content: { "message": "User deleted" }

Scene Management

Create New Scene

Uploads a new video and starts processing a new scene.

  • URL: /user/scene/new
  • Method: POST
  • Content-Type: multipart/form-data
  • Form Data:
    • file: The video file (required)
    • training_mode: "gaussian" or "tensorf" (required)
    • output_types: Comma-separated list of output types (required)
    • save_iterations: Comma-separated list of iterations to save (required)
    • total_iterations: Total number of iterations (required)
    • scene_name: Name of the scene (optional)
  • Success Response:
    • Code: 202
    • Content: { "id": "string", "message": "Video received and processing scene. Check back later for updates." }

Get Scene Metadata

Retrieves metadata about the resources available for a scene.

  • URL: /user/scene/metadata/:scene_id
  • Method: GET
  • URL Params:
    • scene_id: ID of the scene
  • Success Response:
    • Code: 200
    • Content: JSON object containing resource metadata
  • Example Response:
    • Code: 200
    • Content:
{
  "uuid": "5f9b2c1b3e7a8d1234567890",
  "status": 200,
  "error": 0,
  "message": "Scene metadata retrieved successfully",
  "resources": {
    "splat_cloud": {
      "1000": {
        "exists": true,
        "size": 1048576,
        "chunks": 1,
        "last_chunk_size": 1048576
      },
      "7000": {
        "exists": true,
        "size": 2097152,
        "chunks": 2,
        "last_chunk_size": 1048576
      },
      "30000": {
        "exists": false,
        "size": 0,
        "chunks": 0,
        "last_chunk_size": 0
      }
    },
    "video": {
      "1000": {
        "exists": true,
        "size": 5242880,
        "chunks": 5,
        "last_chunk_size": 1048576
      },
      "7000": {
        "exists": true,
        "size": 10485760,
        "chunks": 10,
        "last_chunk_size": 1048576
      },
      "30000": {
        "exists": false,
        "size": 0,
        "chunks": 0,
        "last_chunk_size": 0
      }
    }
  }
}

Get Scene Thumbnail

Retrieves the thumbnail image for a scene.

  • URL: /user/scene/thumbnail/:scene_id
  • Method: GET
  • URL Params:
    • scene_id: ID of the scene
  • Success Response:
    • Code: 200
    • Content: Thumbnail image data

Get Scene Name

Retrieves the name of a scene.

  • URL: /user/scene/name/:scene_id
  • Method: GET
  • URL Params:
    • scene_id: ID of the scene
  • Success Response:
    • Code: 200
    • Content: { "name": "string" }

Get Scene Progress

Retrieves the progress of scene processing.

  • URL: /user/scene/progress/:scene_id
  • Method: GET
  • URL Params:
    • scene_id: ID of the scene
  • Success Response:
    • Code: 200
    • Content: JSON object containing progress information
  • Example Response:
    • Code: 200
    • **Content:
{
  "uuid": "5f9b2c1b3e7a8d1234567890",
  "status": 200,
  "error": 0,
  "message": "Scene progress retrieved successfully",
  "processing": true,
  "overall_position": 3,
  "overall_size": 10,
  "stage": "nerf_list",
  "current_position": 1,
  "current_size": 5
}

Get Scene Output

Retrieves a specific output file for a scene.

  • URL: /user/scene/output/:output_type/:scene_id
  • Method: GET
  • URL Params:
    • output_type: Type of output (splat_cloud, point_cloud, video, or model)
    • scene_id: ID of the scene
  • Query Params:
    • iteration: Specific iteration to retrieve (optional)
  • Success Response:
    • Code: 200
    • Content: Output file data

Get User Scene History

Retrieves the list of scenes for the authenticated user.

  • URL: /user/scene/history
  • Method: GET
  • Success Response:
    • Code: 200
    • Content: { "resources": ["string"] }

Delete User Scene

Deletes a specific scene.

  • URL: /user/scene/delete/:scene_id
  • Method: DELETE
  • URL Params:
    • scene_id: ID of the scene to delete
  • Success Response:
    • Code: 200
    • Content: { "message": "Scene deleted" }

Debug Routes

Get Routes

Retrieves a list of all available routes.

  • URL: /routes
  • Method: GET
  • Success Response:
    • Code: 200
    • Content: JSON array of route information

Health Check

Checks the health status of the server.

  • URL: /health
  • Method: GET
  • Success Response:
    • Code: 200
    • Content: "OK"

Note: All authenticated routes require a valid JWT token in the Authorization header. Error responses are not detailed here but should include appropriate HTTP status codes and error messages.

Clone this wiki locally