# Blobs

Manage file blobs.

## Initiate file upload

> Initiate a file upload. This endpoint can be used to create resumable uploads.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/blobs/uploads":{"post":{"tags":["Blobs"],"operationId":"initBlobUpload","summary":"Initiate file upload","description":"Initiate a file upload. This endpoint can be used to create resumable uploads.\n","parameters":[{"name":"filename","in":"query","schema":{"type":"string","description":"The name of the file.\n"},"description":"The file name of uploaded file.\n"},{"name":"temporary","in":"query","schema":{"type":"boolean","description":"When uploading temporary files, set the parameter to `true`.\n"},"description":"When uploading temporary files, set the parameter to `true`.\n"}],"responses":{"202":{"description":"Accepted","headers":{"PortSIP-Upload-ID":{"schema":{"type":"string"},"description":"The UUID of file upload.\n"},"PortSIP-Upload-Token":{"schema":{"type":"string"},"description":"The upload token of file upload.\n"},"Content-Length":{"schema":{"type":"integer"},"description":"The length of content.\n"},"Range":{"schema":{"type":"string"},"description":"The content range of file uploaded.\n"}}},"4XX":{"description":"Error"}}}}}}
```

## Upload a chunk of data for the specified upload.

> Upload a stream of data to upload without completing the upload.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/blobs/uploads/{id}/append":{"post":{"tags":["Blobs"],"operationId":"appendBlobUpload","summary":"Upload a chunk of data for the specified upload.","description":"Upload a stream of data to upload without completing the upload.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The universally unique identifier (UUID).\n"},"description":"The keyed UUID of the file upload."},{"name":"PortSIP-Upload-Token","in":"header","required":true,"schema":{"type":"string"},"description":"The upload token of file upload.\n"}],"requestBody":{"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"203":{"description":"Accepted","headers":{"PortSIP-Upload-ID":{"schema":{"type":"string"},"description":"The UUID of file upload.\n"},"PortSIP-Upload-Token":{"schema":{"type":"string"},"description":"The upload token of file upload.\n"},"Content-Length":{"schema":{"type":"integer"},"description":"The length of content.\n"},"Range":{"schema":{"type":"string"},"description":"The content range of file uploaded.\n"}}},"4XX":{"description":"Error"}}}}}}
```

## Complete file upload

> Complete the upload specified by unique ID, providing all the data in the body, if necessary.\
> A request without a body will just complete the upload with previously uploaded content.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/blobs/uploads/{id}/complete":{"post":{"tags":["Blobs"],"operationId":"completeBlobUpload","summary":"Complete file upload","description":"Complete the upload specified by unique ID, providing all the data in the body, if necessary.\nA request without a body will just complete the upload with previously uploaded content.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The universally unique identifier (UUID).\n"},"description":"The keyed UUID of the file upload."},{"name":"PortSIP-Upload-Token","in":"header","required":true,"schema":{"type":"string"},"description":"The upload token of file upload.\n"},{"name":"digest","in":"query","schema":{"type":"string","description":"The Content Digests.\nA digest is a serialized hash result, consisting of a algorithm and hex portion.\nOnly sha256 based digest accepted.\n"},"description":"The digest of the file upload content."}],"requestBody":{"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of the file.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Get file upload status

> Retrieve status of upload identified by the unique ID.\
> The primary purpose of this endpoint is to resolve the current status of a resumable upload.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/blobs/uploads/{id}/status":{"get":{"tags":["Blobs"],"operationId":"getBlobUploadStatus","summary":"Get file upload status","description":"Retrieve status of upload identified by the unique ID.\nThe primary purpose of this endpoint is to resolve the current status of a resumable upload.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The universally unique identifier (UUID).\n"},"description":"The keyed UUID of the file upload."}],"responses":{"204":{"description":"No Content","headers":{"PortSIP-Upload-ID":{"schema":{"type":"string"},"description":"The UUID of file upload.\n"},"PortSIP-Upload-Token":{"schema":{"type":"string"},"description":"The upload token of file upload.\n"},"Content-Length":{"schema":{"type":"integer"},"description":"The length of content.\n"},"Range":{"schema":{"type":"string"},"description":"The content range of file uploaded.\n"}}},"4XX":{"description":"Error"}}}}}}
```

## Delete file upload

> Cancel outstanding upload processes, releasing associated resources.\
> If this is not called, the unfinished uploads will eventually timeout.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/blobs/uploads/{id}/destroy":{"post":{"tags":["Blobs"],"operationId":"deleteBlobUpload","summary":"Delete file upload","description":"Cancel outstanding upload processes, releasing associated resources.\nIf this is not called, the unfinished uploads will eventually timeout.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The universally unique identifier (UUID).\n"},"description":"The keyed UUID of the file upload."}],"responses":{"204":{"description":"No Content"},"4XX":{"description":"Error"}}}}}}
```

## Download file blobs

> Download file from server by it's digest.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Blobs","description":"Manage file blobs.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[],"paths":{"/blobs/{digest}":{"get":{"tags":["Blobs"],"operationId":"downloadBlobs","summary":"Download file blobs","description":"Download file from server by it's digest.\n","parameters":[{"name":"digest","in":"path","required":true,"schema":{"type":"string","description":"The Content Digests.\nA digest is a serialized hash result, consisting of a algorithm and hex portion.\nOnly sha256 based digest accepted.\n"},"description":"The digest of the file blob."}],"responses":{"200":{"description":"OK","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"the format is `attachment; filename=\"example\"`"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"4XX":{"description":"Error"}}}}}}
```
