Synchronization Packet Format
Well-structured JSON or XML content used to exchange data between applications

Overview

The ERP API is built around the concept for exchange of Synchronization Packets. Each synchronization packet contain one or more modified entities together with the actual operation ( insert, update, delete) .
The Dynamics Mobile Platform can return the Synchronization packets in one of the following formats:
  • xml
  • json
The ERP, which consumes the integration REST API must specify the actual packet format on every API call.
Both formats use the same concept.

Sync Packet XML Format

Following example of sync packet in XML format The packet contains 3 entities/tables (Customers, Products, Inventory) each of them with 3 records. All of the records are with status insert - e.g. the sync packet contains new data
<NavMobileSync salesmancode="myUser">
<table tablename="Customers">
<r status="insert">
<DMS_ROWID>123e4567-e89b-12d3-a456-426614174001<DMS_ROWID>
<No>CU-001</No>
<Name>Blue shop</Name>
<Address>123 Blue street</Address>
</r>
<r status="insert">
<DMS_ROWID>456e4567-e89b-12d3-a456-426614174002<DMS_ROWID>
<No>CU-002</No>
<Name>Green shop</Name>
<Address>123 Green street</Address>
</r>
<r status="insert">
<DMS_ROWID>789e4567-e89b-12d3-a456-426614174003<DMS_ROWID>
<No>CU-003</No>
<Name>Yellow shop</Name>
<Address>123 Yellow street</Address>
</r>
</table>
<table tablename="Products">
<r status="insert">
<DMS_ROWID>123e4567-e89b-12d3-a456-426614174012<DMS_ROWID>
<ProductId>P0001</ProductId>
<Name>Green apples</Name>
<Price>11.00</Price>
</r>
<r status="insert">
<ProductId>P0002</ProductId>
<DMS_ROWID>456e4567-e89b-12d3-a456-426614175000<DMS_ROWID>
<Name>Oranges</Name>
<Price>23.00</Price>
</r>
<r status="insert">
<DMS_ROWID>789e4567-e89b-12d3-a456-426614176000<DMS_ROWID>
<ProductId>P0003</ProductId>
<Name>Banana</Name>
<Price>21.00</Price>
</r>
</table>
<table tablename="Inventory">
<r status="insert">
<DMS_ROWID>123e4567-e89b-12d3-a456-426614177000<DMS_ROWID>
<ProductId>P0001</ProductId>
<Quantity>100.00</Quantity>
</r>
<r status="insert">
<DMS_ROWID>456e4567-e89b-12d3-a456-42661417800<DMS_ROWID>
<ProductId>P0002</ProductId>
<Quantity>150.00</Quantity>
</r>
<r status="insert">
<DMS_ROWID>789e4567-e89b-12d3-a456-426614179000<DMS_ROWID>
<ProductId>P0001</ProductId>
<Quantity>320.00</Quantity>
</r>
</table>
</syncpacket>
Please see the below section for step-by-step description of the XML format:
//everything is wrapped in root xml element called NavMobileSync, having required
attribute salesmancode, which contains the name of the user, who is generating or receiving
the sync packet
<NavMobileSync salesmancode="myUser">
....
<NavMobileSync>
//The NavMobileSync xml element must contain one or more table xml elements.
//Every table element represent a table/entity which is begin synchronized and must have required attribute tablename, which contains the name of the
//entity which is being synchronized. The receiving party shall decide to which native entity/table
//it correspond. The tablename must be unique in the xml format of the sync packet
<NavMobileSync salesmancode="myUser">
<table tablename="MyTable">
...
</table>
<NavMobileSync>
//every table xml element must have one or more r xml elements, which represent the records
//being synchronized for each entity/table
//The r element must have attribute status, where it may have on of the following values:
- insert - indicates that the record/object was inserted in the source system
- update - indicates that the record/object was updated in the source system
- delete - indicates that the record/object was deleted from the source system
<NavMobileSync salesmancode="myUser">
<table tablename="MyTable">
<r status="insert">
...
</r>
<r status="insert">
...
</r>
</table>
<NavMobileSync>
//Each r xml element must contain one or more xml elements, where each element represents
//the value for entity/table field. Please note that if a field has value of null/undefined
//it must not be included in the sync packet
<NavMobileSync salesmancode="myUser">
<table tablename="MyTable">
<r status="insert">
<DMS_ROWID>....</DMS_ROWID>
<state>...</state>
<No>......</No>
<Name>.....<Name>
</r>
<r status="insert">
<DMS_ROWID>...</DMS_ROWID>
<state>...</state>
<No>......</No>
<Name>.....<Name>
</r>
</table>
<NavMobileSync>
//Dynamics Mobile entities has several built-in properties for each entity, which means that
//the following tags will be presented in the sync packet:
DMS_ROWID - unique primary key identifier of the record.
state - the state of the record. 1 - inserted, 2 - updated, 3 - deleted

