String Concatenation
There are times when the API user will need to search for information within multiple columns, such an individual's full name. The API stores the first name and last name in two separate columns, making it difficult to search for an individual's full name using standard filters.
Joining
To search for an individual's full name, the API user needs to join multiple string values using the + operator and search the combined fields. In the example below, the API user is using the string "first_name + ' ' + last_name" as the operand.
Join example:
GET /v2/people?q=
{
"filters": [
{
"operand": "first_name + ' ' + last_name",
"operator": "=",
"value": "John Doe"
}
]
}
Join output:
{
"count": 1,
"total_results": 1,
"offset": 0,
"results": [
{
"first_name": "John",
"id": 123,
"last_name": "Doe"
}
]
}
Single and Double Quotes
Single ' or double " quotes may be used to join multiple string values that are not part of the same model. However, single ' quotes are recommended. Double " quotes may be used, but require additional string escaping in the request.
In the example below, single ' quotes and a single space were needed to separate the first name and last name.
Single quotes:
GET /v2/people?q=
{
"filters": [
{
"operand": "first_name + ' ' + last_name",
"operator": "=",
"value": "John Doe"
}
]
}
In the example blow, double " quotes, two backslashes, and a single space were needed to separate the first name and last name.
Double quotes:
"filters": [
{
"operand": "first_name + \" \" + last_name",
"operator": "=",
"value": "John Doe"
}
]