NAV Navigation
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP

preview v0.5.1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Preview service. 🚀

You can preview the following type of files:

You will be able to:

The main difference between thumbnail and preview functionality is that preview tends to be more faithful while thumbnail tends to elaborate on it, cropping it by default and rounding the image if asked. Preview should always output the file in its original format, while thumbnail will convert it to an image. There is no difference in quality between png and jpeg, the difference in quality can be achieved only by asking for a jpeg format and changing the quality parameter. Asking for a GIF output can only be done when the input file is a GIF, otherwise it will raise and error.

image

get_thumbnail_preview_image__id___version___area__thumbnail__get

Code samples

# You can also use wget
curl -X GET /preview/image/{id}/{version}/{area}/thumbnail/?service_type=files \
  -H 'Accept: application/json'

GET /preview/image/{id}/{version}/{area}/thumbnail/

Get Thumbnail

Creates and returns a thumbnail of the image fetched by id and version with the given size, quality, format and shape. It will automatically crop the picture.

Parameters

Name In Type Required Description
id path string true none
version path integer true none
area path string true none
service_type query ServiceTypeEnum true none
shape query any false none
quality query any false none
output_format query any false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

post_thumbnail_preview_image__area__thumbnail__post

Code samples

# You can also use wget
curl -X POST /preview/image/{area}/thumbnail/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/image/{area}/thumbnail/

Post Thumbnail

Creates and returns a thumbnail of the given image with the given size, quality, format and shape.

Body parameter

file: string

Parameters

Name In Type Required Description
area path string true none
shape query any false none
quality query any false none
output_format query any false none
body body Body_post_thumbnail_preview_image__area__thumbnail__post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

post_preview_preview_image__area___post

Code samples

# You can also use wget
curl -X POST /preview/image/{area}/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/image/{area}/

Post Preview

Creates and returns a preview of the given image with the given size, quality and format

Body parameter

file: string

Parameters

Name In Type Required Description
area path string true none
crop query boolean false none
quality query any false none
output_format query any false none
body body Body_post_preview_preview_image__area___post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

get_preview_preview_image__id___version___area___get

Code samples

# You can also use wget
curl -X GET /preview/image/{id}/{version}/{area}/?service_type=files \
  -H 'Accept: application/json'

GET /preview/image/{id}/{version}/{area}/

Get Preview

Creates and returns a preview of the image fetched by id and version with the given size, quality and format

Parameters

Name In Type Required Description
id path string true none
version path integer true none
area path string true none
service_type query ServiceTypeEnum true none
crop query boolean false none
quality query any false none
output_format query any false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

pdf

get_preview_preview_pdf__id___version___get

Code samples

# You can also use wget
curl -X GET /preview/pdf/{id}/{version}/?service_type=files \
  -H 'Accept: application/json'

GET /preview/pdf/{id}/{version}/

Get Preview

Create and returns a preview of the given file, the pdf file will contain the first and last page given. With default values will return all the pages.

Parameters

Name In Type Required Description
id path string true none
version path integer true none
service_type query ServiceTypeEnum true none
first_page query integer false none
last_page query integer false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

post_preview_preview_pdf__post

Code samples

# You can also use wget
curl -X POST /preview/pdf/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/pdf/

Post Preview

Create and returns a preview of the given file, the pdf file will contain the first and last page given. With default values will return all the pages.

Body parameter

file: string

Parameters

Name In Type Required Description
first_page query integer false none
last_page query integer false none
body body Body_post_preview_preview_pdf__post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

post_thumbnail_preview_pdf__area__thumbnail__post

Code samples

# You can also use wget
curl -X POST /preview/pdf/{area}/thumbnail/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/pdf/{area}/thumbnail/

Post Thumbnail

Create and returns the thumbnail of the given file, the image rendered will be the first page.

Body parameter

file: string

Parameters

Name In Type Required Description
area path string true none
shape query any false none
quality query any false none
output_format query any false none
body body Body_post_thumbnail_preview_pdf__area__thumbnail__post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

get_thumbnail_preview_pdf__id___version___area__thumbnail__get

Code samples

# You can also use wget
curl -X GET /preview/pdf/{id}/{version}/{area}/thumbnail/?service_type=files \
  -H 'Accept: application/json'

GET /preview/pdf/{id}/{version}/{area}/thumbnail/

Get Thumbnail

Create and returns a thumbnail of the file fetched by id and version the image will be rendered from the first page.

Parameters

Name In Type Required Description
id path string true none
version path integer true none
area path string true none
service_type query ServiceTypeEnum true none
shape query any false none
quality query any false none
output_format query any false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

document

get_preview_preview_document__id___version___get

Code samples

# You can also use wget
curl -X GET /preview/document/{id}/{version}/?service_type=files \
  -H 'Accept: application/json'

GET /preview/document/{id}/{version}/

Get Preview

Create and returns a pdf preview of the given file, the pdf file will contain the first and last page given. With default values will return all the pages.

Parameters

Name In Type Required Description
id path string true none
version path integer true none
service_type query ServiceTypeEnum true none
first_page query integer false none
last_page query integer false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

post_preview_preview_document__post

Code samples

# You can also use wget
curl -X POST /preview/document/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/document/

Post Preview

Create and returns a pdf preview of the given file, the pdf file will contain the first and last page given. With default values will return all the pages.

Body parameter

file: string

Parameters

