Files
The Files API has methods for managing files.
Create a file (files app)
POST /api/apps/{id}/files
Creates a new file in the specified Files app.
Sample request
$ curl {WEAVY_SERVER}/api/apps/1/files
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'blob_id': 1 }"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | App id |
Request body
application/json
{
"blob_id": "integer",
"name?": "string",
"metadata?": {},
"tags?": [
"string"
],
"replace?": "boolean"
}
Note. Properties marked with ? are optional.
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Status code 201
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 409
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
List files (files app)
GET /api/apps/{id}/files
List files in the specified Files app.
Sample request
$ curl {WEAVY_SERVER}/api/apps/1/files?top=30
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | App id. |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Get file metadata
GET /api/files/{id}
Get file metadata.
Sample request
$ curl {WEAVY_SERVER}/api/files/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | File id |
trashed | boolean | False | `true` to return file even if trashed. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Update file
PATCH /api/files/{id}
Update a file.
Sample request
$ curl -X PATCH {WEAVY_SERVER}/api/files/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'name': 'Updated file name' }"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of file. |
Request body
application/json
{
"blob_id?": "integer",
"name?": "string",
"metadata?": {},
"tags?": [
"string"
],
"backup?": "boolean"
}
Note. Properties marked with ? are optional.
Responses
Status code 204
No Content
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Delete file
DELETE /api/files/{id}
Delete a file.
Sample request
$ curl -X DELETE {WEAVY_SERVER}/api/files/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the file. |
Responses
Status code 204
No Content
Get file version
GET /api/files/{id}/versions/{version}
Get specific version of a file.
Sample request
$ curl {WEAVY_SERVER}/api/files/1/versions/2
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | File id. |
version | integer | True | Version number. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Delete file version
DELETE /api/files/{id}/versions/{version}
Delete specific version of a file.
Sample request
$ curl -X DELETE {WEAVY_SERVER}/api/files/1/versions/2
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | File id. |
version | integer | True | Version number. |
Responses
Status code 204
No Content
Get file versions
GET /api/files/{id}/versions
Get versions for the specified file.
Sample request
$ curl {WEAVY_SERVER}/api/files/1/versions
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | File id. |
Responses
Status code 200
application/json
{}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Subscribe to file
POST /api/files/{id}/subscribe
Subscribe to notifications for activity on a file.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/files/1/subscribe
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the file. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Unsubscribe to file
POST /api/files/{id}/unsubscribe
Unsubscribe to notifications for activity on a file.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/files/1/unsubscribe
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the file. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Trash file
POST /api/files/{id}/trash
Move a file to the trash.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/files/1/trash
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the file to trash. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Restore file
POST /api/files/{id}/restore
Restore a file from the trash.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/files/1/restore
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the file to restore. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Restore file version
POST /api/files/{id}/versions/{version}/restore
Restore a previous version of a file to be the current version.
This will create a new version with the contents of the previous version, but preserves all existing versions of the file.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/files/1/versions/2/restore
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | File id. |
version | integer | True | Version number. |
Responses
Status code 200
application/json
{
"id": "integer",
"app_id": "integer",
"version": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"tags": [
"string"
],
"provider": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"comment_count": "integer",
"comments": [
"object"
],
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
List files (comment)
GET /api/comments/{id}/attachments
List files attached to the specified comment.
Sample request
$ curl {WEAVY_SERVER}/api/comments/1/attachments
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Comment id. |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List files (message)
GET /api/messages/{id}/attachments
List files attached to the specified message.
Sample request
$ curl {WEAVY_SERVER}/api/messages/1/attachments
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Message id. |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List files (post)
GET /api/posts/{id}/attachments
List files attached to the specified post.
Sample request
$ curl {WEAVY_SERVER}/api/posts/1/attachments
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Post id. |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}