Skip to content

Simple HTTP API for reading, listing, uploading and deleting files from a server.

Notifications You must be signed in to change notification settings

Testausserveri/file-storage-api

Repository files navigation

File Storage API

Simple HTTP API for reading, listing, uploading and deleting files from a server.

Getting Started

Docker Compose

First, create a file .apikeys with whitelisted random-generated API keys on each line.

Create a docker-compose.yml:

services:
  file-storage-api:
    image: ghcr.io/testausserveri/file-storage-api
    volumes:
      - ./.apikeys:/app/.apikeys
      - ./media:/app/uploads
    ports:
      - 8080:8080

Run:

$ docker compose up

API Documentation

Method Path Description Sample
GET / Return list of files 200 OK
{
    "files": [
        "7he9s-logo.jpg",
        "hsmpy-logo.jpg",
        "zb8ae-logo.jpg"
    ]
}
POST / Upload a file in file form-data key 200 OK
{
    "filename": "7he9s-logo.jpg"
}
GET /filename Get file 200 OK

The requested file

DELETE /filename Delete file 200 OK
{
    "filename": "7he9s-logo.jpg"
}

Authorization

All endpoints require an authorization. It is passed to the authorization header with an value ApiKey your-api-key.

Authorization: ApiKey your-api-key

Add your own API keys to .apikeys file, each on their own line.

Errors

Errors are responded with a non-200 status code and a JSON-object such as:

{
    "error": "reason"
}

About

Simple HTTP API for reading, listing, uploading and deleting files from a server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages