Trendsic Platform Service

<back to all web services

DocumentSearchRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/DocumentSearch
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 LineSearchResult:
    line_text: Optional[str] = None
    page_no: int = 0
    page_line_no: int = 0
    doc_line_no: int = 0
    box_top: float = 0.0
    box_left: float = 0.0
    box_width: float = 0.0
    box_height: float = 0.0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentSearchResult:
    attachment_id: Optional[str] = None
    date_added: datetime.datetime = datetime.datetime(1, 1, 1)
    attachment_name: Optional[str] = None
    description: Optional[str] = None
    document_type: Optional[str] = None
    document_group: Optional[str] = None
    dropbox_table_name: Optional[str] = None
    dropbox_record_id: int = 0
    attachment_table_name: Optional[str] = None
    attachment_field_name: Optional[str] = None
    attachment_record_id: int = 0
    file_path: Optional[str] = None
    ocr_source: Optional[str] = None
    ocr_result: Optional[str] = None
    lines: List[LineSearchResult] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentSearchResponse:
    document_search_count: int = 0
    document_search_results: List[DocumentSearchResult] = field(default_factory=list)
    response_status: Optional[ResponseStatus] = None


class DocumentSearchMode(IntEnum):
    EXACT = 1
    CONTAINS = 2
    STARTS_WITH = 3
    ENDS_WITH = 4


class DocumentTermMode(IntEnum):
    ALL = 1
    ANY = 2


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentSearchRequest:
    search_terms: Optional[str] = None
    search_mode: Optional[DocumentSearchMode] = None
    term_mode: Optional[DocumentTermMode] = None
    user_id: Optional[str] = None

Python DocumentSearchRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/DocumentSearch HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"searchTerms":"String","searchMode":"Exact","termMode":"All","userId":"00000000000000000000000000000000"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"DocumentSearchCount":0,"DocumentSearchResults":[{"AttachmentId":"00000000000000000000000000000000","DateAdded":"0001-01-01T00:00:00.0000000","AttachmentName":"String","Description":"String","DocumentType":"String","DocumentGroup":"String","DropboxTableName":"String","DropboxRecordId":0,"AttachmentTableName":"String","AttachmentFieldName":"String","AttachmentRecordId":0,"FilePath":"String","OCRSource":"String","OCRResult":"String","Lines":[{"LineText":"String","PageNo":0,"PageLineNo":0,"DocLineNo":0,"BoxTop":0,"BoxLeft":0,"BoxWidth":0,"BoxHeight":0}]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}