Property Data Enrichment with JSON
For this guide, we're going to assume the following you're interested in using Datafiniti's property data enrichment to enrich an existing line separated json file of commercial addresses in Texas, US. There are 5 steps to run a property data enrichment using a json:
- Select your enrichment file
- Set your field_parameter(s)
- Configure your query
- Configure your format & view
- Start your download
select your enrichment file
Shown here is an example of an acceptable line separated json file with the correct header to match address & postalCode. We will be using this file for the example in this guide.
{"address":"9920 WESTPARK DR","postalCode":77063}
{"address":"W BAY AREA BLVD","postalCode":77546}
{"address":"16310 State Highway 249","postalCode":77064}
{"address":"13355 Noel Rd","postalCode":"75240-0000"}
{"address":"300 Crescent Ct","postalCode":"75201-1876"}
{"address":"2340 E TRINITY MILLS RD","postalCode":"75006-1942"}
{"address":"1901 Milam St","postalCode":77002}
{"address":"23201 ALDINE WESTFIELD RD","postalCode":77373}
{"address":"2351 W Northwest Hwy","postalCode":"75220-0000"}
{"address":"1425 W PIONEER DR","postalCode":"75061-7146"}
{"address":"8204 Elmbrook Dr","postalCode":"75247-4067"}
{"address":"10935 Estate Ln","postalCode":"75238-0000"}
{"address":"1201 MAIN ST","postalCode":"75202-3908"}
{"address":"2616 MANOR Way","postalCode":"75235-0000"}
{"address":"1800 West Loop S","postalCode":77027}
{"address":"5949 Sherry Ln","postalCode":"75225-6532"}
{"address":"17300 Preston Rd","postalCode":"75252-5618"}
{"address":"3460 W WALNUT ST","postalCode":"75042-7151"}
{"address":"888 S GREENVILLE AVE","postalCode":"75081-5058"}
{"address":"2815 Valley View Ln","postalCode":"75234-4956"}
Set your enrichment file as the field_parameter file.
Set Your field_parameter
For the field parameter, we want to make sure that the Datafiniti schema field is selected and matches inside the txt file. This will allow the enrichment API to target submitted addresses plus postalCodes in our case here.
You can read more about other property schema fields here.
JSON format
Our enrichment search API will not allow any JSON object with keys that do not match your field parameters. Be sure to match the field parameter in our property schema here. A common error you may see in this case:
"Invalid file type, must be csv or text file."
Configure your query
The query is essential to target the specific group of data you are trying to enrich from. Datafiniti has a very large dataset, and in most cases, you will not need to search through the entire database. Your query can be built using the same logic from our search API here.
There are some things you must have in your query. You must include a wildcard for each of the field_parameter you search off of. In this case, we will add the following:
For our example here, we will add logic to our query to search for properties in the Texas, US, with an address, with a postalcode, and have the propertyType equal to commercial.
address:* AND postalCode:* AND country:US AND province:(TX) AND propertyType:\"commercial\"
Query - download time
We strongly advise against generalized field_parameter values. This will create a search through a larger pool of properties. Therefore the more specific your query is, the faster your enrichment job will be.
Configure your format & view
Your format will determine the output file type of the enrichment download you wish to start. This can be set to either of csv or json. For this example, we will set it to json.
Finally, the view is used to specify which fields you want to be added to your data. If no view is provided, we will add all fields from matching records as we do for our default view for the Available Views for Property Data
Your final parameter should be set up as the following.
Listed below is a cURL POST to import this example into Postman.
curl --location 'https://api.datafiniti.co/v4/properties/search/enrichment' \
--header 'Authorization: Bearer insert_your_key_here' \
--form 'address,postalCode=@"/C:/Users/Leonard/Downloads/PropertyEnrichAddresses.txt"' \
--form 'format="json"' \
--form 'num_records="20"' \
--form 'query="address:* AND postalCode:* AND country:US AND province:(TX) AND propertyType:\\\"commercial\\\""' \
--form 'view="default"'
Start your download
Once you send your Postman request for the enrichment download you will not be charged credits immediately. It will create a download response. We recommend holding on to the download ID for that will allow your to access the data once the status is complete. For more on how to manage your downloads, you can visit here.
An example enrichment download response:
{
"status": "queued",
"num_downloaded": 0,
"num_records_suppressed": 0,
"total_cost": 0,
"fields": [
{
"name": "address"
},
{
"name": "apiURLs",
"flatten": false
}
],
"sort": true,
"format": "json",
"suppressed_fields": [],
"enriched_fields": [
{
"field": "address,postalCode",
"s3Key": "production/126609/1678125819862-PropertyEnrichAddresses.txt"
}
],
"user": 111609,
"query": "address:* AND postalCode:* AND country:US AND province:(TX) AND propertyType:\\\"commercial\\\"",
"num_records": 20,
"data_type": "property",
"results": [],
"date_started": "2023-03-06T18:03:40.383Z",
"date_updated": "2023-03-06T18:03:40.383Z",
"_id": 186861,
"is_suppression_job": false,
"is_enrichment_job": true,
"id": "186861"
}
Updated almost 2 years ago