Sync Packet JSON Format

Following example of sync packet in JSON format The packet contains 3 entities/tables (Customers, Products, Inventory) each of them with 3 records. All of the records are with status insert - e.g. the sync packet contains new data
[
{
"@status":"inserted",
"DMS_ROWID":"123e4567-e89b-12d3-a456-426614174001",
"No": "CU-001",
"Name": "Blue shop",
"Address": "123 Blue street",
"className": "Customers",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"223e4567-e89b-12d3-a456-426614174001",
"No": "CU-002",
"Name": "Green shop",
"Address": "123 Green street",
"className": "Customers",
"state": 1
}
{
"@status":"inserted",
"DMS_ROWID":"323e4567-e89b-12d3-a456-426614174001",
"No": "CU-003",
"Name": "Yellow shop",
"Address": "123 Yellow street",
"className": "Customers",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"423e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0001",
"Name": "Green apples",
"Price": 11.00,
"className": "Products",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"523e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0002",
"Name": "Oranges",
"Price": 23.00,
"className": "Products",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"623e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0003",
"Name": "Banana",
"Price": 21.00,
"className": "Products",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"723e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0001",
"Quantity": 100.00,
"className": "Inventory",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"823e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0001",
"Quantity": 150.00,
"className": "Inventory",
"state": 1
},
{
"@status":"inserted",
"DMS_ROWID":"923e4567-e89b-12d3-a456-426614174001",
"ProductId": "P0001",
"Quantity": 320.00,
"className": "Inventory",
"state": 1
}
]
//Dynamics Mobile entities has several built-in properties for each entity, which means that //the following tags will be presented in the sync packet:
DMS_ROWID - unique primary key identifier of the record. state - the state of the record. 1 - inserted, 2 - updated, 3 - deleted
Please see the below section for step-by-step description of the XML format:
//the format is a JSON array of items, where each item represent a record.
[
{
...
},
{
...
}
]
//every record has several built-in properties like:
// - @status - may have one of the following values: insert, update, delete
// - DMS_ROWID: string(guid) - system primary key of the record
// - className: string - the name of the entity (table) where the record exists
// - state:number - may have one of the following values: 1 - insert, 2 - update, 3 -delete
[
{
"@status":"inserted",
"DMS_ROWID":"223e4567-e89b-12d3-a456-426614174001",
"className": "Customers",
"state": 1,
...
},
{
"@status":"inserted",
"DMS_ROWID":"333e4567-e89b-12d3-a456-426614174001",
"className": "Customers",
"state": 1,
...
},
{
"@status":"inserted",
"DMS_ROWID":"443e4567-e89b-12d3-a456-426614174001",
"className": "Products",
"state": 1,
...
}
]
// every record may have additional custom properties. Please note that if a property has a value
// of null, the propery is not included in the Sync Packet
[
{
"@status":"inserted",
"DMS_ROWID":"223e4567-e89b-12d3-a456-426614174001",
"className": "Customers",
"state": 1,
"Name":"Customer1",
"ID": "0001"
},
{
"@status":"inserted",
"DMS_ROWID":"333e4567-e89b-12d3-a456-426614174001",
"className": "Customers",
"state": 1,
"Name":"Customer2",
"ID": "0002"
},
{
"@status":"inserted",
"DMS_ROWID":"443e4567-e89b-12d3-a456-426614174001",
"className": "Products",
"state": 1,
"Name":"Customer3",
"ID": "0004"
}
]