Skip to content

File routes: update, delete

The File Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for File, one group of File routes.

File.update

Changes the given properties of a File. Verb page.

Text
PATCH /{namespace}/files/{id}

Path: id. Body, as JSON: the other inputs. Emits File.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the File.
contentTypestringThe media type, such as application/pdf.
sizeintegerThe size in bytes.
namestringThe file name it was uploaded with.
visibilitystringWho may read it: Owner, Customer, or Public. The default is Owner.

Returns

OutputTypeRequiredDescription
fileFilerequiredThe File.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/files/file_V1AuhyCTsH \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"size":1}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "file": {
    "$id": "https://api.sb/leaseline.app/files/file_V1AuhyCTsH",
    "$type": "File",
    "contentType": "Example content type",
    "size": 1
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "File.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

File.delete

Deletes a File: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/files/{id}

Path: id. Emits File.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the File.

Returns

OutputTypeRequiredDescription
fileFilerequiredThe File.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/files/file_V1AuhyCTsH \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "file": {
    "$id": "https://api.sb/leaseline.app/files/file_V1AuhyCTsH",
    "$type": "File",
    "contentType": "Example content type",
    "size": 1
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "File.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}