we need to provide the route /my-documents with which it should be possible to send files. We then should store them in our database somehow.
A package that can handle multipart/form-data is multer. Maybe it's a good idea to use it.
The following specification is to be reviewed and implemented.
DOCUMENTS
header
header
endpoint:
/my-documents
method:
POST
content-type:
multipart/form-data; boundary=<boundary-string>
Parts
name
type
mandatory
description
uid
string
false
The requested uid of that document in the database, in UUID-format (8-4-4-4-12). Causes an error if already existing in DB. If omitted, a new version 4 UUID will be generated. The used one will be returned in the response.
filename
string
false
The filename to be used for download. If omitted, the user has to pick a filename when downloading.
title
string
true
The title of the document instance. Different titles can be used for the same file, f.i. for generic manuals
version
string
false
The version of the document, to be used for information, sorting, identification on display.
type
string
true
One of enum: other, LCA, dismantling
format
string
true
One of enum: other, ILCD, JSON, BSON, PDF, JPEG, PNG or a MIME-type
hash
string
false (true if not files)
If given, it must match the SHA-1 hash of either the sent binary filedata (if contained) or of an already existing file, otherwise an error is returned. The generated hash will be returned in the response.
uploaded
string
false
The date and time the document was uploaded by the end-user. If omitted, the datetime of the request to that business-backend endpoint will be used. Format: UTC format or seconds since epoc, readable by javascript Date() constructor.
file
string
false
The actual filedata of the document. If omitted, then a hash of an already existing file must be
we need to provide the route
/my-documents
with which it should be possible to send files. We then should store them in our database somehow.A package that can handle
multipart/form-data
is multer. Maybe it's a good idea to use it.The following specification is to be reviewed and implemented.
DOCUMENTS
<boundary-string>
Parts
other
,LCA
,dismantling
other
,ILCD
,JSON
,BSON
,PDF
,JPEG
,PNG
or a MIME-typeExample
Response