Create BLOB

Motivation

Creates a new BLOB with the uploaded binary data

Functional design

  • POST /api/v2/apps/{owner}/{app}/workspaces/{wsid}/docs/{pkg}.{table}/blobs/{fieldName} Creates a new BLOB with the uploaded binary data. The ID of the BLOB is returned in the response and can be used to write the BLOB to specified field of a document or record when creating or updating record.

Headers

Key
Value

Authorization

Bearer {PrincipalToken}

Content-Type

BLOB content type

Blob-Name

BLOB name, optional

Parameters

Parameter
Type
Description

owner

string

name of a user who owns the application

app

string

name of an application

wsid

int64

the ID of workspace

pkg, table

string

identifies a table (document or record)

fieldName

string

name of the field in document which should keep the BLOB

Body

BLOB data.

Result

Code
Description
Body

201

Created

blob ID, see example below

400

Bad Request

401

Unauthorized

403

Forbidden

413

Payload Too Large

415

Unsupported Media Type

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Example response 201:

{
    "blobID": 123456789, 
}

Perimssions

  • Execution of this function is granted to role sys.BLOBUploader which is by default granted to sys.WorkspaceOwner.

Technical design

Components

  • ~cmp.sysBlobOwnerRecord~✅ extend pkg/sys/Workspace/wdoc.sys.BLOB with new fields:

    • OwnerRecord qname NOT NULL

    • OwnerRecordField varchar NOT NULL

    • OwnerRecordID ref

  • pkg/router

    • ~cmp.routerBlobsCreatePathHandler~✅: Create BLOB path handler

  • pkg/sys/it

    • ~it.TestBlobsCreate~✅: integration test for creating BLOBs

Last updated

Was this helpful?