DigiOffice API Services Services

<back to all web services

ImportData

Import entity data into DigiOffice (v1)

Requires Authentication
The following routes are available for this service:
PUT/api/importdata
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class ImportResult implements IConvertible
{
    int? TotalRows;
    int? TotalAdded;
    int? TotalUpdated;
    int? SuccesfullRows;
    int? ErrorRows;
    List<String>? Errors;

    ImportResult({this.TotalRows,this.TotalAdded,this.TotalUpdated,this.SuccesfullRows,this.ErrorRows,this.Errors});
    ImportResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        TotalRows = json['TotalRows'];
        TotalAdded = json['TotalAdded'];
        TotalUpdated = json['TotalUpdated'];
        SuccesfullRows = json['SuccesfullRows'];
        ErrorRows = json['ErrorRows'];
        Errors = JsonConverters.fromJson(json['Errors'],'List<String>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'TotalRows': TotalRows,
        'TotalAdded': TotalAdded,
        'TotalUpdated': TotalUpdated,
        'SuccesfullRows': SuccesfullRows,
        'ErrorRows': ErrorRows,
        'Errors': JsonConverters.toJson(Errors,'List<String>',context!)
    };

    getTypeName() => "ImportResult";
    TypeContext? context = _ctx;
}

class ImportField implements IConvertible
{
    String? Name;
    String? Value;

    ImportField({this.Name,this.Value});
    ImportField.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Value = json['Value'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Value': Value
    };

    getTypeName() => "ImportField";
    TypeContext? context = _ctx;
}

class Row implements IConvertible
{
    List<ImportField>? Fields;

    Row({this.Fields});
    Row.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Fields = JsonConverters.fromJson(json['Fields'],'List<ImportField>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Fields': JsonConverters.toJson(Fields,'List<ImportField>',context!)
    };

    getTypeName() => "Row";
    TypeContext? context = _ctx;
}

class FixedValue implements IConvertible
{
    String? Name;
    String? Value;

    FixedValue({this.Name,this.Value});
    FixedValue.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Value = json['Value'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Value': Value
    };

    getTypeName() => "FixedValue";
    TypeContext? context = _ctx;
}

/**
* Import entity data into DigiOffice (v1)
*/
// @Api(Description="Import entity data into DigiOffice (v1)")
class ImportData implements IConvertible
{
    /**
    * Entityname in which the data will be imported
    */
    // @ApiMember(Description="Entityname in which the data will be imported", IsRequired=true)
    String? EntityType;

    /**
    * Reports errors with a reference to this field (for example ID)
    */
    // @ApiMember(Description="Reports errors with a reference to this field (for example ID)")
    String? ErrorField;

    /**
    * Should import continue on errors? (Default true)
    */
    // @ApiMember(Description="Should import continue on errors? (Default true)")
    bool? ContinueOnError;

    /**
    * Rows to be imported
    */
    // @ApiMember(Description="Rows to be imported", IsRequired=true)
    List<Row>? Rows = [];

    /**
    * Additional values to be imported on every row
    */
    // @ApiMember(Description="Additional values to be imported on every row")
    List<FixedValue>? FixedValues;

    ImportData({this.EntityType,this.ErrorField,this.ContinueOnError,this.Rows,this.FixedValues});
    ImportData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        EntityType = json['EntityType'];
        ErrorField = json['ErrorField'];
        ContinueOnError = json['ContinueOnError'];
        Rows = JsonConverters.fromJson(json['Rows'],'List<Row>',context!);
        FixedValues = JsonConverters.fromJson(json['FixedValues'],'List<FixedValue>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'EntityType': EntityType,
        'ErrorField': ErrorField,
        'ContinueOnError': ContinueOnError,
        'Rows': JsonConverters.toJson(Rows,'List<Row>',context!),
        'FixedValues': JsonConverters.toJson(FixedValues,'List<FixedValue>',context!)
    };

    getTypeName() => "ImportData";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'test_do_services.klokgroep.nl', types: <String, TypeInfo> {
    'ImportResult': TypeInfo(TypeOf.Class, create:() => ImportResult()),
    'ImportField': TypeInfo(TypeOf.Class, create:() => ImportField()),
    'Row': TypeInfo(TypeOf.Class, create:() => Row()),
    'List<ImportField>': TypeInfo(TypeOf.Class, create:() => <ImportField>[]),
    'FixedValue': TypeInfo(TypeOf.Class, create:() => FixedValue()),
    'ImportData': TypeInfo(TypeOf.Class, create:() => ImportData()),
    'List<Row>': TypeInfo(TypeOf.Class, create:() => <Row>[]),
    'List<FixedValue>': TypeInfo(TypeOf.Class, create:() => <FixedValue>[]),
});

Dart ImportData DTOs

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

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<ImportData xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/IDB.API.General">
  <ContinueOnError>false</ContinueOnError>
  <EntityType>String</EntityType>
  <ErrorField>String</ErrorField>
  <FixedValues>
    <ImportData.FixedValue>
      <Name>String</Name>
      <Value>String</Value>
    </ImportData.FixedValue>
  </FixedValues>
  <Rows>
    <ImportData.Row>
      <Fields>
        <ImportData.ImportField>
          <Name>String</Name>
          <Value>String</Value>
        </ImportData.ImportField>
      </Fields>
    </ImportData.Row>
  </Rows>
</ImportData>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ImportResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/IDB.API.General">
  <ErrorRows>0</ErrorRows>
  <Errors xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </Errors>
  <SuccesfullRows>0</SuccesfullRows>
  <TotalAdded>0</TotalAdded>
  <TotalRows>0</TotalRows>
  <TotalUpdated>0</TotalUpdated>
</ImportResult>