AmpliFund APIs
An Application Programming Interface (API) is software that allows applications to extract and share data with each other. Usage of AmpliFund's APIs is recommended for organizations that wish to develop their own integrations.
AmpliFund's APIs accept requests to save or retrieve data for resources such as Grants, Awards, Expenses, Payment Requests, and many more.
Technical Details
AmpliFund provides access to many resources via two REST APIs, which have different authentication methods and endpoints.
Environment |
Authentication Method |
Endpoint Documentation |
---|---|---|
API V1 |
App Token |
API V1 Documentation |
API V2 |
OAuth Token |
API V2 Documentation |
API V1 Authentication
Your Customer Success representative will provide a token that must be sent as a header with each request, along with a user account email address.
Authentication Headers
All requests to API V1 must include the following headers:
Header Name | Value |
---|---|
|
Token provided by AmpliFund |
|
User email address |
Example JavaScript fetch request:
var myHeaders = new Headers();
myHeaders.append("apptoken", "{{appToken}}");
myHeaders.append("usertoken", "{{userToken}}");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.gotomygrants.com/api/Grants/GetAll", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
API V2 Authentication
Get Token
AmpliFund’s API V2 uses the OAuth resource owner password flow. To obtain a token and refresh token, a request is sent with the following parameters:
-
Request type:
POST
-
URL:
<https://api2.gotomygrants.com/token
> -
Body format:
application/x-www-form-urlencoded
-
Body fields:
-
grant_type =
password
-
username, password = AmpliFund username and password.
-
client_id, client_secret = ID and secret provided by AmpliFund.
-
Example JavaScript fetch request:
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "password");
urlencoded.append("username", "{{username}}");
urlencoded.append("password", "{{password}}");
urlencoded.append("client_id", "{{client_id}}");
urlencoded.append("client_secret", "{{client_secret}}");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api2.gotomygrants.com/token", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Refresh Token
Tokens returned from the /token
endpoint expire in 30 minutes. Before expiration, a new token can be acquired through a request with the following parameters:
-
Request type:
POST
-
URL:
<https://api2.gotomygrants.com/token
> -
Body format:
application/x-www-form-urlencoded
-
Body fields:
-
grant_type =
refresh_token
-
refresh_token = refresh token obtained with original token authentication request.
-
client_id, client_secret = ID and token provided by AmpliFund.
-
Example JavaScript fetch request:
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "refresh_token");
urlencoded.append("client_id", "{{client_id}}");
urlencoded.append("client_secret", "{{client_secret}}");
urlencoded.append("refresh_token", "{{refresh_token}}");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api2.gotomygrants.com/token", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Sending a Request
All requests must include the following headers:
Header Name | Value |
---|---|
|
|
Example Javascript fetch request:
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api2.gotomygrants.com/grants", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Comments
0 comments
Please sign in to leave a comment.