How to Send Custom XML Orders to Vendors via FTP

Francesco de Lorenzi
Francesco de Lorenzi
  • Updated

When integrating the order automation with a vendor, it may be required to generate XML files and upload them to an FTP space. Jetti fully supports this scenario.
By default, it is possible to upload Jetti's XML order in the standard format offered by the platform.
However, Jetti makes it possible to convert the default XML Order to a different document thanks to a customized XSL stylesheets.
This article will describe how to configure the Dropship Provider settings as well perform the mapping with a custom XSLT template.


API Template Creation

The first step to perform within Jetti is to create an API template.

This can be done by accessing Setup -> API Templates -> New Template. In the next screen, the settings will need to be set up as follows:
Default mapping: Custom
Select the type of data to export: DROPSHIP PURCHASE ITEMS
File Format: XML
Content: the XSL template can be pasted

 

XSL Template

In order to create an XSL template, it is important to have the source XML document available. The following XML document shows the default XML document that Jetti generates for a generic Purchase Order with reference 1007-01.

<?xml version='1.0'?>
<purchase>
<data>
<billingFullName>Mario Rossi</billingFullName>
<inventoryStatus>shipped</inventoryStatus>
<isDropship>true</isDropship>
<shippingFullName>Mario Rossi</shippingFullName>
<shippingExpectedAt></shippingExpectedAt>
<deliveryExpectedAt></deliveryExpectedAt>
<paymentExpectedAt></paymentExpectedAt>
<total>0</total>
<subtotal>0</subtotal>
<discounts>0</discounts>
<tax>0</tax>
<combinedTaxRate>0.0000</combinedTaxRate>
<billingName>shopi-inter</billingName>
<billingAddressLineOne>Via Andrea da Bari</billingAddressLineOne>
<billingAddressLineTwo></billingAddressLineTwo>
<billingCity>Bari</billingCity>
<billingState>BA</billingState>
<billingCountry>IT</billingCountry>
<billingZip>70100</billingZip>
<shippingName></shippingName>
<shippingAddressLineOne>Via Paolo Sarpi</shippingAddressLineOne>
<shippingAddressLineTwo></shippingAddressLineTwo>
<shippingCity>Milano</shippingCity>
<shippingState>Milano</shippingState>
<shippingCountry>IT</shippingCountry>
<shippingZip>20154</shippingZip>
<receiverName></receiverName>
<receiverAddressLineOne></receiverAddressLineOne>
<receiverAddressLineTwo></receiverAddressLineTwo>
<receiverCity></receiverCity>
<receiverState></receiverState>
<receiverCountry></receiverCountry>
<receiverZip></receiverZip>
<id>1042531</id>
<companyId>2729</companyId>
<userId></userId>
<priceListId>3172</priceListId>
<warehouseId></warehouseId>
<vendorId></vendorId>
<dropshipProviderId>17757</dropshipProviderId>
<dropshipProviderAddressId></dropshipProviderAddressId>
<purchaseId></purchaseId>
<saleId>2177703</saleId>
<purchaseStatusId></purchaseStatusId>
<purchaseImportExternalId></purchaseImportExternalId>
<files></files>
<lastPurchaseInvoiceReference>1</lastPurchaseInvoiceReference>
<lastDropshipmentReference>1</lastDropshipmentReference>
<lastGoodsReceiptReference>0</lastGoodsReceiptReference>
<purchaseType>automated_dropship</purchaseType>
<shipmentRouting>customer</shipmentRouting>
<dropshipNotes></dropshipNotes>
<approved>true</approved>
<vendorReference></vendorReference>
<vendorReceivedStatus>received</vendorReceivedStatus>
<labelProblem></labelProblem>
<orderProblem></orderProblem>
<internalReference></internalReference>
<vendorReceivedId>3690197745000</vendorReceivedId>
<vendorReceivedReference>#1007</vendorReceivedReference>
<vendorEndpointFormat>json</vendorEndpointFormat>
<vendorEndpointResponse></vendorEndpointResponse>
<vendorEndpointHeaders></vendorEndpointHeaders>
<reminderSent>false</reminderSent>
<reminderLastSent></reminderLastSent>
<shippingRateError></shippingRateError>
<orderSplitting>group</orderSplitting>
<splitTag></splitTag>
<orderSplittingKey></orderSplittingKey>
<adjustmentReasonId></adjustmentReasonId>
<reference>1007-01</reference>
<locked>false</locked>
<finalized>true</finalized>
<cancelled>false</cancelled>
<cancelledAt></cancelledAt>
<dateOrdered>2021-03-24T17:34:43+00:00</dateOrdered>
<taxCalculation>default</taxCalculation>
<taxShipping>true</taxShipping>
<taxIncluded>true</taxIncluded>
<weight>0</weight>
<quantity>0</quantity>
<stateTaxRate></stateTaxRate>
<cityTaxRate></cityTaxRate>
<countyTaxRate></countyTaxRate>
<districtTaxRate></districtTaxRate>
<stateTaxLocation></stateTaxLocation>
<cityTaxLocation></cityTaxLocation>
<countyTaxLocation></countyTaxLocation>
<paymentStatus>notPaid</paymentStatus>
<invoiceStatus>invoiced</invoiceStatus>
<returnStatus>returned</returnStatus>
<cancellationStatus>full</cancellationStatus>
<notes></notes>
<customerReference></customerReference>
<tags></tags>
<billingFirstName>Mario</billingFirstName>
<billingLastName>Rossi</billingLastName>
<shippingFirstName>Mario</shippingFirstName>
<shippingLastName>Rossi</shippingLastName>
<invalidShippingAddress>false</invalidShippingAddress>
<shippingAddressMessage>false</shippingAddressMessage>
<invalidBillingAddress>false</invalidBillingAddress>
<billingAddressMessage></billingAddressMessage>
<createdAt>2021-03-24T17:34:43+00:00</createdAt>
<updatedAt>2021-05-04T07:11:07+00:00</updatedAt>
<muteError>false</muteError>
<adminNotes></adminNotes>
<intercomMessageId></intercomMessageId>
<dropship_provider>
<name>Shopi Drop</name>
<id>17757</id>
</dropship_provider>
<purchase_shipping_rates>
<price>5</price>
<id>1262043</id>
<purchaseId>1042531</purchaseId>
<days></days>
<durationTerms></durationTerms>
<ratePurpose>label</ratePurpose>
<provider></provider>
<purchaseInvoiceId></purchaseInvoiceId>
<serviceLevel></serviceLevel>
<serviceLevelTerms></serviceLevelTerms>
<serviceLevelToken></serviceLevelToken>
</purchase_shipping_rates>
<dropshipments>
<id>1393830</id>
<purchaseId>1042531</purchaseId>
<reference>1007-01-01</reference>
<createdAt>2021-08-17T09:17:15+00:00</createdAt>
</dropshipments>
<purchase_invoices>
<paid>0</paid>
<id>1072176</id>
<purchaseId>1042531</purchaseId>
<reference>1007-01-01</reference>
</purchase_invoices>
<sale>
<billingFullName>Mario Rossi</billingFullName>
<shippingFullName>Mario Rossi</shippingFullName>
<displayName>1007</displayName>
<total>0</total>
<subtotal>0</subtotal>
<discounts>0</discounts>
<tax>0</tax>
<combinedTaxRate>0.0000</combinedTaxRate>
<billingName></billingName>
<billingAddressLineOne>Via Paolo Sarpi</billingAddressLineOne>
<billingAddressLineTwo></billingAddressLineTwo>
<billingCity>Milano</billingCity>
<billingState>Milano</billingState>
<billingCountry>IT</billingCountry>
<billingZip>20154</billingZip>
<shippingName></shippingName>
<shippingAddressLineOne>Via Paolo Sarpi</shippingAddressLineOne>
<shippingAddressLineTwo></shippingAddressLineTwo>
<shippingCity>Milano</shippingCity>
<shippingState>Milano</shippingState>
<shippingCountry>IT</shippingCountry>
<shippingZip>20154</shippingZip>
<receiverName></receiverName>
<receiverAddressLineOne></receiverAddressLineOne>
<receiverAddressLineTwo></receiverAddressLineTwo>
<receiverCity></receiverCity>
<receiverState></receiverState>
<receiverCountry></receiverCountry>
<receiverZip></receiverZip>
<id>2177703</id>
<reference>1007</reference>
<externalId>3693462028482</externalId>
<dateOrdered>2021-03-24T17:30:00+00:00</dateOrdered>
<cancellationStatus>full</cancellationStatus>
<returnStatus>returned</returnStatus>
<inventoryStatus>fulfilled</inventoryStatus>
<stateTaxRate></stateTaxRate>
<countyTaxRate></countyTaxRate>
<cityTaxRate></cityTaxRate>
<districtTaxRate></districtTaxRate>
<taxShipping>true</taxShipping>
<taxIncluded>true</taxIncluded>
<billingFirstName>Mario</billingFirstName>
<billingLastName>Rossi</billingLastName>
<shippingFirstName>Mario</shippingFirstName>
<shippingLastName>Rossi</shippingLastName>
<customer>
<email>mrossi123@domain.com</email>
<firstName>Mario</firstName>
<lastName>Rossi</lastName>
<phone></phone>
</customer>
<channel>
<name>shopi-inter</name>
<salePrefix></salePrefix>
<purchasePrefix></purchasePrefix>
<price_list>
<name>Online store</name>
<currency>
<iso>USD</iso>
<exchangeRate>1</exchangeRate>
</currency>
</price_list>
</channel>
</sale>
<purchase_items>
<price>5</price>
<subtotal>5</subtotal>
<id>1438183</id>
<purchaseId>1042531</purchaseId>
<saleItemId>4162377</saleItemId>
<companyId>2729</companyId>
<variantId>7290781</variantId>
<inventoryProcessed>1</inventoryProcessed>
<name>Test</name>
<quantity>1</quantity>
<quantityInvoiced>1</quantityInvoiced>
<taxable>false</taxable>
<variant>
<lowInventoryQuantity></lowInventoryQuantity>
<displayName>39412060225730</displayName>
<costPrice>0</costPrice>
<commissionRate>0</commissionRate>
<id>7290781</id>
<barcode></barcode>
<grams>0</grams>
<sku>39412060225730</sku>
<taxable>true</taxable>
<vendorSku></vendorSku>
<inventory_feed_variants>
<vendorSku>123123123</vendorSku>
</inventory_feed_variants>
<vendor>
<name>shopi-inter</name>
<fulfillmentPolicy>dropship</fulfillmentPolicy>
</vendor>
<product>
<name>Test</name>
</product>
</variant>
<sale_item>
<price>5</price>
<subtotal>5</subtotal>
<bundleSaleItemId></bundleSaleItemId>
<channelCompareAtPrice>0.00</channelCompareAtPrice>
<channelPrice>5.00</channelPrice>
<companyId>2729</companyId>
<discount>0.00</discount>
<id>4162377</id>
<inventoryProcessed>1</inventoryProcessed>
<isBundle>false</isBundle>
<name>Test</name>
<quantity>1</quantity>
<quantityCancelled>0</quantityCancelled>
<quantityInvoiced>1</quantityInvoiced>
<quantityReturned>1</quantityReturned>
<saleId>2177703</saleId>
<taxable>true</taxable>
<variantId>7290781</variantId>
</sale_item>
</purchase_items>
</data>
</purchase>


