Skip to content

Magnetic HQ XML

To integrate with Magnetic HQ using Zynk you will need to import and export data using XML. The objects and fields match the Magnetic HQ API, but use XML rather than JSON, and element names start with a capital letter (Name in XML is name in the API).

Further detail on the XML object model can be found below:

Root Element

Every task reads and writes the same root element, MagneticHQData. Only the collection for the task you are running is used.

Element Child Element Used By
Customers Customer Export Customers, Import Customers
Suppliers Supplier Export Suppliers, Import Suppliers
PurchaseOrders PurchaseOrder Export Purchase Orders, Import Purchase Orders
TaxInvoices TaxInvoice Export Tax Invoices, Import Tax Invoices
Total Output only. The number of records in the file.
<?xml version="1.0" encoding="utf-8"?>
<MagneticHQData>
  <Customers>
    <Customer>
      <Name>Acme Ltd</Name>
    </Customer>
  </Customers>
</MagneticHQData>

Data Types

Type Format
Dates Milliseconds since 1 January 1970 (UTC), as used by the Magnetic HQ API. For example 1447740000000 is 17 November 2015 06:00 UTC. 0 means no date.
IDs Magnetic HQ's own numeric IDs, for example 53126881.
Boolean true or false.
Decimal A full stop as the decimal separator, for example 14.0.

Custom Fields

Companies, contacts and jobs (groupings) can carry Magnetic HQ custom fields. They are exported in a CustomFields element, one item per field. key is the Magnetic HQ custom field ID.

<CustomFields>
  <item>
    <key>54012345</key>
    <value>Gold</value>
  </item>
  <item>
    <key>54012346</key>
    <value>
      <item>Option A</item>
      <item>Option B</item>
    </value>
  </item>
</CustomFields>

A multi-select value is a list of item elements, as above. A value that is an object has one child element per key. These keys are numeric, so they are encoded to be valid XML names, for example _x0031_23 for 123.

Warning

Custom fields are export only. Any CustomFields you supply on an import are ignored and are not sent to Magnetic HQ.

Matching and the Truth Database

After a successful import Zynk stores the Magnetic HQ ID against the record's ExternalId in the truth database. See each format's page for how existing records are matched.