Skip to content

Store images on remote machine using HTTP requests.

License

Notifications You must be signed in to change notification settings

ebsouza/ImageStorage

Repository files navigation

Image Storage

Store images on ImageStorage server using HTTP requests.

Figure 1 - Image Storage architecture

1. Starting Image Storage

First of all install alembic on your local or virtual environment.

Set properly all parameters on settings.toml and start containers.

docker-compose up

Invoke alembic migration tool to development or production environment.

make run_migration_development

1.1 Testing

Invoke alembic migration tool to test environment.

make run_migration_test

Run tests on api container.

docker exec -it <api-container> bash -c "python -m pytest --cov=src/image tests/"

2. API Reference

2.1. Create image

POST /v1/images
# Post
data=$(base64 "image.jpg")
echo '{"data": "'$data'"}' > payload.json
curl -s -X POST http://localhost:5000/v1/images/ -d @payload.json -H 'Content-Type: application/json'
// Return
{ 
    "id": <image_id>,
    "path": <image_path>
}

2.2. Get one image

GET /v1/images/<image_id>
# Get
curl http://localhost:5000/v1/images/<image_id>
// Return
{ 
  "id": <image_id>,
  "path": <image_path>
}

2.3. Get many images

GET /v1/images?offset=10&limit=10
# Get
curl http://localhost:5000/v1/images
// Return
{ 
  "kind": "Collection",
  "next": "<host_url>/images?offset=10&limit=5",
  "previous": "<host_url>/images?offset=5&limit=5",
  "data": [
              {
                  "id": <image_id>,
                  "path": <image_path>
              },
              {
                  "id": <image_id>,
                  "path": <image_path>
              }
    ]
}

3.3. Delete image

DELETE /v1/images/<image_id>
# DELETE
curl -s -X DELETE http://localhost:5000/v1/images/<image_id>
// Return
{ 
    "image_id": '<image_id>'
}

3. License

MIT

About

Store images on remote machine using HTTP requests.

Resources

License

Stars

Watchers

Forks

Packages

No packages published