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:
To create a Data Import Config it is required to send a POST request to the following endpoint with the parameters found below.
https://platform.flxone.com/api /data-import-config
Service | /api/data-import-config | |
---|---|---|
Method | POST |
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 |
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=" |
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.
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.
https://platform.flxone.com/api /data-import
Service | /api/data-import | |
---|---|---|
Method | POST |
Key | Explanation | Required |
---|---|---|
dataImportConfigId | The Data Import Config id retrieved from step 1 | Yes |
pixelId | The Pixel ID attached to this Data Import | Yes |
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" |
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.
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.
https://platform.flxone.com/api/data-import/upload
Service | /api/data-import/upload | |
---|---|---|
Method | POST |
Key | Explanation | Required |
---|---|---|
id | The Data Import ID from step 2 | Yes |
file | The file to upload. Allowed MIME-types:
| Yes |
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 |
A successful response show the file that is uploaded:
{ "response": { "status": "OK", "uploaded": { "your_file.csv": true } } } |
The files have specific requirements to be uploaded:
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" } |
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.
https://platform.flxone.com/api/data-import-config/mapping
Service | /api/data-import-config/mapping | |
---|---|---|
Method | PUT |
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 |
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" |
A successful response woud look like this:
... |
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.
https://platform.flxone.com/api/data-import/config-finished
Service | /api/data-import-config/config-finished | |
---|---|---|
Method | POST |
Key | Explanation | Required |
---|---|---|
id | The Data Import ID from step 2 | Yes |
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" |
A successful response woud look like this:
... |
The required columnMapping information for Step 4 (index, detectedName & externalAttributeId) can be retrieved via the following endpoint through a GET request.
https://platform.flxone.com/api/data-import-config
Service | /api/data-import-config | |
---|---|---|
Method | GET |
Key | Explanation | Required |
---|---|---|
id | The Data Import Config ID from step 1 | Yes |
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' |
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" } } } |