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
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
//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" } ]