For demonstration purposes, it is assumed that the vendor requires the XML file to be in the following format.

<?xml version="1.0" encoding="UTF-8"?>
<Order>
<OrderDate>2021-03-24T17:34:43+00:00</OrderDate>
<Reference>1007-01</Reference>
<BillingFirstName>Mario</BillingFirstName>
<BillingLastName>Rossi</BillingLastName>
<BillingName>shopi-inter</BillingName>
<BillingAddressLineOne>Via Andrea da Bari</BillingAddressLineOne>
<BillingAddressLineTwo/>
<BillingZipCode>70100</BillingZipCode>
<BillingCity>Bari</BillingCity>
<BillingCountry>IT</BillingCountry>
<ShippingFirstName>Mario</ShippingFirstName>
<ShippingLastName>Rossi</ShippingLastName>
<ShippingName/>
<ShippingAddressLineOne>Via Paolo Sarpi</ShippingAddressLineOne>
<ShippingAddressLineTwo/>
<ShippingZipCode>20154</ShippingZipCode>
<ShippingCity>Milano</ShippingCity>
<ShippingCountry>IT</ShippingCountry>
<EmailAddress>mrossi123@domain.com</EmailAddress>
<OrderItem>
<ProductCode>123123123</ProductCode>
<Quantity>1</Quantity>
</OrderItem>
</Order>

