//EXAMPLE PSUEDO CODE used to upload master data for
//specific application area for specific mobile user
void generateMobileUserMasterData(string appArea, string restApiKey, string userName) {
DataTable customers = extractDataForTable('Customers',mobileUser);
DataTable = extractDataForTable('Products',mobileUser);
DataTable = extractDataForTable('Inventory',mobileUser);
//... do this for all tables which has to be sent to the mobile user
const PushAPIUrl = 'https://api.portal.dynamicsmobile.com/erp/push/'+appArea+'/'+mobileUser;
//prepare XML sync packet from the prepared data
const syncPacketInXml = prepareDynamicsMobileSyncPacketFrom(customers, products, inventory);
//retreive temporary upload path from the REST api
const tempUploadUrl = await callRestApiWithGet(PushAPIUrl,restApiKey);
//use the reveived temporary url to upload the packet content
await callRestApiWithPut(tempUploadUrl, syncPacketInXml);
DataTable extractDataForTable(string tableName, string mobileUser) {
using(SqlConnection connection = new SqlConnection()){
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand cmd = conn.CreateCommand();
//thinks about reducing the exteacted data by filtering the dataset over
//username or/and period of activity
cmd.CommandText = "SELECT * FROM "+tableName+" ORDER BY NAME"