| PUT | /api/importdata |
|---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using IDB.API.General;
namespace IDB.API.General
{
///<summary>
///Import entity data into DigiOffice (v1)
///</summary>
[Api(Description="Import entity data into DigiOffice (v1)")]
public partial class ImportData
{
///<summary>
///Entityname in which the data will be imported
///</summary>
[ApiMember(Description="Entityname in which the data will be imported", IsRequired=true)]
public virtual string EntityType { get; set; }
///<summary>
///Reports errors with a reference to this field (for example ID)
///</summary>
[ApiMember(Description="Reports errors with a reference to this field (for example ID)")]
public virtual string ErrorField { get; set; }
///<summary>
///Should import continue on errors? (Default true)
///</summary>
[ApiMember(Description="Should import continue on errors? (Default true)")]
public virtual bool ContinueOnError { get; set; }
///<summary>
///Rows to be imported
///</summary>
[ApiMember(Description="Rows to be imported", IsRequired=true)]
public virtual List<Row> Rows { get; set; } = [];
///<summary>
///Additional values to be imported on every row
///</summary>
[ApiMember(Description="Additional values to be imported on every row")]
public virtual List<FixedValue> FixedValues { get; set; }
public partial class Row
{
public virtual List<ImportField> Fields { get; set; }
}
public partial class ImportField
{
public virtual string Name { get; set; }
public virtual string Value { get; set; }
}
public partial class FixedValue
{
public virtual string Name { get; set; }
public virtual string Value { get; set; }
}
}
public partial class ImportResult
{
public virtual int TotalRows { get; set; }
public virtual int TotalAdded { get; set; }
public virtual int TotalUpdated { get; set; }
public virtual int SuccesfullRows { get; set; }
public virtual int ErrorRows { get; set; }
public virtual List<string> Errors { get; set; }
}
}
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
]
}