NAV
shell ruby python csharp php

EmailTemplate

The EmailTemplate object

The EmailTemplate object looks like this in JSON:

{
    "object": "email_template",
    "id": 7,
    "modified_by_id": 1,
    "name": "Overdue Invoices",
    "body": "Dear {!RECIPIENT_FIRSTNAME!},<br \/><br \/>\nYou have overdue invoices. Please log in to Populi to view your invoiced charges and pay them now.",
    "reply_to": null,
    "cc": null,
    "bcc": null,
    "subject": "Overdue Invoices",
    "added_at": "2009-01-14T23:12:01+00:00",
    "added_by_id": 1,
    "updated_at": "2020-04-21T00:37:40+00:00",
    "sandbox": true
}
Attribute Required Data Type
id Yes int
modified_by_id No int
name Yes text (100)
body Yes text
reply_to Yes text
cc No text
bcc No text
subject Yes text
added_at Yes datetime
added_by_id No int
updated_at Yes datetime
sandbox No bool

index

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/emailtemplates" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/emailtemplates',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/emailtemplates',
 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/emailtemplates"), 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/emailtemplates');
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": 1,
    "results": 1,
    "results_per_page": null,
    "pages": 1,
    "page": 1,
    "offset": 0,
    "has_more": false,
    "data": [
        {
            "object": "email_template",
            "id": 7,
            "modified_by_id": 1,
            "name": "Overdue Invoices",
            "body": "Dear {!RECIPIENT_FIRSTNAME!},<br \/><br \/>\nYou have overdue invoices. Please log in to Populi to view your invoiced charges and pay them now.",
            "reply_to": null,
            "cc": null,
            "bcc": null,
            "subject": "Overdue Invoices",
            "added_at": "2009-01-14T23:12:01+00:00",
            "added_by_id": 1,
            "updated_at": "2020-04-21T00:37:40+00:00"
        }
    ],
    "sandbox": true
}

Retrieves all EmailTemplate objects.

HTTP Request

GET /emailtemplates

Parameters

None

Permissions

One of the following roles is required to call this method:

show

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/emailtemplates/(emailtemplate)" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/emailtemplates/(emailtemplate)',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/emailtemplates/(emailtemplate)',
 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/emailtemplates/(emailtemplate)"), 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/emailtemplates/(emailtemplate)');
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": "email_template",
    "id": 7,
    "modified_by_id": 1,
    "name": "Overdue Invoices",
    "body": "Dear {!RECIPIENT_FIRSTNAME!},<br \/><br \/>\nYou have overdue invoices. Please log in to Populi to view your invoiced charges and pay them now.",
    "reply_to": null,
    "cc": null,
    "bcc": null,
    "subject": "Overdue Invoices",
    "files": [],
    "added_at": "2009-01-14T23:12:01+00:00",
    "added_by_id": 1,
    "updated_at": "2020-04-21T00:37:40+00:00",
    "sandbox": true
}

Retrieves a specific EmailTemplate object.

HTTP Request

GET /emailtemplates/(emailtemplate)

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: