Skip to content

S3File

S3File is the file upload system of Ving.

The process of uploading a file happens in 3 steps:

  • Get a presigned URL for S3
  • Upload to S3
  • Post back to import the file for use on some other Ving Record

Here's a bit more detail:

Browser / Your Code --> POST filename and content type to /api/v1/s3file 
                            * creates an S3File and sets its status to pending
                            * generates a Presigned URL for S3
                    <-- Return S3File description, including meta.presignedUrl

                    --> PUT s3file.meta.presignedUrl
                            * stores file in S3
                    <-- Return nothing

                    --> PUT s3file.props.id to an import API such as /api/v1/user/:id/import-avatar
                            * post processes the file uploaded to S3
                            * verifies that the file conforms to the import rules
                    <-- Return updated record such as User

Filters

PropQueryableQualifierRange
createdAtNoNoYes
updatedAtNoNoYes
filenameYesNoNo
sizeInBytesNoYesYes
extensionNoYesNo
userIdNoYesNo

Relationships

NameRecordTypeEndpoint
userUserParent/api/v1/s3file/:id/user
avatarUsersUserChild/api/v1/s3file/:id/avatarusers

Endpoints

List

GET /api/v1/s3file

Create

POST /api/v1/s3file

You won't actually post the file here. You post the filename, contentType, and sizeInBytes here and it will return a presignedUrl in the meta section.

Read

GET /api/v1/s3file/:id

Update

PUT /api/v1/s3file/:id

Delete

DELETE /api/v1/s3file/:id

Options

GET /api/v1/s3file/options