CharitySearch
To try a test and directly interact with the API endpoint click "Test It" and use an embedded API client to send requests with custom headers and variables, then see the live response; essentially letting you test this API directly within this page. When testing please use our Demo URL: https://demo-payments.frontstream.com/api/CharitySearch
optional - Charity Name - partial or full name
optional - Valid US/CA Nonprofit EIN/Tax ID. For US EINs, the dash proceeding the first two numbers is optional; the endpoint will handle it either way (i.e. 12-3456789 and 123456789 are both valid and will result in the same record being returned)
optional - This should be either 1 (US) or 2 (Canada) - Default to US
optional - Searches the city name of charity addresses
optional - Searches the state code of charity addresses - ISO Standard two digit State code. (VA, NY)
Defaults to 1 - The page of results to display (i.e. if there are 100 overall results to your search and you provide this as 3 with a PageSize=10, this will return results #21 through #30)
Defaults to 10 - The number of results to display per page.
Default SortColumn NpoName - Indicates which SearchResults field to sort by (see response example for valid values). Only supports sorting by one column.
true/false - Whether or not to order the results by descending values of the selected column (or NpoName if not selected).
Returns Charity Search Data
Bad Request
If Charity Search Data not found
GET /api/CharitySearch HTTP/1.1
Host:
Accept: */*
{
"TotalResultCount": 1,
"TotalPages": 1,
"PageIndex": 1,
"PageSize": 1,
"SearchResults": [
{
"CharityId": "text",
"NpoName": "text",
"EIN": "text",
"Address1": "text",
"Address2": "text",
"City": "text",
"State": "text",
"Zip": "text",
"Country": "text",
"NpoEligibilityFlag": true,
"ParentOrgName": "text",
"NTEEcode": "text"
}
]
}
Charity Search Example
Take a look at how you may call this method:
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class CharitySearchParams
{
public string Name { get; set; }
public string EIN { get; set; }
public int? CharitySource { get; set; }
public string City { get; set; }
public string State { get; set; }
public int PageIndex { get; set; } = 1;
public int PageSize { get; set; } = 10;
public string SortColumn { get; set; } = "NpoName";
public bool SortDesc { get; set; } = false;
}
public class CharitySearchResponse
{
public int TotalResultCount { get; set; }
public int TotalPages { get; set; }
public int PageIndex { get; set; }
public int PageSize { get; set; }
public object[] SearchResults { get; set; }
}
public class Program
{
private static async Task Main(string[] args)
{
var charitySearchParams = new CharitySearchParams
{
Name = "Red Cross",
EIN = "123456789",
City = "New York",
State = "NY",
PageIndex = 1,
PageSize = 10
};
var url = "https://demo-payments.frontstream.com/api/CharitySearch";
using (var client = new HttpClient())
{
var query = $"?Name={charitySearchParams.Name}&EIN={charitySearchParams.EIN}&City={charitySearchParams.City}&State={charitySearchParams.State}&PageIndex={charitySearchParams.PageIndex}&PageSize={charitySearchParams.PageSize}&SortColumn={charitySearchParams.SortColumn}&SortDesc={charitySearchParams.SortDesc}";
var response = await client.GetAsync(url + query);
if (response.IsSuccessStatusCode)
{
var data = await response.Content.ReadAsStringAsync();
var charitySearchResponse = JsonConvert.DeserializeObject<CharitySearchResponse>(data);
Console.WriteLine($"Total Results: {charitySearchResponse.TotalResultCount}");
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
}
}
}
}
Last updated