Name In Type Required Description
first_page query integer false none
last_page query integer false none
body body Body_post_preview_preview_document__post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

post_thumbnail_preview_document__area__thumbnail__post

Code samples

# You can also use wget
curl -X POST /preview/document/{area}/thumbnail/ \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST /preview/document/{area}/thumbnail/

Post Thumbnail

Create and returns the thumbnail of the given file, the image rendered will be the first page.

Body parameter

file: string

Parameters

Name In Type Required Description
area path string true none
shape query any false none
quality query any false none
output_format query any false none
body body Body_post_thumbnail_preview_document__area__thumbnail__post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
400 Bad Request Some values in the query were not correct. None
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

get_thumbnail_preview_document__id___version___area__thumbnail__get

Code samples

# You can also use wget
curl -X GET /preview/document/{id}/{version}/{area}/thumbnail/?service_type=files \
  -H 'Accept: application/json'

GET /preview/document/{id}/{version}/{area}/thumbnail/

Get Thumbnail

Create and returns a thumbnail of the file fetched by id and version the image will be rendered from the first page.

Parameters

Name In Type Required Description
id path string true none
version path integer true none
area path string true none
service_type query ServiceTypeEnum true none
shape query any false none
quality query any false none
output_format query any false none

Enumerated Values

Parameter Value
service_type files
service_type chats

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
404 Not Found Requested item was not found in the storage. None
422 Unprocessable Entity Validation Error HTTPValidationError
502 Bad Gateway Storage is currently unavailable. None

Response Schema

health

health_health__get

Code samples

# You can also use wget
curl -X GET /health/ \
  -H 'Accept: application/json'

GET /health/

Health

Checks if the service and all of its dependencies are working and returns a descriptive json

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
429 Too Many Requests Carbonio-docs-editor is currently unavailable, document preview service is currently offline. None
502 Bad Gateway Storage is currently unavailable. None

Response Schema

health_ready_health_ready__get

Code samples

# You can also use wget
curl -X GET /health/ready/ \
  -H 'Accept: application/json'

GET /health/ready/

Health Ready

Checks if the service is up and essential dependencies are running correctly

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
429 Too Many Requests Carbonio-docs-editor is currently unavailable, document preview service is currently offline. None
502 Bad Gateway Storage is currently unavailable. None

Response Schema

health_live_health_live__get

Code samples

# You can also use wget
curl -X GET /health/live/ \
  -H 'Accept: application/json'

GET /health/live/

Health Live

Checks if the service is up

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
429 Too Many Requests Carbonio-docs-editor is currently unavailable, document preview service is currently offline. None
502 Bad Gateway Storage is currently unavailable. None

Response Schema

Schemas

Body_post_preview_preview_document__post

{
  "file": "string"
}

Body_post_preview_preview_document__post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

Body_post_preview_preview_image__area___post

{
  "file": "string"
}

Body_post_preview_preview_image__area___post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

Body_post_preview_preview_pdf__post

{
  "file": "string"
}

Body_post_preview_preview_pdf__post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

Body_post_thumbnail_preview_document__area__thumbnail__post

{
  "file": "string"
}

Body_post_thumbnail_preview_document__area__thumbnail__post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

Body_post_thumbnail_preview_image__area__thumbnail__post

{
  "file": "string"
}

Body_post_thumbnail_preview_image__area__thumbnail__post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

Body_post_thumbnail_preview_pdf__area__thumbnail__post

{
  "file": "string"
}

Body_post_thumbnail_preview_pdf__area__thumbnail__post

Properties

Name Type Required Restrictions Description
file string(binary) true none none

HTTPValidationError

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

HTTPValidationError

Properties

Name Type Required Restrictions Description
detail [ValidationError] false none none

ImageBorderShapeEnum

"rounded"

ImageBorderShapeEnum

Properties

Name Type Required Restrictions Description
ImageBorderShapeEnum string false none Class representing all the image type accepted values

Enumerated Values

Property Value
ImageBorderShapeEnum rounded
ImageBorderShapeEnum rectangular

ImageQualityEnum

"lowest"

ImageQualityEnum

Properties

Name Type Required Restrictions Description
ImageQualityEnum string false none Class representing all the image quality accepted values

Enumerated Values

Property Value
ImageQualityEnum lowest
ImageQualityEnum low
ImageQualityEnum medium
ImageQualityEnum high
ImageQualityEnum highest

ImageTypeEnum

"jpeg"

ImageTypeEnum

Properties

Name Type Required Restrictions Description
ImageTypeEnum string false none Class representing all the image type accepted values

Enumerated Values

Property Value
ImageTypeEnum jpeg
ImageTypeEnum png
ImageTypeEnum gif

ServiceTypeEnum

"files"

ServiceTypeEnum

Properties

Name Type Required Restrictions Description
ServiceTypeEnum string false none Class representing all the service type accepted values

Enumerated Values

Property Value
ServiceTypeEnum files
ServiceTypeEnum chats

ValidationError

{
  "loc": [
    "string"
  ],
  "msg": "string",
  "type": "string"
}

ValidationError

Properties

Name Type Required Restrictions Description
loc [anyOf] true none none

anyOf

Name Type Required Restrictions Description
» anonymous string false none none

or

Name Type Required Restrictions Description
» anonymous integer false none none

continued

Name Type Required Restrictions Description
msg string true none none
type string true none none