ERP API

Integrate any ERP with the mobile applications by sending and receiving sync packets

Push Sync Packet

GET https://api.portal.dynamicsmobile.com/erp/push/:appArea/:mobileUser

The API is used by the ERP systems to send synchronization packet for specific mobile user. The packet is processed and converted to native mobile data storage format. The mobile user receives push notification that new data is pending, so the user may start the synchronization process from the mobile app.

Path Parameters

NameTypeDescription

appArea

string

The application area code

mobileUser

string

The name of the mobile user, who sends the data packet

Query Parameters

NameTypeDescription

packetUniqueId

string

Unique identifier of the packet. Stored in the cloud and can be used for tracing/issue resolution

size

number

The size of the sync packet in bytes

packetType

string

the format of sync packet content: xml or json

Headers

NameTypeDescription

Content-Type

string

Must have "application/json" value

x-api-key

string

The api key for the application area

//the response must have a field success set to true and uploadPath.
{
  "success": true
  "syncLogId": "xyz-abc-def-001-002-003...", 
  "uploadPath": "https://s3.xyz.abv.abv.q24....................com"
}

//the developer must execute another PUT request with the packet content to upload the packet.

See also : Synchronization Packet Format

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.portal.dynamicsmobile.com/mobile/erp/push/DMDEV01/user1?packetUniqueId=xyz-abc-01&size=32123&packetType=xml',
  'headers': {
    'x-api-key': '12321313'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
 const xmlResponse = response.body;
 //parse reponse and obtain the value if the uploadPath field.
 //use it to upload the packet content via PUT request
});

Pull Sync Packet

GET https://api.portal.dynamicsmobile.com/erp/pull/:appArea

The API is used by the ERP system to receive a list of inbound pending sync packets received from mobile users. The ERP must download each if the packets and then set the packets status to done.

Path Parameters

NameTypeDescription

appArea

string

The application area code

Query Parameters

NameTypeDescription

packetType

string

defines the type of the packets to be pulled. - packet ( default ) - returns only packets - file - returns only files

format

string

the format (xml or json) in which the response will be returned

Headers

NameTypeDescription

Content-Type

string

Must have value of 'application/json'

x-api-key

string

The API key for the application area.

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.portal.dynamicsmobile.com/mobile/erp/pull/DMDEV01?packetType=packet&format=xml',
  'headers': {
    'x-api-key': '12321313'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  const xml = response.body;
  //parse the xml and iterate over the returned list of packets
  
});

GET https://api.portal.dynamicsmobile.com/erp/pull/:appArea/link

The API is used by the ERP system to obtain a temporary sync packet download link. The download must begin in the next 15 minutes ( before the temporary link expires.). This timeout is might change in the future to lower value.

Path Parameters

NameTypeDescription

appArea

string

The application area code

Query Parameters

NameTypeDescription

path

string

the internal cloud storage path of the packet. Can be obtained from the [url] field returned by the Pull Sync Packet API

Headers

NameTypeDescription

Content-Type

string

Must have "application/json" value

x-api-key

string

The api key for the application area

https://s3.xyz.abv.anx.123.com..........................

const appArea = "MyAppArea";
const apiKey = "123456789"; 
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.portal.dynamicsmobile.com/mobile/erp/pull/'+appArea+'/link?path=push_done/MYAPPAREA/2020010101/user1/xyz-abv-d011.xml',
  'headers': {
    'x-api-key': apiKey
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  const downloadUrl = response.body;
  //execute another get request to the url returned in downloadUrl...
  //the downloaded content is a Synchronization Packet Format
});

See also : Synchronization Packet Format

Packet Status Done

POST https://api.portal.dynamicsmobile.com/erp/pull/:appArea/done

The API is used by the ERP to mark one or more packets obtained via the Pull api method as completed (done). This will make sure that the packet will not be returned again on the next call to Pull api method

Path Parameters

NameTypeDescription

appArea

string

The application area code

Query Parameters

NameTypeDescription

format

string

format of the body - xml or json

Headers

NameTypeDescription

Content-Type

string

application/json or application/xml

x-api-key

string

The api key for the application area

Request Body

NameTypeDescription

syncpacket list

array

list of objects where each object represent a successfully processed sync packet with the following fields: id: string receiptHandle: string Both of these fields are returned for each packet by call to Pull Sync Packet

{
 "success":true
}

const contentFormat = "xml";
const apiKey = "123456";
const packetsToMarkAsCompleted = 
 `<messages>
   <message><id>asdasdasd1</id><receiptHandle>abvabc1</receiptHandle>,
   <message><id>asdasdasd2</id><receiptHandle>abvabc2</receiptHandle>
   <message><id>asdasdasd3</id><receiptHandle>abvabc3</receiptHandle>
  <messages>
 `
   
   ,var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.portal.dynamicsmobile.com/mobile/erp/pull/'+appArea+'/done?format='+contentFormat,
  'headers': {
    'x-api-key': apiKey
  }
  'Content-Type': 'application/'+contentFormat
  body: packetsToMarkAsCompleted 
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Last updated

Dynamics Mobile provided by Mobile Affairs Ltd. | 1712 Sofia, Bulgaria, Alexander Malinov 51 | sales@dynamicsmobile.com