Data Import UI API
This entry provides detailed information on the CRM Data Import processes of the DMP.
Contents of the Table |
---|
The Mapp DMP includes multiple API endpoints that are required to create a CRM Data Import. The following steps are required:
- Step 1 - Create a Data Import Config
- Step 2 - Create a Data Import that is tied to the Data Import Config
- Step 3 - Upload a file to the Data Import
- Step 4 - Create a mapping from columns to external attributes
- Step 5 - Finalise the import
Step 1 - Create a Data Import Config
To create a Data Import Config it is required to send a POST request to the following endpoint with the parameters found below.
Endpoint
https://platform.flxone.com/api /data-import-config
Service | /api/data-import-config | |
---|---|---|
Method | POST |
Parameters
Key | Explanation | Required |
---|---|---|
name | The Data Import Config name (this name will be used in the first step in the DMP interface) | Yes |
parserType | Either 'empty', 'REGEX_SPLIT' or 'JSON_OBJECT' | Ye |
Example
curl -X POST \ https://platform.flxone.com/api/data-import-config \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE' \ -d "name=foo&parserType="
Response
If the request was successful you will get a response similar to the one below:
{ "response": { "data_import_config": { "created": "2017-01-01 00:00:00", "customer": "123", "deleted": "0", "id": "123", "modified": "2017-01-01 00:00:00", "name": "foo", "parserConfig": null, "parserType": "" } } }
Important: Take note of the "id" in the response. It will be used in steps 2 & 4.
Step 2 - Create a Data Import
After creating the Data Import Config, we have to create the Data Import itself. To do this we need to send a POST request to the following endpoint with the parameters found below.
Endpoint
https://platform.flxone.com/api /data-import
Service | /api/data-import | |
---|---|---|
Method | POST |
Parameters
Key | Explanation | Required |
---|---|---|
dataImportConfigId | The Data Import Config id retrieved from step 1 | Yes |
pixelId | The Pixel ID attached to this Data Import | Yes |
Example
curl -X POST \ https://platform.flxone.com/api/data-import \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE' \ -d "dataImportConfigId=DATA_IMPORT_CONFIG_ID&pixelId=PIXEL_ID"
Response
The response looks like below:
{ "response": { "data_import": { "created": "2017-01-01 00:00:00", "customer": "123", "dataImportConfigId": "DATA_IMPORT_CONFIG_ID", "deleted": "0", "id": "123", "modified": "2017-01-01 00:00:00", "pixelId": "PIXEL_ID", "scanDetails": null, "scheduleId": "0", "state": "PENDING_UPLOAD", "userId": "123" }, "status": "OK" }
Important: Take note of the "id" in the response. It will be used in steps 3, 4 & 5.
Step 3 - Upload the data file
Once the Data Import Config and the Data Import entry have been created, it is possible to upload a file to a Data Import. To do this we need to send a POST request to the following endpoint with the parameters found below.
Endpoint
https://platform.flxone.com/api/data-import/upload
Service | /api/data-import/upload | |
---|---|---|
Method | POST |
Parameters
Key | Explanation | Required |
---|---|---|
id | The Data Import ID from step 2 | Yes |
file | The file to upload. Allowed MIME-types:
| Yes |
Example
curl -X POST \ https://platform.flxone.com/api/data-import/upload \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE' \ -d "id=DATA_IMPORT_ID" \ -H "Content-Type: application/json" \ -F file[0]=@your_file.csv
Response
A successful response show the file that is uploaded:
{ "response": { "status": "OK", "uploaded": { "your_file.csv": true } } }
Troubleshooting File Upload
- File should be sent via form data, using the "file" or "file[0]" named parameter.
- Content-Type header is not required, and may actually cause issues with certain file types.
- Confirm that your file format is what the Mapp DMP expects. This is an example CSV file.
File Requirements
The files have specific requirements to be uploaded:
- Has to be in a TSV/CSV/JSON format
- Has to have at least 2 CRM entries / rows of data
IMPORTANT - DO NOT MOVE ONTO STEP 4 BEFORE READING THIS
Before proceeding to Step 4 it is necessary to wait until the file has completely uploaded and the import status has changed to "PENDING_USER_CONFIG".
To check for this you will need to poll the following endpoint with a GET request and include the Data Import ID from step 2:
https://platform.flxone.com/api/data-import?id=DATA_IMPORT_ID
Once the state shows as "PENDING_USER_CONFIG" you can proceed to step 4.
{ "response": { "data_import": { "state": "PENDING_USER_CONFIG", "created": "2017-01-01 00:00:00", "customer": "123", "dataImportConfigId": "DATA_IMPORT_CONFIG_ID", "deleted": "0", "id": "123", "modified": "2017-01-01 00:00:00", "pixelId": "PIXEL_ID", "scanDetails": null, "scheduleId": "0", "userId": "123" }, "status": "OK" }
Step 4 - Create a mapping
Once the file is uploaded, all that is needed is a mapping for the uploaded file. To do this we need to send a PUT request to the following endpoint with the parameters found below.
Endpoint
https://platform.flxone.com/api/data-import-config/mapping
Service | /api/data-import-config/mapping | |
---|---|---|
Method | PUT |
Parameters
Key | Explanation | Required |
---|---|---|
id | The Data Import Config ID from step 1 | Yes |
dataImportId | The Data Import ID from step 2 | Yes |
columnMapping | An array for which each object has 3 keys:
For more information see the details on Retrieving Column Mapping Data | Yes |
Example
curl -X PUT \ https://platform.flxone.com/api/data-import-config/mapping \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE' \ -d "id=DATA_IMPORT_CONFIG_ID&dataImportId=DATA_IMPORT_ID&columnMapping=columnMapping%5B0%5D%5Bindex%5D%3D0%26columnMapping%5B0%5D%5BdetectedName%5D%3Dcustomer_id%26columnMapping%5B0%5D%5BexternalAttributeId%5D%3D12345"
Response
A successful response woud look like this:
...
Step 5 - Finalise Import
Once all of the previous steps have been completed you will need to finalise the import by confirming that the config is finished. To do this we need to send a POST request to the following endpoint with the parameters found below.
Endpoint
https://platform.flxone.com/api/data-import/config-finished
Service | /api/data-import-config/config-finished | |
---|---|---|
Method | POST |
Parameters
Key | Explanation | Required |
---|---|---|
id | The Data Import ID from step 2 | Yes |
Example
curl -X POST \ https://platform.flxone.com/api/data-import-config/config-finished \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE' \ -d "id=DATA_IMPORT_ID"
Response
A successful response woud look like this:
...
Optional Step - Retrieving Column Mapping Data
The required columnMapping information for Step 4 (index, detectedName & externalAttributeId) can be retrieved via the following endpoint through a GET request.
Endpoint
https://platform.flxone.com/api/data-import-config
Service | /api/data-import-config | |
---|---|---|
Method | GET |
Parameters
Key | Explanation | Required |
---|---|---|
id | The Data Import Config ID from step 1 | Yes |
Example
curl -X GET \ https://platform.flxone.com/api/data-import-config?id=DATA_IMPORT_CONFIG_ID \ -H 'Cache-Control: no-cache' \ -H 'X-Auth: YOUR_AUTH_TOKEN_HERE' \ -H 'X-CSRF: YOUR_CSRF_HERE'
Response
A sample response would be:
{ "response": { "data_import_config": { "created": "2017-01-01 00:00:00", "customer": "123", "deleted": "0", "id": "123", "modified": "2017-01-01 00:00:00", "name": "Data Import Config Name", "parserConfig": { "columnMapping": [ { "detectedName": "email", "externalAttribute": { "audience_usage": [], "created": "2017-01-01 00:00:00", "customer": "123", "deleted": "0", "enableAudienceBuilder": "0", "enablePersonalization": "0", "enableReportCentral": "0", "extractionMethod": "json_path", "extractionSamples": null, "extractionSettings": "{\"jsonpath\":\"$.email\",\"skipExamples\":true}", "id": "123", "matcherSettings": null, "modified": "2017-01-01 00:00:00", "settings": null, "sourceType": "external_data", "title": "Email" }, "externalAttributeId": "123", "externalAttributeJsonPath": "$.email", "index": "0" } ] }, "parserType": "REGEX_SPLIT" } } }