The service is an abstraction for storing pictures and objects (currently supported objects types are plain/text and application/json) in some database. Now two types of databases are supported: aws S3 and a hard disk. All images and objects are stored in buckets. Thus, to save a picture or an object, create a bucket and then put a picture or object into it. Buckets are disjoint namespaces.
There are two ways to save the image in the system:
Make the request by the POST
method to the resource /1/buckets/{bucket}/images
,
put an image to the body of request. For the image, id will be generated in the uuid format,
on which it will be possible in the future to receive this image.
Make a request using the PUT
method to the resource /1/buckets/{bucket}/images/{id}
,
put an image to the body of request. Further on the transmitted id, you can get this image.
All pictures are converted to jpg format if they were not.
There are two ways to save an object in the system:
Make a request by the POST
method to the resource /1/buckets/{bucket}/objects
,
put an object to the body of request. For the object, id will be generated in the uuid format,
on which it will be possible in the future to receive this object.
Make a request using the PUT
method on the resource/1/buckets/{bucket}/objects/{id}
,
put an object to the body of request. Further on the passed id it is possible to receive this object.
At the moment, the following types of objects are supported: plain/text, application/json, application/zip, application/pdf.
The service provides following options:
Service have api version, actual is 1. All url above /version
, must starts with api version.
OpenAPI specification is the only valid document providing up-to-date information about the service API.
The specification can be used:
All the documents and code generated using this specification can include inaccuracies and should be carefully checked.
OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".
get version of service
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "Version": {
- "api": 1,
- "major": 0,
- "minor": 0,
- "patch": 1
}
}
Creation of bucket. bucket must have unique name. Name must comply storage's naming rules. If storage is hard drive, then bucket is a folder, if storage is s3, then bucket is present bucket in s3 and it's name must comply the naming rules for bucket in s3 (see https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: bucket=image_store-bucket Bucket name. |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Content-Type | string Value: "application/json" Content type is application/json. |
{- "error_code": 12014,
- "detail": "Bad/incomplete input data",
- "desc": "Required parameters 'bucket' not found"
}
Delete current bucket.
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 1,
- "detail": "Internal server error",
- "desc": "Internal server error"
}
save object with unique id
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Content-Type required | string Enum: "application/json" "application/pdf" "application/zip" "text/plain" type of transfering information, available - text, json, zip, pdf |
content type is application/json
{- "content": "json"
}
{- "object_id": "b5d6fd45-fcca-453d-ac05-3e594054b813",
- "url": "/1/buckets/image_store-bucket/objects/b5d6fd45-fcca-453d-ac05-3e594054b813"
}
delete list of objects
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
objects | Array of strings <uuid> (object_id) |
{- "objects": [
- "141d2706-8baf-433b-82eb-8c7fada847da",
- "831d2706-8baf-433b-82eb-8c7fada847da"
]
}
{- "error_code": 12002,
- "detail": "Bad/incomplete input data",
- "desc": "Request does not contain json"
}
save object with specified id
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
object_id required | string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Object Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Content-Type required | string Enum: "application/json" "application/pdf" "application/zip" "text/plain" type of transfering information, available - text, json, zip, pdf |
content type is application/json
{- "content": "json"
}
{- "object_id": "28b87262-43e2-4afc-ad1b-8308e2798b80",
- "url": "/1/buckets/luna_image_store-test-bucket/objects/28b87262-43e2-4afc-ad1b-8308e2798b80"
}
receiving objects
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
object_id required | string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Object Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Accept | string (accept) Enum: "application/json" "text/plain" "application/zip" "application/pdf" acceptable type of recieving data |
{- "json": "example"
}
check object exists
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
object_id required | string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Object Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Accept | string (accept) Enum: "application/json" "text/plain" "application/zip" "application/pdf" acceptable type of recieving data |
{- "error_code": 1,
- "detail": "Internal server error",
- "desc": "Internal server error"
}
Delete object
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
object_id required | string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Object Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 13005,
- "detail": "Object not found",
- "desc": "Bucket with name 'test_bucket' not found"
}
save images with unique id
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Content-Type | string Enum: "image/jpeg" "image/png" "image/bmp" "image/tiff" "image/gif" "image/x-portable-pixmap" type of transmitting image |
{- "image_id": "141d2706-8baf-433b-82eb-8c7fada847da",
- "url": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da",
- "url32": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da_32",
- "url64": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da_64",
- "url96": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da_96",
- "url160": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da_160"
}
delete a bundle of images from bucket
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
content type is application/json
{- "images": [
- "141d2706-8baf-433b-82eb-8c7fada847da",
- "831d2706-8baf-433b-82eb-8c7fada847da"
]
}
{- "error_code": 12002,
- "detail": "Bad/incomplete input data",
- "desc": "Request does not contain json"
}
image saving with specified id
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
image_id required | string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Image Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Content-Type | string Enum: "image/jpeg" "image/png" "image/bmp" "image/tiff" "image/gif" "image/x-portable-pixmap" type of transmitting image |
{- "url": "/1/buckets/image_store-bucket/images/141d2706-8baf-433b-82eb-8c7fada847da"
}
check image exists
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
image_id required | string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Image Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 1,
- "detail": "Internal server error",
- "desc": "Internal server error"
}
Delete an image with all preview copies
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
image_id required | string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Image Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 13003,
- "detail": "Object not found",
- "desc": "Image with id 'b668c4a5-2191-476e-a261-3b4f9ce2e25e' not found"
}
receive an origin image
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
image_id required | string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e Image Id. |
account_id | string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb account id |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 12012,
- "detail": "Bad/incomplete input data",
- "desc": "Bad query parameters 'account_id'"
}
receive an image as a thumbnail
bucket required | string (bucket) ^[a-z0-9-_]{1,255}$ Example: image_store-bucket Bucket name. |
image_id_with_thumbnail required | string (image_id_with_thumbnail) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... Example: b668c4a5-2191-476e-a261-3b4f9ce2e25e_64 Image id with thumbnail parameter. Thumbnail, possible only with methods |
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 18002,
- "detail": "Bad/incomplete input data",
- "desc": "Failed convert bytes to image size 1. The height and width of the output image must be > 0"
}
Get service OpenApi documentation. If Accept request header is of type application/x-yaml
,
returns documentation in yaml
format or returns html
documentation, if Accept-Type is text/html
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Accept required | string (accept_docs_handler) Enum: "application/x-yaml" "text/html" acceptable type of receiving data |
{- "error_code": 12024,
- "detail": "Bad/incomplete input data",
- "desc": "Unsupported media type"
}
Get sphinx documentation - Development Manual. After the request you will be redirected to the page /docs/dev/index.html
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "error_code": 1,
- "detail": "Internal server error",
- "desc": "Internal server error"
}
Get service configuration. If Accept request header is of type application/json
,
returns documentation in json
format or returns text
documentation, if Accept-Type is text/plain
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
Accept | string Enum: "application/json" "text/plain" acceptable type of receiving data |
{- "INFLUX_MONITORING": {
- "SEND_DATA_FOR_MONITORING": 0,
- "VERSION": 2,
- "ORGANIZATION": "ORGANIZATION_NAME",
- "TOKEN": "********",
- "BUCKET": "luna_monitoring",
- "HOST": "127.0.0.1",
- "PORT": 8086,
- "USE_SSL": 0,
- "FLUSHING_PERIOD": 1
}
}
get health of service
Luna-Request-Id | string <timestamp,uuid> ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4... Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response. |
{- "execution_time": 0.123
}