| PUT | /api/importdata |
|---|
import Foundation
import ServiceStack
/**
* Import entity data into DigiOffice (v1)
*/
// @Api(Description="Import entity data into DigiOffice (v1)")
public class ImportData : Codable
{
/**
* Entityname in which the data will be imported
*/
// @ApiMember(Description="Entityname in which the data will be imported", IsRequired=true)
public var entityType:String
/**
* Reports errors with a reference to this field (for example ID)
*/
// @ApiMember(Description="Reports errors with a reference to this field (for example ID)")
public var errorField:String
/**
* Should import continue on errors? (Default true)
*/
// @ApiMember(Description="Should import continue on errors? (Default true)")
public var continueOnError:Bool
/**
* Rows to be imported
*/
// @ApiMember(Description="Rows to be imported", IsRequired=true)
public var rows:[Row] = []
/**
* Additional values to be imported on every row
*/
// @ApiMember(Description="Additional values to be imported on every row")
public var fixedValues:[FixedValue]
required public init(){}
}
public class Row : Codable
{
public var fields:[ImportField]
required public init(){}
}
public class ImportField : Codable
{
public var name:String
public var value:String
required public init(){}
}
public class FixedValue : Codable
{
public var name:String
public var value:String
required public init(){}
}
public class ImportResult : Codable
{
public var totalRows:Int
public var totalAdded:Int
public var totalUpdated:Int
public var succesfullRows:Int
public var errorRows:Int
public var errors:[String]
required public init(){}
}
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.
PUT /api/importdata HTTP/1.1
Host: test-do-services.klokgroep.nl
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
EntityType: String,
ErrorField: String,
ContinueOnError: False,
Rows:
[
{
Fields:
[
{
Name: String,
Value: String
}
]
}
],
FixedValues:
[
{
Name: String,
Value: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
TotalRows: 0,
TotalAdded: 0,
TotalUpdated: 0,
SuccesfullRows: 0,
ErrorRows: 0,
Errors:
[
String
]
}