Skip to content

Instantly share code, notes, and snippets.

@biancalpadilla
Created June 15, 2020 19:15
Show Gist options
  • Save biancalpadilla/543ce9194c306812ba0de1cc1dab322a to your computer and use it in GitHub Desktop.
Save biancalpadilla/543ce9194c306812ba0de1cc1dab322a to your computer and use it in GitHub Desktop.
POSTMARK EXAMPLES, available in curl, Ruby, C#, PHP, Node.js
# Copy and paste this into terminal
curl "https://api.postmarkapp.com/email/withTemplate" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Postmark-Server-Token: TOKEN" \
-d '{
"From": "sender@example.com",
"To": "recipient@example.com",
"TemplateAlias": "receipt",
"TemplateModel": {
"shipping": {
"first_name": "first_name_Value",
"last_name": "last_name_Value",
"street_1": "street_1_Value",
"street_2": "street_2_Value",
"city": "city_Value",
"state": "state_Value",
"zip": "zip_Value",
"phone": "phone_Value"
},
"order": {
"id": "id_Value",
"date_created": "date_created_Value",
"total_inc_tax": "total_inc_tax_Value",
"items_total": "items_total_Value",
"discount": {
"total": "total_Value"
},
"coupon": {
"total": "total_Value"
},
"store_credit": {
"total": "total_Value"
},
"subtotal_ex_tax": "subtotal_ex_tax_Value",
"free_shipping": {
},
"base_shipping_cost": "base_shipping_cost_Value",
"total_tax": "total_tax_Value"
},
"products": [
{
"url": "url_Value",
"image_url": "image_url_Value",
"name": "name_Value",
"options": [
{
"display_value": "display_value_Value"
}
],
"quantity": "quantity_Value",
"base_price": "base_price_Value"
}
],
"email": "email_Value"
}
}'
# Send an email with curl
curl "https://api.postmarkapp.com/email/withTemplate" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Postmark-Server-Token: TOKEN" \
-d '{
"From": "sender@example.com",
"To": "recipient@example.com",
"TemplateAlias": "shipment-confirmation",
"TemplateModel": {
"shipments": [
{
"tracking_number": "tracking_number_Value",
"items": [
{
"url": "url_Value",
"image_url": "image_url_Value",
"name": "name_Value",
"options": [
{
"display_value": "display_value_Value"
}
],
"quantity": "quantity_Value",
"base_price": "base_price_Value"
}
]
}
],
"order": {
"id": "id_Value",
"date_created": "date_created_Value",
"total_inc_tax": "total_inc_tax_Value",
"items_total": "items_total_Value",
"discount": {
"total": "total_Value"
},
"coupon": {
"total": "total_Value"
},
"store_credit": {
"total": "total_Value"
},
"subtotal_ex_tax": "subtotal_ex_tax_Value",
"free_shipping": {
},
"base_shipping_cost": "base_shipping_cost_Value",
"total_tax": "total_tax_Value"
},
"shipping": {
"first_name": "first_name_Value",
"last_name": "last_name_Value",
"street_1": "street_1_Value",
"street_2": "street_2_Value",
"city": "city_Value",
"state": "state_Value",
"zip": "zip_Value",
"phone": "phone_Value"
},
"multiple_shipments": {
"shipments": [
{
"package": "package_Value",
"tracking_number": "tracking_number_Value",
"items": [
{
"url": "url_Value",
"image_url": "image_url_Value",
"name": "name_Value",
"options": [
{
"display_value": "display_value_Value"
}
],
"quantity": "quantity_Value",
"base_price": "base_price_Value"
}
]
}
]
},
"email": "email_Value"
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment