API

Push Post API

These calls allow you to add records to a TouchPoint database using the API.

Authentication to the API requires a user with both the Developer, APIOnly and APIWrite roles
(APIOnly and APIWrite might not exist and will need to be created).

Important

The examples below show using curl, a command line tool for transferring data using various URL protocols. This tool comes on a Mac and can be downloaded for Windows.

Note

The examples below explicitly set the authorization header, but you can also set it like so:

curl --user "atester:MyApiPasswordToRuleThemAll" \
    "https://sandbox.tpsdb.com/api/People?\$top=5"
AddContribution()
Returns:

information including the PeopleId and the ContributionId

Return type:

json object

Parameters:
  • First (string) – first name (required)
  • Last (string) – last name (required)
  • Email (string) – email address (required)
  • Phone (string) – phone number (required)
  • Amount (decimal) – amount of the gift (required)
  • Address (string) – street address (optional)
  • Zip (string) – zip code (optional)
  • Date (datetime) – date and time of the contribution (optional)
  • Source (string) – service name like txt2give
  • FundId (int) – id of the fund (optional)

This call allows you to add a contribution to the database.

Curl Example:

curl -X POST -H "Authorization: Basic YXRlc3RlcjpNeUFwaVBhc3N3b3JkVG9SdWxlVGhlbUFsbA==" \
    -H "Content-Type: application/json" -d '{
    "First": "John",
    "Last": "Appleseed",
    "Email": "david@tpsdb.com",
    "Phone": "901-489-0611",
    "Amount": "10"
}' "https://sandbox.tpsdb.com/Api/AddContribution"

returns:

{
    "PeopleId":152,
    "ContributionId":1,
    "NewPerson":true,
    "MultipleMatches":false,
    "Source":null
}

In the return object, NewPerson indicates whether a new person record was created or not. MultipleMatches is true if it matched multiple existing records, (it chose the first one).

ReverseContribution()
return:information including the PeopleId and the ContributionId
rtype:json object
param int id:id of the contribution to be reversed
param string source:
 identifies the party / company making the reversal

This call allows you to reverse a contribution in the database.

The arguments are passed in the URL as /Api/ReverseContribution/1234/company where 1234 is the contributionid of the contribution to be reversed and company is an indicator of the party doing the reversal. The body of the POST is empty.

Curl Example:

curl -X POST -H "Authorization: Basic YXRlc3RlcjpNeUFwaVBhc3N3b3JkVG9SdWxlVGhlbUFsbA==" \
    "https://sandbox.tpsdb.com/Api/ReverseContribution/1234/text2give"

returns:

{
     "operation": "Reversal",
     "peopleId": 4444,
     "contributionId": 1234,
     "source": "API Reverse (source=txt2give)"
}

The operation will notify Finance personnel at the church.

© 2018 TouchPoint Software, LLC.  All rights reserved.