Platform Subscription API

<back to all web services

ImportXml

Requires Authentication
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class ImportXml implements JsonSerializable
{
    public function __construct(
        /** @description XML string (encoded to base 64) containing data to import into EROS from external system. */
        // @ApiMember(DataType="string", Description="XML string (encoded to base 64) containing data to import into EROS from external system.", Name="XmlToImport", ParameterType="query")
        /** @var string|null */
        public ?string $XmlToImport=null,

        /** @description Guid representing the external systems datasource information. */
        // @ApiMember(DataType="Guid", Description="Guid representing the external systems datasource information.", Name="SuiteDataSourceInstanceId", ParameterType="query")
        /** @var string */
        public string $SuiteDataSourceInstanceId='',

        /** @description Import data type. */
        // @ApiMember(DataType="Guid", Description="Import data type.", Name="ImportTypeId", ParameterType="query")
        /** @var string */
        public string $ImportTypeId='',

        /** @description Data collected from foreign system falls within now and this date. */
        // @ApiMember(DataType="DateTime", Description="Data collected from foreign system falls within now and this date.", Name="CollectionDate", ParameterType="query")
        /** @var DateTime */
        public DateTime $CollectionDate=new DateTime(),

        /** @description Bin Row Version of the last update */
        // @ApiMember(DataType="byte[]", Description="Bin Row Version of the last update", Name="RowVersion", ParameterType="query")
        /** @var ByteArray|null */
        public ?ByteArray $RowVersion=null,

        /** @description If true, previous failed import attempts will be removed. */
        // @ApiMember(DataType="bool", Description="If true, previous failed import attempts will be removed.", Name="RemovePreviousAttempts", ParameterType="query")
        /** @var bool|null */
        public ?bool $RemovePreviousAttempts=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['XmlToImport'])) $this->XmlToImport = $o['XmlToImport'];
        if (isset($o['SuiteDataSourceInstanceId'])) $this->SuiteDataSourceInstanceId = $o['SuiteDataSourceInstanceId'];
        if (isset($o['ImportTypeId'])) $this->ImportTypeId = $o['ImportTypeId'];
        if (isset($o['CollectionDate'])) $this->CollectionDate = JsonConverters::from('DateTime', $o['CollectionDate']);
        if (isset($o['RowVersion'])) $this->RowVersion = JsonConverters::from('ByteArray', $o['RowVersion']);
        if (isset($o['RemovePreviousAttempts'])) $this->RemovePreviousAttempts = $o['RemovePreviousAttempts'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->XmlToImport)) $o['XmlToImport'] = $this->XmlToImport;
        if (isset($this->SuiteDataSourceInstanceId)) $o['SuiteDataSourceInstanceId'] = $this->SuiteDataSourceInstanceId;
        if (isset($this->ImportTypeId)) $o['ImportTypeId'] = $this->ImportTypeId;
        if (isset($this->CollectionDate)) $o['CollectionDate'] = JsonConverters::to('DateTime', $this->CollectionDate);
        if (isset($this->RowVersion)) $o['RowVersion'] = JsonConverters::to('ByteArray', $this->RowVersion);
        if (isset($this->RemovePreviousAttempts)) $o['RemovePreviousAttempts'] = $this->RemovePreviousAttempts;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ImportXml DTOs

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

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/ImportXml HTTP/1.1 
Host: production-eros-platform-apisubscription.azurewebsites.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	XmlToImport: String,
	CollectionDate: 0001-01-01,
	RowVersion: AA==,
	RemovePreviousAttempts: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ErrorCode: String,
	Message: String,
	StackTrace: String,
	Errors: 
	[
		{
			ErrorCode: String,
			FieldName: String,
			Message: String,
			Meta: 
			{
				String: String
			}
		}
	],
	Meta: 
	{
		String: String
	}
}