In this example we will user the DataPrep API to process multiple records (BATCH) and clean Full name, Last name, Email, City and State. The records are in CSV format and one record per line (see below sample).
First Name,Last Name,Email,City,State
Stev!e,"//Rogers,",steve.rogers@yaho.com,Big Apple,New York
Tony1,Stark?,Tony.stark+1@starkindustries.co,City of Angels,CA
Clint,barton,bowguy@outlookcom,Emerald City,
",Sam",wilson,wing.man@gogle.com,,
Long-form (POST)
URL
http://api-stg.versium.com/v2/dataprep
Body
{
"actions": [
{
"name": "email",
"inputFields": [
"Email"
],
"outputFields": [
"Email"
],
"options": {
"aggressive": 1
}
},
{
"name": "first",
"inputFields": [
"First Name"
],
"outputFields": [
"First Name"
]
},
{
"name": "last",
"inputFields": [
"Last Name"
],
"outputFields": [
"Last Name"
]
},
{
"name": "tlilocmap",
"inputFields": [
"City"
],
"outputFields": [
"Address (Not used in outputs)",
"City",
"State",
"Zip (Not used in outputs)",
"Country"
]
}
],
"inputs": [
{
"First Name": "Stev!e",
"Last Name": "//Rogers,",
"Email": "steve.rogers@yaho.com",
"City": "Big Apple",
"State": "New York"
},
{
"First Name": "Tony1",
"Last Name": "Stark?",
"Email": "Tony.stark+1@starkindustries.co",
"City": "City of Angels",
"State": "CA"
},
{
"First Name": "Clint",
"Last Name": "barton",
"Email": "bowguy@outlookcom",
"City": "Emerald City"
},
{
"First Name": ",Sam",
"Last Name": "wilson",
"Email": "wing.man@gogle.com"
}
],
"output": [
"First Name",
"Last Name",
"Email",
"City",
"State",
"Country"
]
}
Response
{
"versium": {
"version": "2.0",
"match_counts": {
"data_prep": 3
},
"num_matches": 3,
"num_results": 4,
"query_id": "ee37e85a833f246c2f74df699f08e8c3",
"query_time": 0.04246711730957031,
"results": [
{
"First Name": "Steve",
"Last Name": "Rogers",
"Email": "steve.rogers@yahoo.com",
"City": "New York",
"State": "NY",
"Country": "US"
},
{
"First Name": "Tony",
"Last Name": "Stark",
"Email": "Tony.stark+1@starkindustries.co",
"City": "Los Angeles",
"State": "CA",
"Country": "US"
},
{
"First Name": "Clint",
"Last Name": "barton",
"Email": "bowguy@outlook.com",
"City": "Seattle",
"State": "WA",
"Country": "US"
},
{
"First Name": "Sam",
"Last Name": "wilson",
"Email": "wing.man@google.com",
"City": "",
"State": "",
"Country": ""
}
],
"input_query": []
}
}