Add Image
View Gallery
API Docs

Add New Image

Image Gallery

Click the "View Gallery" tab to load images

API Base URL

https://img-store-worker.floralc2ce.workers.dev
POST OPTIONS

Store a New Image

Save a new image URL to the store. Returns a unique ID for the image.

POST /

Request Body (JSON)

{
  "imgURL": "https://example.com/image.jpg"
}

Success Response (200)

{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "imgURL": "https://example.com/image.jpg"
}

Error Responses

Status Code Response Description
400 {"error": "imgURL is required"} Missing imgURL field in request body
400 {"error": "Invalid JSON or request failed"} Invalid JSON or parsing error

cURL Example

# Store a new image
curl -X POST "https://img-store-worker.floralc2ce.workers.dev/" \
  -H "Content-Type: application/json" \
  -d '{"imgURL": "https://example.com/image.jpg"}'
GET

Get All Images

Retrieve all stored images as a JSON array.

GET /all

Success Response (200)

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "imgURL": "https://example.com/image.jpg",
    "createdAt": 1678901234567
  },
  {
    "id": "660e8400-e29b-41d4-a716-446655440001",
    "imgURL": "https://example.com/photo.png",
    "createdAt": 1678901234678
  }
]

Empty Response

[]

cURL Example

# Get all stored images
curl "https://img-store-worker.floralc2ce.workers.dev/all"
DELETE

Delete All Images

Permanently delete all stored images.

DELETE /all

Success Response (200)

{
  "success": true,
  "message": "All entries deleted"
}

cURL Example

# Delete all images (use with caution!)
curl -X DELETE "https://img-store-worker.floralc2ce.workers.dev/all"
DELETE

Delete Single Image

Delete a specific image by its ID.

DELETE /id/{image_id}

Success Response (200)

{
  "success": true,
  "message": "Deleted 550e8400-e29b-41d4-a716-446655440000"
}

Error Response

400 {"error": "Missing id"} Image ID not provided in URL

cURL Example

# Delete a specific image
curl -X DELETE "https://img-store-worker.floralc2ce.workers.dev/id/550e8400-e29b-41d4-a716-446655440000"
GET

Redirect to Image

Access an image by ID and get redirected to the actual image URL.

GET /{image_id}

Response

Status Code Description
302 Redirects to the actual image URL
400 {"error": "Missing image id in URL"}
404 {"error": "Image not found"}

cURL Example

# Get image by ID (will redirect)
curl -L "https://img-store-worker.floralc2ce.workers.dev/550e8400-e29b-41d4-a716-446655440000"

# Follow redirects automatically with -L flag
OPTIONS

CORS Preflight

All endpoints support CORS preflight requests.

CORS Headers

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400

Example Code Snippet

// Example JavaScript fetch request
const response = await fetch('https://img-store-worker.floralc2ce.workers.dev/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    imgURL: 'https://example.com/image.jpg'
  })
});

const data = await response.json();
if (data.success) {
  console.log(`Image stored with ID: ${data.id}`);
}