| POST | /api/DMS/AddUploadFile |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MetaDataField:
id: Optional[str] = None
document_veld_i_d: Optional[str] = None
name: Optional[str] = None
label: Optional[str] = None
datatype: Optional[str] = None
print_label: Optional[str] = None
entity: Optional[str] = None
print_value: Optional[str] = None
registration_value: Optional[str] = None
sp_site_column_name: Optional[str] = None
shadow_name: Optional[str] = None
shadow_datatype: Optional[str] = None
shadow_s_p_site_column_name: Optional[str] = None
shadow_s_p_site_column_registration_value: Optional[str] = None
shadow_registration_value: Optional[str] = None
is_key_field: bool = False
kopieren_bij_nieuwe_versie: bool = False
# @Api(Description="Add a uploadfile with metadata.")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddUploadFile:
"""
Add a uploadfile with metadata.
"""
# @ApiMember(Description="Registration profile ID", IsRequired=true)
registration_profile_i_d: Optional[str] = None
"""
Registration profile ID
"""
# @ApiMember(Description="Registration navigation path")
navigation_path: Optional[str] = None
"""
Registration navigation path
"""
# @ApiMember(Description="File name", IsRequired=true)
file_name: Optional[str] = None
"""
File name
"""
# @ApiMember(Description="File date", IsRequired=true)
file_date: datetime.datetime = datetime.datetime(1, 1, 1)
"""
File date
"""
# @ApiMember(Description="File content", IsRequired=true)
file_content: bytes = field(default_factory=list)
"""
File content
"""
# @ApiMember(Description="File description", IsRequired=true)
description: Optional[str] = None
"""
File description
"""
# @ApiMember(Description="Keep document in uploads (false; register immediately)")
document_upload: bool = False
"""
Keep document in uploads (false; register immediately)
"""
# @ApiMember(Description="Source of the file")
source: Optional[str] = None
"""
Source of the file
"""
# @ApiMember(Description="MetaDataFields")
meta_data_fields: Optional[List[MetaDataField]] = None
"""
MetaDataFields
"""
# @ApiMember(Description="Document ID")
document_i_d: Optional[str] = None
"""
Document ID
"""
# @ApiMember(Description="Main Document ID")
main_document_i_d: Optional[str] = None
"""
Main Document ID
"""
# @ApiMember(Description="Sub Document IDs")
sub_document_i_ds: Optional[List[str]] = None
"""
Sub Document IDs
"""
class MessageType(IntEnum):
INFORMATION = 1
WARNING = 2
ERROR = 3
SUCCESS = 4
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InformationMessageBase(IInformationMessage):
type: Optional[MessageType] = None
summary: Optional[str] = None
full_message: Optional[str] = None
field_name: Optional[str] = None
keep_open: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InformationMessages(List[InformationMessageBase], IInformationMessages):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddUploadFileResponse:
document_id: Optional[str] = None
document_upload_id: Optional[int] = None
document_nr: Optional[str] = None
messages: Optional[InformationMessages] = None
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/DMS/AddUploadFile HTTP/1.1
Host: test-dogw.klokgroep.nl
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
NavigationPath: String,
FileName: String,
FileDate: 0001-01-01,
FileContent: AA==,
Description: String,
DocumentUpload: False,
Source: String,
MetaDataFields:
[
{
ID: 00000000-0000-0000-0000-000000000000,
DocumentVeldID: 00000000-0000-0000-0000-000000000000,
Name: String,
Label: String,
Datatype: String,
PrintLabel: String,
Entity: String,
PrintValue: String,
RegistrationValue: String,
SPSiteColumnName: String,
ShadowName: String,
ShadowDatatype: String,
ShadowSPSiteColumnName: String,
ShadowSPSiteColumnRegistrationValue: String,
ShadowRegistrationValue: String,
IsKeyField: False,
KopierenBijNieuweVersie: False
}
],
DocumentID: 00000000-0000-0000-0000-000000000000,
MainDocumentID: 00000000-0000-0000-0000-000000000000,
SubDocumentIDs:
[
00000000-0000-0000-0000-000000000000
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
DocumentId: 00000000-0000-0000-0000-000000000000,
DocumentUploadId: 0,
DocumentNr: String,
Messages:
[
{
}
]
}