Contents
Overview
The API supports multiple search mechanisms that help retrieve customer records based on different matching behaviors. These search methods allow flexible querying when the exact value is unknown, partially known, or contains small input errors.
The API supports the following search types:
| Search Type | Purpose | Example |
| Fuzzy Search | Handles minor typos or spelling mistakes | GET /api/v1/customers?name=Robart James&fuzzy=true |
| Partial Search | Matches records where the value ends with a specific pattern | GET /api/v1/customers?name=*James |
| Wildcard Search | Matches records where the value contains a pattern anywhere | GET /api/v1/customers?name=*son* |
Fuzzy Search
Fuzzy search allows retrieving customer records even when the search value contains minor spelling errors or typos. Instead of requiring an exact match, the system returns results that are similar to the provided input within an allowed edit distance.
The fuzzy search mechanism can tolerate up to two-character differences between the search input and the stored value.
These differences may include:
|
This helps return relevant results even when the search input contains small mistakes.
Common Use Cases
Fuzzy search is useful when:
- The search value contains typing errors or misspellings
- The exact value may not be entered correctly
- Minor differences exist between the query and stored data
Example Endpoint
| GET /api/v1/customers |
Query Parameter
| Parameter | Type | Description |
| id / name | String | Field used for searching |
| Fuzzy | Boolean | Enables fuzzy matching |
Example Request
| GET /api/v1/customers?name=Robart James&fuzzy=true |
How Fuzzy Matching Works
When fuzziness=auto is used, the system compares the search input with stored values and returns matches that fall within the allowed edit distance (maximum two-character changes).
Example Queries
Exact Match: Request
|
- Results: Robert James
Query with Typo: Request
|
- Result: Robert James
The system returns the closest match because the difference falls within the allowed edit distance.
Real-world Example
A support team searches for customers processed through the Braintree gateway, but accidentally types the gateway name incorrectly: Brointree
Example Request
| GET /api/v1/customers?fuzzy=true&gateway_name=Brointree |
With fuzzy search enabled, the API still returns customers associated with Braintree, allowing the agent to retrieve the correct records without needing the exact spelling.
Partial Search
Partial search allows retrieving records when only part of the field value is known. This search method uses the * symbol to represent unknown characters. You can use * only before or after the value.
Example Request
| GET /api/v1/customers?name=*James |
Explanation
The * symbol represents zero or more characters. When * is placed before a value, it returns records that end with the specified text.
So, the search:
| name=*James |
It returns customers whose names end with "James".
Example Dataset
| Customer ID | Name |
| C-1001 | Robert James |
| C-1002 | David James |
| C-1003 | Wilson Robert |
| C-1004 | James Carter |
Matching Results
| Robert James David James |
Wildcard Search
Wildcard search allows flexible pattern matching where the * character can appear before, after, or around a value.
Example Request
| GET /api/v1/customers?name=*son* |
Explanation
This query *son* searches for customer names that contain "son" anywhere in the value.
Example Dataset
| Customer ID | Name |
| C-8270 | Jackson Smith |
| C-9001 | Jackson Smith |
| C-1002 | Alison Carter |
| C-1100 | James Wilson |
Matching Results
| Jackson Smith Alison Carter James Wilson |
Wildcard Pattern Reference
| Pattern | Description | Example |
| value* | Matches values starting with the given text | Jam* → James Carter |
| *value | Matches values ending with the given text | *son → James Wilson |
| *value* | Matches values containing the given text anywhere | *son* → Jackson Smith, Alison Carter |
- Refer List Customer Endpoint API documentation
Comments
0 comments
Please sign in to leave a comment.