Bulk processing
Bulk import aims at giving you the ability to bulk-import data into the mediarithmics platform.
You can import:
Offline activities such as offline purchases and store visits
User segments such as email lists, cookies list, user accounts list, etc.
User profiles such as CRM data and scoring
User association such as CRM Onboarding
User dissociation
User suppression requests such as GDPR Suppression requests, and Opt-Out Management
How it works
You upload files associated with a document import definition:
Files represent the data.
Document imports represent what mediarithmics should do with the data.
If you need to track users in real-time, you should read the real-time tracking guide.
The two steps for bulk import are:
Create the document import definition to tell mediarithmics what you are importing
Upload files associated with the document import definition. Each uploaded file creates a new document import execution.
For maximum performance:
Ensure a maximum size for each file of 100M.
Use the document import for multiple records when there will be more than 1,000 per file.
How to choose between creating a new document import or adding a new file to an existing document import? Our recommendation is to create a new document import each time you have a new set of files to upload. For example, if you upload CRM profiles every night, you should create a new "User profiles from CRM - " document import every night instead of just uploading new files to a unique "User profiles from CRM" document import.
Each line in the uploaded file is a command to execute. Depending on the document import type, you have different commands available.
User identifiers in imports
When importing data, you need to properly add user identifiers. This will ensure your data is associated with the proper user point.
Only one identifier is allowed per line. For example, you shouldn't specify the user agent ID if the Email Hash is already used in a line.
However, you don't have to always use the same type of identifier in your document. For example, one line could use the user account ID while another uses the email hash.
Document import
Document imports define what you are about to upload in one or multiple files.
A document import object has the following properties:
field
type
description
document_type
Enum
The type of data you want to import. Should be USER_ACTIVITY
, USER_SEGMENT
, USER_PROFILE
,
USER_CHOICE
,
USER_IDENTIFIERS_DELETION
, or USER_IDENTIFIERS_ASSOCIATION_DECLARATIONS
mime_type
Enum
The format of the imported data. APPLICATION_X_NDJSON
or TEXT_CSV
It should match the file format of the upload file, e.g. .csv
or .ndjson
. The csv format can be chosen only for USER_SEGMENT
imports.
encoding
String
Encoding of the data that will be imported. Usuallyutf-8
name
String
The name of your import.
priority
Enum
LOW
, MEDIUM
or HIGH
Create a document import
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports
Path Parameters
datamartId
integer
The ID of the datamart in which your data will be imported
Request Body
data
object
The document import object you wish to create
Create a document import
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports
Path Parameters
datamartId
integer
vFS9BHjabZyJ
Request Body
data
object
kS9H3hzUiexv
Here is a sample request using curl:
List document imports
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports
List document imports
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports
You can list all document imports for a datamart or search them with filters.
Path Parameters
datamartId
integer
The ID of the datamart
Query Parameters
keywords
string
The keywords to match with document import names. It is case sensitive.Examples:
mime_type
string
Filter on a specific mime type. Supported values are APPLICATION_X_NDJSON
or TEXT_CSV
.
document_types
string
Filter on specific document types. Supported values areUSER_PROFILE
, USER_ACTIVITY
or USER_SEGMENT
.Multiple filters can be separated with commas.Examples : &document_types=USER_PROFILE
or &document_types=USER_PROFILE,USER_ACTIVITY
order_by
string
ID sorts result by default, you can specify &order_by=name
to sort them by name
Path Parameters
datamartId
integer
cwpZwdgiP6it
Query Parameters
keywords
string
iESSMnU2pCGe
mime_type
string
2CBl6APLVp68
document_types
string
1kwp9UODA97H
order_by
string
EelerXhwvEEp
The query is paginated as described in using our API guide.
Get a document import
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Path Parameters
datamartId
integer
The ID of the datamart
importId
integer
The ID of the document import
Update a document import
PUT
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Path Parameters
datamartId
integer
The ID of the datamart
importId
integer
The ID of the document import
Request Body
data
object
The document import object to put
Remove a document import
DELETE
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Get a document import
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Path Parameters
datamartId
integer
Jf2ae4145J8X
importId
integer
BnVMEtE0ZgX7
Update a document import
PUT
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Path Parameters
datamartId
integer
FXGW8yZbdRjn
importId
integer
gxho9xxHz3XF
Request Body
data
object
pohTPPcdUrvH
Remove a document import
DELETE
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId
Removes a document import you don't want to see anymore in the system.
Path Parameters
datamartId
integer
The ID of the datamart
importId
integer
The ID of the document import
Path Parameters
datamartId
integer
wpkAxdO7r6EQ
importId
integer
Ie4UyLrAbXVx
File upload
A file upload creates an execution.
After creation, the execution is at the PENDING
status. It goes into the RUNNING
status when the import starts and SUCCEEDED
status once the platform has correctly imported the file.
Create an execution
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions
Create an execution
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions
You create an execution and upload a file with this endpoint.
Path Parameters
datamartId*
string
The ID of the datamart
importId*
string
The ID of the document import
Headers
Content-Type*
string
Your upload configuration.
Path Parameters
datamartId*
string
uIp7zTVxrlLN
importId*
string
Bt3q7aQg0FLi
Headers
Content-Type*
string
JxtpyAC9vv4c
See an example:
You retrieve metadata about the created execution, notably and id property you can use to track the execution.
List executions
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions
List executions
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions
You can list all executions for a document, import and retrieve useful data like their status, execution time and error messages.
Path Parameters
datamartId*
integer
The ID of the datamart
importId*
integer
The ID of document import
Get an execution
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions/:executionId
Path Parameters
datamartId*
integer
azzxsgagT62l
importId*
integer
txRL6gwJbd3Q
Get an execution
GET
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions/:executionId
Get a specific execution and retrieves useful data like its status, execution time and error messages.
Path Parameters
datamartId*
integer
The ID of the datamart
importId*
integer
The ID of the document import
executionId*
integer
The ID of the execution (usually retrieved from "create execution" or "list executions" requests)
Cancel an execution
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions/:executionId/action
Path Parameters
datamartId*
integer
Zn9RFSaLWpZv
importId*
integer
s6uYmaa8r9i1
executionId*
integer
B64v3BHt293F
Cancel an execution
POST
https://api.mediarithmics.com/v1/datamarts/:datamartId/document_imports/:importId/executions/:executionId/action
Cancel a specific execution
Path Parameters
datamartId*
string
The ID of the datamart
importId*
string
The ID of the document import
executionId*
string
The ID of the execution (usually retrieved from "create execution" or "list executions" requests)
Request Body
body*
json
Must be: {"action":"CANCEL"}
Path Parameters
datamartId*
string
wZoHlE7fLL7B
importId*
string
rfyxTmy4ADfu
executionId*
string
I4uybZx0Wdsn
Request Body
body*
json
h71PehFUA6m5
The cancellation of an execution will only work if the status of this executions is "PENDING"
Splitting large files
If you need to import larger files than 100Mbytes, you can split them before using the upload API and call it multiple times.
You can split massive files using the shell command.
Last updated