2022-10-29 Example Import Data feed and config

From Izara Wiki
Revision as of 00:46, 3 November 2022 by Mint (talk | contribs)
Jump to navigation Jump to search

Service - Import Data

Overview

Sample for importing a DeliveryMethod, RateTable (including versioned data), and location nodes for both from (DeliveryMethod) and to (rateTable - multiple) relationships.

  • DeliveryMethod must be created before RateTable
  • DeliveryMethod's from LocationNode must be created before DeliveryMethod
  • to LocationNodes can be created at same time as (or before) RateTable

example Config table items

{
	configKey: "objectType",
	configTag: "deliveryMethodStandard"
	configValue: {
		createObjectServiceName: "DeliveryMethodStandard",
		parentLinks: {
			"locationNode": {
				"fromLocationNode": {
					linkType: "Dependent",
					createLinkServiceNames: "DeliveryMethodStandard",
				},
			},
		},
		childObjectTypes:[
			"deliveryMethodRateTable",
		]
	}
},
{
	configKey: "objectType",
	configTag: "deliveryMethodRateTable"
	configValue: {
		createObjectServiceName: "DeliveryMethodStandard", //?
		parentLinks: {
			"locationNode": {
				"toLocationNode": {
					linkType: "Independent",
					createLinkServiceNames: "DeliveryMethodRateTable",
				},
			},
			"deliveryMethodStandard": {
				"ownsRateTable": {
					linkType: "Dependent",
					createLinkServiceNames: "DeliveryMethodStandard",
				},
			},
		},
		childObjectTypes:[
		]
	}
},
{
	configKey: "objectType",
	configTag: "locationNode"
	configValue: {
		createObjectServiceName: "Locations",
		parentLinks: {
		},
		childObjectTypes:[
			"deliveryMethodStandard",
			"deliveryMethodRateTable"
		]
	}
},

example

PendingObjectMain

{
	importBatchId: "xx",
	objectId: "aa",
	objectType: "deliveryMethodStandard",
	fields: {
		deliveryMethodName: [
			{
              "en": "Post Office",
			  "th": "Braisanee"
            }
		],
	},
	reference: "delMeth",
	recordNumber: 1,
	status: "processing",
	errorsFound: {},
},
{
	importBatchId: "xx",
	objectId: "bb",
	objectType: "deliveryMethodRateTable",
	fields: {
		rates: [
			//..
		],
	},
	recordNumber: 2,
	status: "processing",
	errorsFound: {}
},
{
	importBatchId: "xx",
	objectId: "cc",
	objectType: "locationNode",
	fields: {
		locationName: [
			{
              "en": "Chiang Mai",
			  "th": "เชียงใหม่"
            }
		],
	},
	recordNumber: 3,
	status: "processing",
	errorsFound: {}
},
{
	importBatchId: "xx",
	objectId: "dd",
	objectType: "locationNode",
	fields: {
		locationName: [
			{
              "en": "Bangkok",
			  "th": "กรุงเทพฯ"
            }
		],
	},
	recordNumber: 4,
	status: "processing",
	errorsFound: {}
},
{
	importBatchId: "xx",
	objectId: "ee",
	objectType: "locationNode",
	fields: {
		locationName: [
			{
              "en": "UdonThani",
			  "th": "อุดรธานี"
            }
		],
	},
	recordNumber: 4,
	status: "processing",
	errorsFound: {}
},

PendingObjectReference

{
	importBatchId: "xx",
	referenceId: "delMeth",
	objectId: "aa"
},
{
	importBatchId: "xx",
	referenceId: "fromLoc",
	objectId: "cc"
},
{
	importBatchId: "xx",
	referenceId: "toLocA",
	objectId: "dd"
},
{
	importBatchId: "xx",
	referenceId: "toLocB",
	objectId: "ee"
},

PendingLink

{
	importBatchId: "xx",
	pendingLinkId: "bb_delMeth",
	linkTag: "ownsRateTable"
	status: "processing",
},
{
	importBatchId: "xx",
	pendingLinkId: "aa_fromLoc",
	linkTag: "fromLocationNode"
	status: "processing",
},
{
	importBatchId: "xx",
	pendingLinkId: "bb_toLocA",
	linkTag: "toLocationNode"
	status: "processing",
},
{
	importBatchId: "xx",
	pendingLinkId: "bb_toLocB",
	linkTag: "toLocationNode"
	status: "processing",
},