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 .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

{"TotalRows":0,"TotalAdded":0,"TotalUpdated":0,"SuccesfullRows":0,"ErrorRows":0,"Errors":["String"]}