Skip to content

Latest commit

 

History

History
188 lines (140 loc) · 2.95 KB

api.md

File metadata and controls

188 lines (140 loc) · 2.95 KB

API Documentation

This document provides detailed information about the Back.Serv REST API endpoints.

Base URL

All API URLs are relative to: http://your-server:4093/

Authentication

Currently, the API uses a simple user_id system. Future versions may implement more robust authentication.

Endpoints

Submit Task

Submit a new task for processing.

POST /submit_task
Content-Type: application/json

{
    "task_type": string,
    "task_params": object,
    "user_id": string
}

Parameters

  • task_type (required): Type of task to execute
    • Possible values: "image_creation", "image_upscale", "face_swap", "video_creation"
  • task_params (required): Parameters specific to the task type
  • user_id (required): Identifier for the user submitting the task

Response

{
    "ticket_id": "string",
    "serv_name": "string",
    "status": "Queueing"
}

Example

curl -X POST http://localhost:4093/submit_task \
     -H "Content-Type: application/json" \
     -d '{
           "task_type": "image_creation",
           "task_params": {
             "prompt": "a beautiful sunset"
           },
           "user_id": "user123"
         }'

Query Task Status

Get the current status of a task.

GET /query_task/<ticket_id>

Parameters

  • ticket_id (required): The ID of the task to query

Response

{
    "status": "string",
    "result_info": "string",
    "error_info": "string",
    "started_at": "datetime",
    "completed_at": "datetime"
}

Example

curl http://localhost:4093/query_task/abc123

Cancel Task

Cancel a running or queued task.

POST /cancel_task/<ticket_id>

Parameters

  • ticket_id (required): The ID of the task to cancel

Response

{
    "status": "Cancelled",
    "message": "Task successfully cancelled"
}

Example

curl -X POST http://localhost:4093/cancel_task/abc123

Task Types and Parameters

Image Creation

{
    "task_type": "image_creation",
    "task_params": {
        "prompt": "string",
        "negative_prompt": "string",
        "width": integer,
        "height": integer
    }
}

Image Upscale

{
    "task_type": "image_upscale",
    "task_params": {
        "image_url": "string",
        "scale_factor": integer
    }
}

Face Swap

{
    "task_type": "face_swap",
    "task_params": {
        "source_image": "string",
        "target_image": "string"
    }
}

Video Creation

{
    "task_type": "video_creation",
    "task_params": {
        "prompt": "string",
        "duration": integer,
        "fps": integer
    }
}

Error Handling

The API uses standard HTTP response codes:

  • 200: Success
  • 202: Accepted (for task submission)
  • 400: Bad Request
  • 404: Not Found
  • 500: Internal Server Error

Error responses include a message explaining the error:

{
    "error": "string",
    "message": "string"
}