7.7.3 Import any external Delivery Data
This article describes a asynchronous interface to import data using CSV files into Salesforce/Advendio. Additionally you have the option to enter 4.13 Manual Delivery Data.
Configuration in Salesforce
For each field you need to import create records under
Setup - Develop - Custom Metadata Types
Data Import Mapping (ADvendio__DataImportMapping__mdt)Â
 to define your individual mapping. By clicking manage you can add new records. These have the following fields:
Name | Api Name | Function | Comment |
---|---|---|---|
Feature | ADvendio__Feature__c | Selects the interface function/feature | To import pls enter „GenericDataPushImport“ |
Source | ADvendio__Source__c | Name of data source out of your CSV file header | If not in imported csv this field gets ignored |
Target | ADvendio__Target__c | API name to the field in which the data gets written into | |
Target Object | ADvendio__TargetObject__c | Object to be filled | You can set up multiple import mappings for more than one object, but one CSV will always fill only one object at a time. |
Required | ADvendio__Required__c | If checked the import verified that the csv header contains this field otherwise an error is reported and the upload is cancelled. | |
Unique Key | ADvendio__UniqueKey__c | Marks this field as a unique key | If checked the import can be handled by a Salesforce UPSERT instead of an import. |
Comment | ADvendio__Comment__c | Comment, no function for the interface. | |
Label | MasterLabel | Salesforce default - not used | |
Data Import Mapping Name | DeveloperName | Salesforce default - not used |
Send a request
Please view example code at:Â 7.7.3.1 Sample Code for Data Importer
Submit a  "multipart/mixed" https post request to https://exchange.advendio.com:8080/AdServerGateway_YOURADVENDIOVERSION/startJob.
So for example for the current release it will be:
https://exchange.advendio.com:8080/AdServerGateway_2.156/startJob.
First part of Request
XML which includes the Job Configuration:
Name | Type | Comment |
---|---|---|
endpoint | String (URL) | salesforce login - end point or session end point |
password | String | Salesforce password (not necessary for if you use session) |
username | String | Salesforce user name (not necessary for if you use session) |
token | String | Salesforce login token (not necessary for if you use session) |
sessionId | String | Salesforce SessionId (not necessary for if you use password, username and token) |
orgId | String | Salesforce Organisation ID |
dataType | String | here only CSV allowed |
operation | String | "GenericDataPushImport" |
objectName | String | Pls use the „Data Import Mapping“ Target Object you like to import data into. |
fmail | String (; separierte email) | Email address for error messages, if empty Email of field smail is used. |
smail | String (; separierte email) | Email address for success messages. After process has finished a Link to the result page will be sent. |
Second Part Request
Second part of the request is the CSV which includes all data to be imported. Header and their respective columns which are not mapped will be ignored.
Answer
You will receive an immediate answer in XML (default) or JSON if that type was requested. The answer JobStatus will have the following data:
Name | Type | Comment |
---|---|---|
jobId | Integer | ID |
status | Integer | 0 = queued, 1 = in progress, 2 = completed, 3 = failed |
message | String | Description |
progress | Float | 0 - 1 showing the progress |
start | DateTime | start time of job |
end | DateTime | end time of job |
request | String | Used JobConfiguration |
orgId | String | Salesforce Org (JobConfiguration) |
operation | String | refer to JobConfiguration |
Monitor Progress
Request
To monitor the status and progress of your request you can send an „application/xml“ or „application/json“ https post request to https://altona.advendio.com:8080/AdServerGateway_2.73/getJobStatus.
The JobIdentifier needs the following data:
Name | Type | Comment |
---|---|---|
jobId | Integer | refer to JobStatus |
orgId | String | refer to JobConfiguration and JobStatus |
Answer
The answer is an updated JobStatus. (please refer to the above description under Answer)
Fetch Results
To pull the results even if the job has not finished you can send an „application/xml“ or „application/json“ https post request to https://altona.advendio.com:8080/AdServerGateway_2.73/getJobResults.
Please refer to JobIdentifier above.
The JobResults answer looks like this:
Name | Type | Comment |
---|---|---|
|
| refer to JobStatus |
| List< | refer to JobResult |
which contains of JobResult:
Name | Typ | Kommentar |
---|---|---|
data | Object | Data of the typ dataType |
dataType | String | Typ of data (e.g. GenericDataPushImportLineResult, ForceBulkJobInfoResult) |
created | DateTime | created date |
with Type GenericDataPushImportLineResult:
Name | Typ | Kommentar |
---|---|---|
lineNr | Integer | Position in CSV File including header |
success | Boolean | false if error (successful lines will not be recorded) |
message | String | Error message or other information for that line |
and with Type ForceBulkJobInfoResult:
Name | Typ | Kommentar |
---|---|---|
|
| refer: Setup - Jobs - Bulk Data Load Jobs - Job ID |