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 response = await client.bulk.retrieveJob('job_id');
console.log(response.job);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
response = client.bulk.retrieve_job(
"job_id",
)
print(response.job)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"),
)
response, err := client.Bulk.GetJob(context.TODO(), "job_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Job)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.bulk.BulkRetrieveJobParams;
import com.courier.models.bulk.BulkRetrieveJobResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
BulkRetrieveJobResponse response = client.bulk().retrieveJob("job_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.bulk.retrieve_job("job_id")
puts(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 {
$response = $client->bulk->retrieveJob('job_id');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Bulk;
CourierClient client = new();
BulkRetrieveJobParams parameters = new() { JobID = "job_id" };
var response = await client.Bulk.RetrieveJob(parameters);
Console.WriteLine(response);courier bulk retrieve-job \
--api-key 'My API Key' \
--job-id job_idcurl --request GET \
--url https://api.courier.com/bulk/{job_id} \
--header 'Authorization: Bearer <token>'{
"job": {
"definition": {
"brand": "string",
"data": {},
"event": "string",
"template": "string",
"content": {
"title": "Example Name",
"body": "string"
},
"locale": {
"locale_key": {}
},
"override": {}
},
"enqueued": 1,
"failures": 1,
"received": 1,
"status": "CREATED"
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}Bulk
Get a Job
Returns a bulk job’s message definition, its status — CREATED, PROCESSING, COMPLETED, or ERROR — and running counts of users received, messages enqueued, and failures. Poll it to follow a job through to completion.
GET
/
bulk
/
{job_id}
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 response = await client.bulk.retrieveJob('job_id');
console.log(response.job);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
response = client.bulk.retrieve_job(
"job_id",
)
print(response.job)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"),
)
response, err := client.Bulk.GetJob(context.TODO(), "job_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Job)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.bulk.BulkRetrieveJobParams;
import com.courier.models.bulk.BulkRetrieveJobResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
BulkRetrieveJobResponse response = client.bulk().retrieveJob("job_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.bulk.retrieve_job("job_id")
puts(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 {
$response = $client->bulk->retrieveJob('job_id');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Bulk;
CourierClient client = new();
BulkRetrieveJobParams parameters = new() { JobID = "job_id" };
var response = await client.Bulk.RetrieveJob(parameters);
Console.WriteLine(response);courier bulk retrieve-job \
--api-key 'My API Key' \
--job-id job_idcurl --request GET \
--url https://api.courier.com/bulk/{job_id} \
--header 'Authorization: Bearer <token>'{
"job": {
"definition": {
"brand": "string",
"data": {},
"event": "string",
"template": "string",
"content": {
"title": "Example Name",
"body": "string"
},
"locale": {
"locale_key": {}
},
"override": {}
},
"enqueued": 1,
"failures": 1,
"received": 1,
"status": "CREATED"
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}⌘I