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 previewRunListResponse = await client.notifications.previews.runs.list('id');
console.log(previewRunListResponse.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
)
preview_run_list_response = client.notifications.previews.runs.list(
id="id",
)
print(preview_run_list_response.paging)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
previewRunListResponse, err := client.Notifications.Previews.Runs.List(
context.TODO(),
"id",
courier.NotificationPreviewRunListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", previewRunListResponse.Paging)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.notifications.previews.runs.PreviewRunListResponse;
import com.courier.models.notifications.previews.runs.RunListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
PreviewRunListResponse previewRunListResponse = client.notifications().previews().runs().list("id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
preview_run_list_response = courier.notifications.previews.runs.list("id")
puts(preview_run_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 {
$previewRunListResponse = $client->notifications->previews->runs->list(
'id', cursor: 'cursor', limit: 1
);
var_dump($previewRunListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Notifications.Previews.Runs;
CourierClient client = new();
RunListParams parameters = new() { ID = "id" };
var previewRunListResponse = await client.Notifications.Previews.Runs.List(parameters);
Console.WriteLine(previewRunListResponse);courier notifications:previews:runs list \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.courier.com/notifications/{id}/previews/runs \
--header 'Authorization: Bearer <token>'{
"paging": {
"more": true,
"cursor": "<string>"
},
"results": [
{
"id": "<string>",
"template_id": "<string>",
"status": "PENDING",
"device_ids": [
"<string>"
],
"created_at": "<string>",
"template_version": "<string>",
"failure_reason": "TEMPLATE_NOT_SUPPORTED"
}
]
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "notification template nt_01kx4h2jdafq8bk9amzvy6hbv0 not found"
}Previews
List Preview Runs
List this template’s preview runs, newest first. Cursor-paginated.
A template that does not exist is a 404, the same as every other /notifications/{id} route.
GET
/
notifications
/
{id}
/
previews
/
runs
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 previewRunListResponse = await client.notifications.previews.runs.list('id');
console.log(previewRunListResponse.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
)
preview_run_list_response = client.notifications.previews.runs.list(
id="id",
)
print(preview_run_list_response.paging)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
previewRunListResponse, err := client.Notifications.Previews.Runs.List(
context.TODO(),
"id",
courier.NotificationPreviewRunListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", previewRunListResponse.Paging)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.notifications.previews.runs.PreviewRunListResponse;
import com.courier.models.notifications.previews.runs.RunListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
PreviewRunListResponse previewRunListResponse = client.notifications().previews().runs().list("id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
preview_run_list_response = courier.notifications.previews.runs.list("id")
puts(preview_run_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 {
$previewRunListResponse = $client->notifications->previews->runs->list(
'id', cursor: 'cursor', limit: 1
);
var_dump($previewRunListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Notifications.Previews.Runs;
CourierClient client = new();
RunListParams parameters = new() { ID = "id" };
var previewRunListResponse = await client.Notifications.Previews.Runs.List(parameters);
Console.WriteLine(previewRunListResponse);courier notifications:previews:runs list \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.courier.com/notifications/{id}/previews/runs \
--header 'Authorization: Bearer <token>'{
"paging": {
"more": true,
"cursor": "<string>"
},
"results": [
{
"id": "<string>",
"template_id": "<string>",
"status": "PENDING",
"device_ids": [
"<string>"
],
"created_at": "<string>",
"template_version": "<string>",
"failure_reason": "TEMPLATE_NOT_SUPPORTED"
}
]
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "notification template nt_01kx4h2jdafq8bk9amzvy6hbv0 not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Template ID (nt_ prefix).
Query Parameters
Opaque pagination cursor from a previous response. Omit for the first page.
Maximum number of results per page.
Required range:
x >= 1⌘I