| POST,OPTIONS | /v1/import/{Type}/preview |
|---|
import Foundation
import ServiceStack
public class ImportPreviewRequest : Codable
{
public var type:String
required public init(){}
}
public class ImportResult : Codable
{
public var importType:String
public var fileName:String
public var dryRun:Bool
public var importBatchId:Int
public var totalRows:Int
public var newRows:Int
public var updatedRows:Int
public var skippedRows:Int
public var errorRows:Int
public var rows:[ImportRowResult] = []
public var responseStatus:ResponseStatus
required public init(){}
}
public class ImportRowResult : Codable
{
public var line:Int
public var action:String
public var field:String
public var message:String
public var summary:String
required public init(){}
}
Swift ImportPreviewRequest DTOs
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 /v1/import/{Type}/preview HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Type: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ImportType: String,
FileName: String,
DryRun: False,
ImportBatchId: 0,
TotalRows: 0,
NewRows: 0,
UpdatedRows: 0,
SkippedRows: 0,
ErrorRows: 0,
Rows:
[
{
Line: 0,
Action: String,
Field: String,
Message: String,
Summary: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}