Example 3 - Clean First/Last/Email/City/State from multiple records (batch)

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,",[email protected],Big Apple,New York  
Tony1,Stark?,[email protected],City of Angels,CA  
Clint,barton,bowguy@outlookcom,Emerald City,  
",Sam",wilson,[email protected],,

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": "[email protected]",
      "City": "Big Apple",
      "State": "New York"
    },
    {
      "First Name": "Tony1",
      "Last Name": "Stark?",
      "Email": "[email protected]",
      "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": "[email protected]"
    }
  ],
  "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": "[email protected]",
                "City": "New York",
                "State": "NY",
                "Country": "US"
            },
            {
                "First Name": "Tony",
                "Last Name": "Stark",
                "Email": "[email protected]",
                "City": "Los Angeles",
                "State": "CA",
                "Country": "US"
            },
            {
                "First Name": "Clint",
                "Last Name": "barton",
                "Email": "[email protected]",
                "City": "Seattle",
                "State": "WA",
                "Country": "US"
            },
            {
                "First Name": "Sam",
                "Last Name": "wilson",
                "Email": "[email protected]",
                "City": "",
                "State": "",
                "Country": ""
            }
        ],
        "input_query": []
    }
}