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 Foundation
import ServiceStack

public class DocumentSearchRequest : Codable
{
    public var searchTerms:String
    public var searchMode:DocumentSearchMode
    public var termMode:DocumentTermMode
    public var userId:String

    required public init(){}
}

public enum DocumentSearchMode : Int, Codable
{
    case Exact = 1
    case Contains = 2
    case StartsWith = 3
    case EndsWith = 4
}

public enum DocumentTermMode : Int, Codable
{
    case All = 1
    case Any = 2
}

public class DocumentSearchResponse : Codable
{
    public var documentSearchCount:Int
    public var documentSearchResults:[DocumentSearchResult] = []
    public var responseStatus:ResponseStatus

    required public init(){}
}

public class DocumentSearchResult : Codable
{
    public var attachmentId:String
    public var dateAdded:Date
    public var attachmentName:String
    public var Description:String
    public var documentType:String
    public var documentGroup:String
    public var dropboxTableName:String
    public var dropboxRecordId:Int
    public var attachmentTableName:String
    public var attachmentFieldName:String
    public var attachmentRecordId:Int
    public var filePath:String
    public var ocrSource:String
    public var ocrResult:String
    public var lines:[LineSearchResult] = []

    required public init(){}
}

public class LineSearchResult : Codable
{
    public var lineText:String
    public var pageNo:Int
    public var pageLineNo:Int
    public var docLineNo:Int
    public var boxTop:Double
    public var boxLeft:Double
    public var boxWidth:Double
    public var boxHeight:Double

    required public init(){}
}


Swift DocumentSearchRequest DTOs

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

HTTP + JSV

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/jsv
Content-Type: text/jsv
Content-Length: length

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

{
	DocumentSearchCount: 0,
	DocumentSearchResults: 
	[
		{
			AttachmentId: 00000000000000000000000000000000,
			DateAdded: 0001-01-01,
			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
		}
	}
}