JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const notificationTemplateVersionListResponse = await client.journeys.templates.listVersions('x', {
templateId: 'x',
});
console.log(notificationTemplateVersionListResponse.paging);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_template_version_list_response = client.journeys.templates.list_versions(
notification_id="x",
template_id="x",
)
print(notification_template_version_list_response.paging)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
notificationTemplateVersionListResponse, err := client.Journeys.Templates.ListVersions(
context.TODO(),
"x",
courier.JourneyTemplateListVersionsParams{
TemplateID: "x",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationTemplateVersionListResponse.Paging)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.journeys.templates.TemplateListVersionsParams;
import com.courier.models.notifications.NotificationTemplateVersionListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateListVersionsParams params = TemplateListVersionsParams.builder()
.templateId("x")
.notificationId("x")
.build();
NotificationTemplateVersionListResponse notificationTemplateVersionListResponse = client.journeys().templates().listVersions(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_template_version_list_response = courier.journeys.templates.list_versions("x", template_id: "x")
puts(notification_template_version_list_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$notificationTemplateVersionListResponse = $client
->journeys
->templates
->listVersions('x', templateID: 'x');
var_dump($notificationTemplateVersionListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Journeys.Templates;
CourierClient client = new();
TemplateListVersionsParams parameters = new()
{
TemplateID = "x",
NotificationID = "x",
};
var notificationTemplateVersionListResponse = await client.Journeys.Templates.ListVersions(parameters);
Console.WriteLine(notificationTemplateVersionListResponse);courier journeys:templates list-versions \
--api-key 'My API Key' \
--template-id x \
--notification-id xcurl --request GET \
--url https://api.courier.com/journeys/{templateId}/templates/{notificationId}/versions \
--header 'Authorization: Bearer <token>'{
"versions": [
{
"version": "v2",
"created": 1715000400000,
"creator": "user-1"
},
{
"version": "v1",
"created": 1715000200000,
"creator": "user-1"
}
],
"paging": {
"more": false
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Journeys
List versions of a journey-scoped notification template
List published versions of the journey-scoped notification template, ordered most recent first.
GET
/
journeys
/
{templateId}
/
templates
/
{notificationId}
/
versions
JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const notificationTemplateVersionListResponse = await client.journeys.templates.listVersions('x', {
templateId: 'x',
});
console.log(notificationTemplateVersionListResponse.paging);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_template_version_list_response = client.journeys.templates.list_versions(
notification_id="x",
template_id="x",
)
print(notification_template_version_list_response.paging)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
notificationTemplateVersionListResponse, err := client.Journeys.Templates.ListVersions(
context.TODO(),
"x",
courier.JourneyTemplateListVersionsParams{
TemplateID: "x",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationTemplateVersionListResponse.Paging)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.journeys.templates.TemplateListVersionsParams;
import com.courier.models.notifications.NotificationTemplateVersionListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateListVersionsParams params = TemplateListVersionsParams.builder()
.templateId("x")
.notificationId("x")
.build();
NotificationTemplateVersionListResponse notificationTemplateVersionListResponse = client.journeys().templates().listVersions(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_template_version_list_response = courier.journeys.templates.list_versions("x", template_id: "x")
puts(notification_template_version_list_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$notificationTemplateVersionListResponse = $client
->journeys
->templates
->listVersions('x', templateID: 'x');
var_dump($notificationTemplateVersionListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Journeys.Templates;
CourierClient client = new();
TemplateListVersionsParams parameters = new()
{
TemplateID = "x",
NotificationID = "x",
};
var notificationTemplateVersionListResponse = await client.Journeys.Templates.ListVersions(parameters);
Console.WriteLine(notificationTemplateVersionListResponse);courier journeys:templates list-versions \
--api-key 'My API Key' \
--template-id x \
--notification-id xcurl --request GET \
--url https://api.courier.com/journeys/{templateId}/templates/{notificationId}/versions \
--header 'Authorization: Bearer <token>'{
"versions": [
{
"version": "v2",
"created": 1715000400000,
"creator": "user-1"
},
{
"version": "v1",
"created": 1715000200000,
"creator": "user-1"
}
],
"paging": {
"more": false
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Journey id
Minimum string length:
1Notification template id
Minimum string length:
1Publish a journey-scoped notification templateFetch the content of a journey-scoped notification template
⌘I