Campaign
The Campaign object
The Campaign object looks like this in JSON:
{
"object": "campaign",
"id": 1,
"name": "New Building Campaign",
"goal": null,
"deadline": null,
"status": "active",
"added_at": "2014-04-04T17:22:56+00:00",
"added_by_id": 1257,
"sandbox": true
}
| Attribute | Required | Data Type |
|---|---|---|
| id | Yes | int |
| name | No | text (500) |
| goal | No | decimal |
| deadline | No | datetime |
| status | Yes | enum (active, inactive, deleted) |
| added_at | No | datetime |
| added_by_id | No | int |
| sandbox | No | bool |
index
Example code to call this method:
curl "https://yourschool.populiweb.com/api2/campaigns" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \
-X GET
require 'httparty'
response = HTTParty.get(
'https://yourschool.populiweb.com/api2/campaigns',
headers: {
'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
},
)
puts response.body
import requests
response = requests.get(
'https://yourschool.populiweb.com/api2/campaigns',
headers={
'Authorization': 'Bearer YOUR_POPULI_API_KEY'
},
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/campaigns"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/campaigns');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);
Example response:
{
"object": "list",
"count": 3,
"results": 3,
"results_per_page": null,
"pages": 1,
"page": 1,
"offset": 0,
"has_more": false,
"data": [
{
"object": "campaign",
"id": 3,
"name": "A really old campaign",
"goal": null,
"deadline": null,
"status": "inactive",
"total_donations": "200.00",
"roi": "18.80",
"added_at": "2014-04-04T17:26:52+00:00",
"added_by_id": 1257
}
],
"sandbox": true
}
Retrieves all Campaign objects.
HTTP Request
GET /campaigns
Parameters
None
Permissions
One of the following roles is required to call this method:
- Donations
- Financial Auditor
- Financial Admin
show
Example code to call this method:
curl "https://yourschool.populiweb.com/api2/campaigns/(campaign)" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \
-X GET
require 'httparty'
response = HTTParty.get(
'https://yourschool.populiweb.com/api2/campaigns/(campaign)',
headers: {
'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
},
)
puts response.body
import requests
response = requests.get(
'https://yourschool.populiweb.com/api2/campaigns/(campaign)',
headers={
'Authorization': 'Bearer YOUR_POPULI_API_KEY'
},
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/campaigns/(campaign)"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/campaigns/(campaign)');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);
Example response:
{
"object": "campaign",
"id": 1,
"name": "New Building Campaign",
"goal": null,
"deadline": null,
"status": "active",
"added_at": "2014-04-04T17:22:56+00:00",
"added_by_id": 1257,
"sandbox": true
}
Retrieves a specific Campaign object.
HTTP Request
GET /campaigns/(campaign)
Parameters
No additional parameters are needed beyond the ID of the object being requested that appears in the URL.
Permissions
One of the following roles is required to call this method:
- Donations
- Financial Auditor
- Financial Admin