DoTopia HTTP API Reference

The DoTopia API exposes DoTopia functions like register, give and donate of DoDollars®. These functions can be accessed and manipulated using the HTTP methods GET and POST.

Unless otherwise specified, the base URL for API endpoints is:

https://data.dotopia.com/api

/register

Register a DoTopia user

Note All parameters must be sent in the request body, not as part of the query string. The response will return an access token and refresh token which will be used moving forward.

Example

POST "https://data.dotopia.com/api/register"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
firstName First Name John
lastName Last Name Doe
email Email Address john.doe@gmail.com
password1 Password Password1234
password2 Confirmed Password Password1234
zip Zip Code 10011

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'firstName' => "John",
   'lastName' => "Doe",
   'email' => "john.doe@gmail.com",
   'password1' => "password1234",
   'password2' => "password1234",
   'zip' => "10011",
);
$url = "https://data.dotopia.com/api/register";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
    "success":true,
    "user":
     {
      "FirstName":"john",
      "AccountID":259122,
      "LastName":"hull",
      "UserName":"john.doe@gmail.com",
      "AllEmails":"john.doe@gmail.com",
      "CorporationID":35,
      "zip":"55408",
      "updated_at":"2018-01-25 23:14:19",
      "created_at":"2018-01-25 23:14:19",
      "UserID":61378
    },
    "balance":20,
    "redirectUrl":"",
    "token_creds":
      {
      "token_type":"Bearer",
      "expires_in":31536000,
      "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs",
      "refresh_token":"def502003d5fdcfb0015ddf39ef22cdad25"
    }
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
Missing Data Attributes Make sure all fields are filled out
Passwords do not match Your passwords do not match
Password length error Password must be 8 characters or more
User Email error An account with that email already exists.

/login

Login a DoTopia user

Note All parameters must be sent in the request body, not as part of the query string. The response will return an access token and refresh token which will be used moving forward.

Example

POST "https://data.dotopia.com/api/login"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
email Email Address john.doe@gmail.com
password Password Password1234

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'email' => "john.doe@gmail.com",
   'password1' => "password1234",
);
$url = "https://data.dotopia.com/api/login";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
    "success":true,
    "user":
     {
      "FirstName":"john",
      "AccountID":259122,
      "LastName":"hull",
      "UserName":"john.doe@gmail.com",
      "AllEmails":"john.doe@gmail.com",
      "CorporationID":35,
      "zip":"55408",
      "updated_at":"2018-01-25 23:14:19",
      "created_at":"2018-01-25 23:14:19",
      "UserID":61378
    },
    "balance":20,
    "redirectUrl":"",
    "token_creds":
      {
      "token_type":"Bearer",
      "expires_in":31536000,
      "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs",
      "refresh_token":"def502003d5fdcfb0015ddf39ef22cdad25"
    }
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
Missing Data Attributes Make sure all fields are filled out
Passwords do not match Your passwords do not match
Password length error Password must be 8 characters or more
Incorrect Login Credentials We could not find your account. Please try again.

/search

/redeem

Redeem a DoDollar Code

Note All parameters must be sent in the request body, not as part of the query string. The access token returned during the registration/login will be used as the auth token for this POST

Example

POST "https://data.dotopia.com/api/redeem"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
code DoDollar Code 2K3K22L1

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'code' => "2K3K22L1",
);
$url = "https://data.dotopia.com/api/redeem;
$ch = curl_init();
$authorization = "Authorization: Bearer [ACCESS_TOKEN_HERE]";
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
	"success":true,
	"balance":30,
	"amount":30,
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
Incorrect Code We could not find your gift code
The code has expired This code is no longer valid.
No User Account Found We could not find your account
Already Used Code This code has already been redeemed

/buy

Purchase DoDollars

Note Our API uses Stripe to handle the credit card transactions. In order for your application to process DoTopia payments, you will need to use the Example HTML below to process the credit card, and then pass the confirmation token to the DoTopia server.

Example

POST "https://data.dotopia.com/api/buy"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
stripe_token A unique transaction token passed from Stripe 2K3K22L1
amount Amount being purchased 10

Frontend HTML code for the Stripe Payment

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'stripe_token' => "STR32JI32MKK2",
   'amount' => "10",
);
$url = "https://data.dotopia.com/api/buy;
$ch = curl_init();
$authorization = "Authorization: Bearer [ACCESS_TOKEN_HERE]";
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
    "success":true,
    "user":
     {
      "FirstName":"john",
      "AccountID":259122,
      "LastName":"hull",
      "UserName":"john.doe@gmail.com",
      "AllEmails":"john.doe@gmail.com",
      "CorporationID":35,
      "zip":"55408",
      "updated_at":"2018-01-25 23:14:19",
      "created_at":"2018-01-25 23:14:19",
      "UserID":61378
    },
    "balance":20,
    "redirectUrl":"",
    "token_creds":
      {
      "token_type":"Bearer",
      "expires_in":31536000,
      "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs",
      "refresh_token":"def502003d5fdcfb0015ddf39ef22cdad25"
    }
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
Bad Card Info Invalid Credit Card Info
User Account error An account with that email does not exists.


