Service endpoint¶
https://api.targetsmart.com/person/listjoiner
Overview¶
As a complement to the ListBuilder
service, the ListJoiner service allows a list of VoterBase record
identifiers to be enriched with TargetSmart data. A request would
provide a list of voterbase_id
values. The corresponding JSON
response includes the TargetSmart data field values from our platform
database. TargetSmart Client Services configures the returned field
identifiers for your key. The request is executed synchronously with
low latency.
Request Parameters¶
Key | Required | Optional | Default | Permitted Values |
---|---|---|---|---|
ids |
✓ | A sorted comma separated list of up to 500 VoterBase IDs | ||
fields |
✓ | Configured data-enhance fields | A comma separated list of fields |
Additional Parameter Details¶
Both parameters require a comma separated list of values (without spaces). For example:
vb.tsmart_first_name,vb.tsmart_last_name
Example in Python:
fields = ','.join(['vb.tsmart_first_name', 'vb.tsmart_last_name'])
ids
The sorted list of VoterBase IDs cannot exceed 500.
fields
If this optional parameter is not provided, the service returns all fields that are configured for the requesting client (currently based on configured person/data-enhance fields). Otherwise, a subset of those fields can be provided.
JSON Response¶
Responses are JSON objects with the following keys:
result
: A list of JSON objects mapping field names to data values for each input VoterBase IDresult_count
: Number of objects in theresult
listfield_count
: Number of fields appended for each object (not counting VoterBase ID)
Code Examples¶
🔐 Remember to secure your API key
Never expose your API key in plain text or source control accessible by a third party.
#! /usr/bin/env python3
import os
import requests
api_key = os.environ["TS_API_KEY"]
response = requests.get(
"https://api.targetsmart.com/person/listjoiner",
params={
"fields": "vb.tsmart_last_name,vb.tsmart_first_name",
"ids": "OH-000000000001,OH-000000000003",
},
headers={"x-api-key": api_key},
)
response.raise_for_status()
print(response.json())
#! /usr/bin/env node
const fetch = require("node-fetch");
const targetSmartApiKey = process.env.TS_API_KEY;
const queryParams = new URLSearchParams({
fields: "vb.tsmart_last_name,vb.tsmart_first_name",
ids: "OH-000000000001,OH-000000000003",
});
fetch(
"https://api.targetsmart.com/person/listjoiner?" + queryParams.toString(),
{
method: "GET",
headers: {
"x-api-key": targetSmartApiKey,
},
}
)
.then((res) => res.json())
.then((json) => console.log(json));
#! /usr/bin/env bash
result=$(curl -XGET \
-H "x-api-key: $TS_API_KEY" \
"https://api.targetsmart.com/person/listjoiner?fields=vb.tsmart_last_name%2Cvb.tsmart_first_name&ids=OH-000000000001%2COH-000000000003")
echo $result