Create File
POST/api/workspaces/:workspace_id/files/
Create a new file object in the scope of an entity or session. Subsequently, the temp_upload_url
and temp_upload_data
from the response need to be used to upload the file itself.
Request
Path Parameters
- application/json
Body
required
Possible values: [entity
, session
]
Scope of the file. Can be one of: entity, session.
Id of entity which the file is bound. This field can be provided when in tree or simple app types only.
Editor session to be scoped under. This field should be provided on editor app type only.
Possible values: non-empty
and <= 512 characters
Name of the file to be uploaded.
Responses
- 201
- 400
- 401
- 403
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [entity
, session
]
Scope of the file. Can be one of: entity, session.
Id of entity which the file is bound. This field can be provided when in tree or simple app types only.
Editor session to be scoped under. This field should be provided on editor app type only.
Possible values: non-empty
and <= 512 characters
Name of the file to be uploaded.
Creation date and time of the file.
Possible values: non-empty
Temporary S3 upload url of the object. See :ref:Using S3 Presigned Post Payloads <s3 presigned post target>
for details.
Temporary S3 upload fields which will be used when sending the object to S3 with file. See :ref:Using S3 Presigned Post Payloads <s3 presigned post target>
for details.
{
"id": 0,
"scope": "entity",
"entity_id": 0,
"editor_session": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"filename": "string",
"created_at": "2024-06-11T11:45:44.613Z",
"temp_upload_url": "string",
"temp_upload_data": {}
}
Validation error response.
It produces a validation error schema like below.
{
"field1": ["Validation error"],
"non_field_errors": ["Sample non field validation error"]
}
No authentication found or authentication is not correct.
Specified path is not allowed
Permission evaluation:
((Is Authenticated Organization Admin OR Workspace Context Permission) OR Public Permission) AND Is Not App
Descriptions:
Is Authenticated Organization Admin
: User must be an Organization Admin.
Public Permission
: Checks corresponding workspace is public.
Workspace Context Permission
: Workspace must be available to the User.
Is Not App
: Client must not be a VIKTOR app.