Nested file, property type 'attachment' (using the example of class 'abc/mnesia' and property 'patt')
Overview
Allows an attachment file to be attached to an entity with a disk location in the preconfigured storage associated with the class collection.
And further perform operations of reading, replacing, deleting the attachment.
Each property of type `attachment` forms a separate endpoint of that type in REST-API.
The file loses its name and extension after download, and is available for download with these characteristics lost under the name of `content`.
It is allowed to upload a file with content-type application/octet-stream and multipart/form-data. In the latter case, the first of the file list is actually saved.
The actual path to attachments is formed the same regardless of the storage type:
For categories: `…/Domain/ClassName/Id12/Id34/Id56/IdRest/PropertyName`
For the story: `…/Domain/ClassName/Id12/Id34/Id56/IdRest/PropertyName`
Requests
HTTP verb | Endpoint | Description |
---|---|---|
|
|
|
|
|
|
|
|
Downloading an attachment
Request
Name | Type | Description |
---|---|---|
|
|
Issuance Type. Default
|
GET /rest/v1/model/abc/mnesia/68f99ca9-016c-d352-e02f-50e54938780c/patt HTTP/1.1
Pouring an attachment
Performs a file replacement.
A single file is uploaded either with Content-Type: multipart/formdata
,
or with an arbitrary Content-Type
that is not multipart.
If the download is done with Content-Type: multipart/formdata
,
then only the first file will be saved (the first part with the filename field in the header)
Content-Disposition
), and the file name itself will be ignored.
Request
PUT /rest/v1/model/abc/mnesia/68f99ca9-016c-d352-e02f-50e54938780c/patt HTTP/1.1
Content-Type: application/octet-stream
BINARY BODY OF 'app.mp3'
PUT /rest/v1/model/abc/mnesia/68f99ca9-016c-d352-e02f-50e54938780c/patt HTTP/1.1
Content-Type: multipart/form-data; boundary=-----------boundary_69df8120352a996e
-----------boundary_69df8120352a996e
Content-Type: application/octet-stream
Content-Disposition: form-data; name="abcde"; filename="app.mp3"
Content-Transfer-Encoding: binary
BINARY BODY OF 'app.mp3'
-----------boundary_69df8120352a996e--