The below XSL stylesheet allows to generate the XML order file according to the specified format.

Thanks to the xsl:value-of element and XPath queries, it is possible to map the necessary fields.

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="/">
<Order>
<OrderDate><xsl:value-of select="purchase/data/dateOrdered"/></OrderDate>
<Reference><xsl:value-of select="purchase/data/reference"/></Reference>
<BillingFirstName><xsl:value-of select="purchase/data/billingFirstName"/></BillingFirstName>
<BillingLastName><xsl:value-of select="purchase/data/billingLastName"/></BillingLastName>
<BillingName><xsl:value-of select="purchase/data/billingName"/></BillingName>
<BillingAddressLineOne><xsl:value-of select="purchase/data/billingAddressLineOne"/></BillingAddressLineOne>
<BillingAddressLineTwo><xsl:value-of select="purchase/data/billingAddressLineTwo" /></BillingAddressLineTwo>
<BillingZipCode><xsl:value-of select="purchase/data/billingZip"/></BillingZipCode>
<BillingCity><xsl:value-of select="purchase/data/billingCity"/></BillingCity>
<BillingCountry><xsl:value-of select="purchase/data/billingCountry"/></BillingCountry>
<ShippingFirstName><xsl:value-of select="purchase/data/shippingFirstName"/></ShippingFirstName>
<ShippingLastName><xsl:value-of select="purchase/data/shippingFirstName"/></ShippingLastName>
<ShippingName><xsl:value-of select="purchase/data/shippingName"/></ShippingName>
<ShippingAddressLineOne><xsl:value-of select="purchase/data/shippingAddressLineOne"/></ShippingAddressLineOne>
<ShippingAddressLineTwo><xsl:value-of select="purchase/data/shippingAddressLineTwo" /></ShippingAddressLineTwo>
<ShippingZipCode><xsl:value-of select="purchase/data/shippingZip"/></ShippingZipCode>
<ShippingCity><xsl:value-of select="purchase/data/shippingCity"/></ShippingCity>
<ShippingCountry><xsl:value-of select="purchase/data/shippingCountry"/></ShippingCountry>
<EmailAddress><xsl:value-of select="purchase/data/sale/customer/email"/></EmailAddress>
<xsl:for-each select="purchase/data/purchase_items">
<OrderItem>
<ProductCode><xsl:value-of select="variant/inventory_feed_variants/vendorSku[1]"/></ProductCode>
<Quantity><xsl:value-of select="quantity"/></Quantity>
</OrderItem>
</xsl:for-each>
</Order>
</xsl:template>
</xsl:stylesheet>

After saving the API Template, it is possible to test the XSL document against any of the available purchase orders. Jetti will return the generated XML document.

Dropship Provider Configuration

The Dropship Provider, under Orders, will need to be set up as follows:
Full Order Automation: FTP
Order Endpoint url: ftp://user:password@domain.com

Order Endpoint path: /folder/{{reference}}.xml - {{reference}} will be replaced with Jetti's Purchase Order reference
Generate  a CSV or XML file: Create a custom template
Order template:  previously created API template Image 2021-08-19 at 1.04.27 AM

It will be possible to test the Order template again against any Purchase Order. This can be done by selecting a purchase from "Select Purchase to Preview"

Once the settings are saved, new Purchase Orders associated to the Dropship Providers will start triggering the XML document generation and the subsequent FTP upload.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.