Awesome
Ballerina Candid Connector
Candid is a non-profit organization that provides a comprehensive database of information about nonprofits, foundations, grantmakers, and philanthropists. Their mission is to connect people who want to change the world to the resources they need to do it.
This Ballerina Candid connector is designed to interface with Candid.org's API, enabling developers to access Candid's resources programmatically. It supports various operations, such as searching for nonprofit organizations, accessing grant data, and retrieving information about philanthropic trends and insights.
Currently, the following Candid APIs are supported through this module
- Charity Check PDF API
- The Charity Check PDF API is a powerful tool that allows to download formatted Charity Check PDF reports for individual nonprofits.
- Essentials API
- The Essentials API is a lightweight API that provides basic information about nonprofits, such as their name, address, EIN, and mission statement. It is ideal for applications that need to quickly and easily identify and access basic nonprofit data.
- Premier API
- The Premier API is a more comprehensive API that provides access to a wider range of nonprofit data, including financial information, staffing data, grantmaking data, and DEI data. It is ideal for applications that need to deep dive into the data of individual nonprofits or perform complex analyses of nonprofit data.
Setup guide
To use the Candid.org Connector in Ballerina, you must first obtain an API key from Candid.org.
Step 1: Visit Candid's developer API access page
- Visit Candid's Developer API Access page.
- Review the documentation to understand the type of access suits your need.
Step 2: Request API access
-
For a Trial Account: If you're looking for trial access to explore Candid's API, complete the form to request trial access. Candid.org will review your request and get in touch with you regarding your trial API key.
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-candid/main/docs/setup/resources/1-trial-account-form.png alt="Candid API Access Form" width="50%">
-
For a Production Account: If you require access for production use, fill out the form to initiate the process. Candid.org will contact you to discuss your needs and provide you with a production API key.
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-candid/main/docs/setup/resources/2-prod-account-form.png alt="Candid API Access Form" width="50%">
Quickstart
To use the Candid
connector in your Ballerina application, modify the .bal
file as follows:
Step 1: Import the connector
Import the relevent Candid module into your Ballerina project.
Charity Check PDF API
import ballerinax/candid.charitycheckpdf;
Essentials API
import ballerinax/candid.essentials;
Premier API
import ballerinax/candid.premier;
Step 2: Instantiate a new connector
Create an instance of ApiKeysConfig
with the obtained Subscription Key and initialize the connector with it.
Charity Check PDF API
charitycheckpdf:ApiKeysConfig apiKeyConfig = {
subscriptionKey: "ENTER-THE-SUBSCRIPTION-KEY"
};
charitycheckpdf:Client charitycheckpdf = check new (apiKeyConfig);
Essentials API
essentials:ApiKeysConfig apiKeyConfig = {
subscriptionKey: "ENTER-THE-SUBSCRIPTION-KEY"
};
essentials:Client essentials = check new (apiKeyConfig);
Premier API
premier:ApiKeysConfig apiKeyConfig = {
subscriptionKey: "ENTER-THE-SUBSCRIPTION-KEY"
};
premier:Client premier = check new (apiKeyConfig);
Step 3: Invoke the connector operation
Now, utilize the available connector operations.
Charity Check PDF API
The following Ballerina program generates a PDF report to validate nonprofit status and eligibility with a 100% IRS-compliant charity check.
http:Response|error result = charitycheckpdf->/v1/pdf/["EMP-ID-NUM"];
Essentials API
The following Ballerina program finds nonprofits using search criterias and explore essential information.
essentials:V3Query query = {
search_terms: "candid"
};
essentials:V3EssentialsResponse|error result = essentials->/v3.post(query);
Premier API
The following Ballerina program retrieves data on a nonprofit's financials, people, DEI, and IRS compliance validation for the given employer id number.
premier:V3PublicProfile|error result = check premier->/v3/["EMP-ID-NUM"];
Step 4: Run the Ballerina application
bal run
Examples
The Candid
connector provides practical examples illustrating usage in various scenarios. Explore these examples to understand how to interact with the Candid.org API for tasks such as generating compliance reports, searching for essential nonprofit information, and retrieving detailed employer data.
-
Generate Charity Check PDF - Generate a detailed Charity Check PDF for a specified nonprofit organization using Candid.org's API.
-
Search Essential Information - Search for and retrieve essential information about nonprofit organizations through the Candid.org Essentials API.
-
Get Employer Information - Obtain comprehensive employer information for nonprofit organizations using the Candid.org Premier API.
Issues and projects
The Issues and Projects tabs are disabled for this repository as this is part of the Ballerina library. To report bugs, request new features, start new discussions, view project boards, etc., visit the Ballerina library parent repository.
This repository only contains the source code for the package.
Build from the source
Prerequisites
-
Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources:
Note: After installation, remember to set the
JAVA_HOME
environment variable to the directory where JDK was installed. -
Download and install Ballerina Swan Lake.
-
Download and install Docker.
Note: Ensure that the Docker daemon is running before executing any tests.
Build options
Execute the commands below to build from the source.
-
To build the package:
./gradlew clean build
-
To run the tests:
./gradlew clean test
-
To build the without the tests:
./gradlew clean build -x test
-
To run tests against different environment:
./gradlew clean test -Pgroups=<Comma separated groups/test cases>
-
To debug package with a remote debugger:
./gradlew clean build -Pdebug=<port>
-
To debug with the Ballerina language:
./gradlew clean build -PbalJavaDebug=<port>
-
Publish the generated artifacts to the local Ballerina Central repository:
./gradlew clean build -PpublishToLocalCentral=true
-
Publish the generated artifacts to the Ballerina Central repository:
./gradlew clean build -PpublishToCentral=true
Contribute to Ballerina
As an open-source project, Ballerina welcomes contributions from the community.
For more information, go to the contribution guidelines.
Code of conduct
All the contributors are encouraged to read the Ballerina Code of Conduct.
Useful links
- For more information go to the
candid
package. - For example demonstrations of the usage, go to Ballerina By Examples.
- Chat live with us via our Discord server.
- Post all technical questions on Stack Overflow with the #ballerina tag.