Skip to main content
Wesog Search provides a comprehensive API for managing your image assets with full CRUD operations (Create, Read, Update, Delete). This guide covers the essential concepts and best practices for effective asset management.

Quick Start

Operations Overview

All operations support both single image and batch processing for efficient management of large image collections.
OperationEndpointRequired FieldsOptional FieldsPurpose
Upload new imagesPOST /imgsid, srcImage metadata fieldsAdd images to the system
Update existing imagesPUT /imgsidImage metadata fieldsModify existing metadata
Delete existing imagesDELETE /imgsidNoneRemove images from system
Each image must have a unique identifier (id). The src field should contain the publicly accessible URL of the image.

Key Concepts

Understanding these concepts will help you choose the right configuration for your use case:

Execution Modes

Synchronous (Default)

Best for: Small operations (< 10 uploads, < 50 updates, < 100 deletes)Behavior: Waits for completion before sending response

Asynchronous

Best for: Large batch operationsBehavior: Returns immediately with operation ID for tracking

Processing Modes

ModeBehaviorWhen to Use
Strict (default)Fails if ID conflicts occurProduction environments, data integrity critical
Relaxed (not implemented)Handles conflicts flexiblyBulk imports, development
Start with Strict + Synchronous for small operations, then switch to Strict + Asynchronous for larger batches.

Error Handling

StrategyDescriptionBest For
All or Nothing (default)Entire operation fails if any image failsCritical operations requiring consistency
Subset (not implemented)Processes valid images, reports failuresLarge-scale imports, fault tolerance needed

Operation Monitoring

For asynchronous operations, you can track progress using the operations endpoints:
EndpointPurposeResponse
GET /opsList all operationsArray of operation objects
GET /ops/{operation_id}Get specific operation statusSingle operation object with detailed status

Operation Status Indicators

StatusDescription
finished=false, success=nullProcessing - Operation is still running
finished=true, success=trueCompleted - All items processed successfully
finished=true, success=falseFailed - Operation aborted, check error details
If an operation fails (success=false), no database changes are made. Check the error message and retry with corrected data.

Advanced Configuration

Strict Mode Behavior

OperationStrict Mode BehaviorImpact
UploadError if id already existsPrevents accidental overwrites
UpdateError if id doesn’t existEnsures you’re modifying existing data
DeleteIgnores missing idSafe deletion of potentially removed items

Best Practices

For Development

  • Use synchronous mode for testing
  • Start with small batches
  • Validate data structure first

For Production

  • Use asynchronous for large operations
  • Monitor operation status
  • Implement retry logic for failures