| Requires any of the roles: | Worker, Agent, Administrator |
| GET,OPTIONS | /v1/cad/{AttachmentId}/{VersionNo} | ||
|---|---|---|---|
| GET,OPTIONS | /v1/cad/{AttachmentId} |
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 CadLayout:
name: Optional[str] = None
is_paper_space: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CadFileInfo:
cad_file_info_i_d: int = 0
attachment_id: Optional[str] = None
version_no: int = 0
file_name: Optional[str] = None
format: Optional[str] = None
format_label: Optional[str] = None
cad_version: Optional[str] = None
cad_version_code: Optional[str] = None
units: Optional[str] = None
drawing_number: Optional[str] = None
title: Optional[str] = None
layout_count: int = 0
layouts: List[CadLayout] = field(default_factory=list)
layer_count: int = 0
entity_count: int = 0
text_chars: int = 0
extracted_text: Optional[str] = None
reader: Optional[str] = None
status: Optional[str] = None
error_text: Optional[str] = None
created_at: Optional[datetime.datetime] = None
updated_at: Optional[datetime.datetime] = None
age_seconds: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CadDerivative:
cad_derivative_i_d: int = 0
attachment_id: Optional[str] = None
version_no: int = 0
urn: Optional[str] = None
object_key: Optional[str] = None
status: Optional[str] = None
progress: int = 0
stage_label: Optional[str] = None
has2d: bool = False
has3d: bool = False
has_pdf: bool = False
thumb_key: Optional[str] = None
thumb_url: Optional[str] = None
pdf_attachment_id: Optional[str] = None
error_text: Optional[str] = None
requested_by: Optional[str] = None
requested_at: Optional[datetime.datetime] = None
finished_at: Optional[datetime.datetime] = None
age_seconds: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CadCompanion:
attachment_id: Optional[str] = None
attachment_name: Optional[str] = None
created_date: Optional[datetime.datetime] = None
file_size_in_k_b: Optional[float] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CadInfoResponse:
response_status: Optional[ResponseStatus] = None
attachment_id: Optional[str] = None
file_name: Optional[str] = None
info: Optional[CadFileInfo] = None
derivative: Optional[CadDerivative] = None
companions: List[CadCompanion] = field(default_factory=list)
aps_connected: bool = False
can_render: bool = False
viewer_script_url: Optional[str] = None
viewer_style_url: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CadInfoRequest:
attachment_id: Optional[str] = None
version_no: Optional[int] = 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.
GET /v1/cad/{AttachmentId}/{VersionNo} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
AttachmentId: 00000000000000000000000000000000,
FileName: String,
Info:
{
CadFileInfoID: 0,
AttachmentId: 00000000000000000000000000000000,
VersionNo: 0,
FileName: String,
Format: String,
FormatLabel: String,
CadVersion: String,
CadVersionCode: String,
Units: String,
DrawingNumber: String,
Title: String,
LayoutCount: 0,
Layouts:
[
{
Name: String,
IsPaperSpace: False
}
],
LayerCount: 0,
EntityCount: 0,
TextChars: 0,
ExtractedText: String,
Reader: String,
Status: String,
ErrorText: String,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01,
AgeSeconds: 0
},
Derivative:
{
CadDerivativeID: 0,
AttachmentId: 00000000000000000000000000000000,
VersionNo: 0,
Urn: String,
ObjectKey: String,
Status: String,
Progress: 0,
StageLabel: String,
Has2d: False,
Has3d: False,
HasPdf: False,
ThumbKey: String,
ThumbUrl: String,
PdfAttachmentId: 00000000000000000000000000000000,
ErrorText: String,
RequestedBy: String,
RequestedAt: 0001-01-01,
FinishedAt: 0001-01-01,
AgeSeconds: 0
},
Companions:
[
{
AttachmentId: 00000000000000000000000000000000,
AttachmentName: String,
CreatedDate: 0001-01-01,
FileSizeInKB: 0
}
],
ApsConnected: False,
CanRender: False,
ViewerScriptUrl: String,
ViewerStyleUrl: String
}