/give

Give DoDollars to a charity

Note All parameters must be sent in the request body, not as part of the query string.

Example

POST "https://data.dotopia.com/api/give"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
charity_id Unique identifier for each charity 2K3K22L1
amount Amount being sent to charity 10
message Short Message the donor would like to pass along with the donation. Text Goes Here

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'charity_id' => "2100",
   'amount' => "20",
   'message' => "Text Goes Here",
);
$url = "https://data.dotopia.com/api/give;
$ch = curl_init();
$authorization = "Authorization: Bearer [ACCESS_TOKEN_HERE]";
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
    "success":true,
    "user":
     {
      "FirstName":"john",
      "AccountID":259122,
      "LastName":"hull",
      "UserName":"john.doe@gmail.com",
      "AllEmails":"john.doe@gmail.com",
      "CorporationID":35,
      "zip":"55408",
      "updated_at":"2018-01-25 23:14:19",
      "created_at":"2018-01-25 23:14:19",
      "UserID":61378
    },
    "balance":20,
    "redirectUrl":"",
    "token_creds":
      {
      "token_type":"Bearer",
      "expires_in":31536000,
      "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs",
      "refresh_token":"def502003d5fdcfb0015ddf39ef22cdad25"
    }
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
The donation amount is more than the balance of the account Not enough funds in your account

/gift

Give DoDollars to another person

Note All parameters must be sent in the request body, not as part of the query string.

Example

POST "https://data.dotopia.com/api/gift"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
name Fill Name John
email Email of recipient Jane.Doe@gmail.com
sms SMS Number of recipient 6128120123
amount Amount to gift 20

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'name' => "Jane Doe",
   'email' => "jane.doe@gmail.com",
   'sms' => "6128120123",
   'amount' => "20",
);
$url = "https://data.dotopia.com/api/gift;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
Success Response
{
	"success":true,
	"balance" : 10,
	"to_email" : "jane.doe@gmail.com",
	"to_sms" : "6128120123",
	"short_code" : "H3920S02"
}
Error Response
{
	"error": true,
	"text": "SEE BELOW"
}
Reason Text
The gift amount is more than the balance of the account Not enough funds in your account

/get-all-events

Get All Events

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-all-events"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333

Example GET

$url = "https://data.dotopia.com/api/get-all-events?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/get-volunteer-events

Get All Volunteer Events

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-volunteer-events"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333

Example GET

$url = "https://data.dotopia.com/api/get-volunteer-events?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/get-fundraiser-events

Get All Fundraiser Events

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-fundraiser-events"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333

Example GET

$url = "https://data.dotopia.com/api/get-fundraiser-events?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/get-a-event

Get An Event's Details

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-a-event/{event_id}"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333
event_id Event ID 2

Example GET

$url = "https://data.dotopia.com/api/get-a-event/{event_id}?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/sign-up

Signup For An Event

Note All parameters must be sent in the request body, not as part of the query string.

Example

POST "https://data.dotopia.com/api/sign-up"

Properties

name description example value
client_id Unique DoTopia Issued Client ID 21
client_secret Unique DoTopia Issued Client Secret (Do not use on frontend. Server code use only) DTP20LAFK443333
event_id Event ID 2
ticket_id Ticket ID 12
quantity Quantity 2
attendee_firstname Attendee First Name John
attendee_lastname Attendee Last Name Doe
attendee_email Attendee Email John.Doe@gmail.com
stripe_token A unique transaction token passed from Stripe 2K3K22L1

Example POST

$fields = array(
   'client_id' => "21",
   'client_secret' => "DTP20LAFK443333",
   'event_id' => "2",
   'ticket_id' => "2",
   'attendee_firstname' => "John",
   'attendee_lastname' => "Doe",
   'attendee_email' => "John.Doe@gmail.com",
   'stripe_token' => "2K3K22L1",
);
$url = "https://data.dotopia.com/api/sign-up;
$ch = curl_init();
$authorization = "Authorization: Bearer [ACCESS_TOKEN_HERE]";
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/get-all-campaigns

Get All Campaigns

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-all-campaigns"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333

Example GET

$url = "https://data.dotopia.com/api/get-all-campaigns?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/get-a-campaign

Get A Campaign's Details

Note All parameters must be sent as part of the query string.

Example

GET "https://data.dotopia.com/api/get-a-campaign/{campaigns_id}"

Properties

name description example value
client_id Unique DoTopia Issued Client ID DTP20LAFK443333
campaign_id Campaign ID 2

Example GET

$url = "https://data.dotopia.com/api/get-a-campaign/{campaign_id}?client_id=DTP20LAFK443333";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

/donate-with-card


/donate-with-dodollars