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 deviceSet = await client.previews.updateDeviceSet('deviceSetId', {
device_ids: ['pvd_1w6dgafr3aaycvv9a8bm996pkc', 'pvd_34qvmj6p4dbqaa5mpys1ekt9jx'],
name: 'Mobile and desktop',
});
console.log(deviceSet.id);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
device_set = client.previews.update_device_set(
device_set_id="deviceSetId",
device_ids=["pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"],
name="Mobile and desktop",
)
print(device_set.id)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"),
)
deviceSet, err := client.Previews.UpdateDeviceSet(
context.TODO(),
"deviceSetId",
courier.PreviewUpdateDeviceSetParams{
CreateDeviceSetRequest: courier.CreateDeviceSetRequestParam{
DeviceIDs: []string{"pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"},
Name: "Mobile and desktop",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deviceSet.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.previews.CreateDeviceSetRequest;
import com.courier.models.previews.DeviceSet;
import com.courier.models.previews.PreviewUpdateDeviceSetParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
PreviewUpdateDeviceSetParams params = PreviewUpdateDeviceSetParams.builder()
.deviceSetId("deviceSetId")
.createDeviceSetRequest(CreateDeviceSetRequest.builder()
.addDeviceId("pvd_1w6dgafr3aaycvv9a8bm996pkc")
.addDeviceId("pvd_34qvmj6p4dbqaa5mpys1ekt9jx")
.name("Mobile and desktop")
.build())
.build();
DeviceSet deviceSet = client.previews().updateDeviceSet(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
device_set = courier.previews.update_device_set(
"deviceSetId",
device_ids: ["pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"],
name: "Mobile and desktop"
)
puts(device_set)<?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 {
$deviceSet = $client->previews->updateDeviceSet(
'deviceSetId',
deviceIDs: [
'pvd_1w6dgafr3aaycvv9a8bm996pkc', 'pvd_34qvmj6p4dbqaa5mpys1ekt9jx'
],
name: 'Mobile and desktop',
);
var_dump($deviceSet);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Previews;
CourierClient client = new();
PreviewUpdateDeviceSetParams parameters = new()
{
DeviceSetID = "deviceSetId",
DeviceIds =
[
"pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"
],
Name = "Mobile and desktop",
};
var deviceSet = await client.Previews.UpdateDeviceSet(parameters);
Console.WriteLine(deviceSet);courier previews update-device-set \
--api-key 'My API Key' \
--device-set-id deviceSetId \
--device-id pvd_1w6dgafr3aaycvv9a8bm996pkc \
--device-id pvd_34qvmj6p4dbqaa5mpys1ekt9jx \
--name 'Mobile and desktop'curl --request PUT \
--url https://api.courier.com/previews/device-sets/{deviceSetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mobile and desktop",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc",
"pvd_34qvmj6p4dbqaa5mpys1ekt9jx"
]
}
'{
"id": "<string>",
"name": "<string>",
"device_ids": [
"<string>"
],
"created_at": "<string>",
"updated_at": "<string>",
"archived_at": "<string>"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "device set pvs_01m2np6evsfam98rf7t6a2k6n1 is the Courier default set and cannot be changed or archived"
}{
"message": "<string>",
"type": "invalid_request_error"
}Previews
Update Device Set
Replace a device set. This is a full replace, not a patch — both the name and the device list are always written. The Courier-provided default set cannot be changed and returns 409.
PUT
/
previews
/
device-sets
/
{deviceSetId}
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 deviceSet = await client.previews.updateDeviceSet('deviceSetId', {
device_ids: ['pvd_1w6dgafr3aaycvv9a8bm996pkc', 'pvd_34qvmj6p4dbqaa5mpys1ekt9jx'],
name: 'Mobile and desktop',
});
console.log(deviceSet.id);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
device_set = client.previews.update_device_set(
device_set_id="deviceSetId",
device_ids=["pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"],
name="Mobile and desktop",
)
print(device_set.id)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"),
)
deviceSet, err := client.Previews.UpdateDeviceSet(
context.TODO(),
"deviceSetId",
courier.PreviewUpdateDeviceSetParams{
CreateDeviceSetRequest: courier.CreateDeviceSetRequestParam{
DeviceIDs: []string{"pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"},
Name: "Mobile and desktop",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deviceSet.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.previews.CreateDeviceSetRequest;
import com.courier.models.previews.DeviceSet;
import com.courier.models.previews.PreviewUpdateDeviceSetParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
PreviewUpdateDeviceSetParams params = PreviewUpdateDeviceSetParams.builder()
.deviceSetId("deviceSetId")
.createDeviceSetRequest(CreateDeviceSetRequest.builder()
.addDeviceId("pvd_1w6dgafr3aaycvv9a8bm996pkc")
.addDeviceId("pvd_34qvmj6p4dbqaa5mpys1ekt9jx")
.name("Mobile and desktop")
.build())
.build();
DeviceSet deviceSet = client.previews().updateDeviceSet(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
device_set = courier.previews.update_device_set(
"deviceSetId",
device_ids: ["pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"],
name: "Mobile and desktop"
)
puts(device_set)<?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 {
$deviceSet = $client->previews->updateDeviceSet(
'deviceSetId',
deviceIDs: [
'pvd_1w6dgafr3aaycvv9a8bm996pkc', 'pvd_34qvmj6p4dbqaa5mpys1ekt9jx'
],
name: 'Mobile and desktop',
);
var_dump($deviceSet);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Previews;
CourierClient client = new();
PreviewUpdateDeviceSetParams parameters = new()
{
DeviceSetID = "deviceSetId",
DeviceIds =
[
"pvd_1w6dgafr3aaycvv9a8bm996pkc", "pvd_34qvmj6p4dbqaa5mpys1ekt9jx"
],
Name = "Mobile and desktop",
};
var deviceSet = await client.Previews.UpdateDeviceSet(parameters);
Console.WriteLine(deviceSet);courier previews update-device-set \
--api-key 'My API Key' \
--device-set-id deviceSetId \
--device-id pvd_1w6dgafr3aaycvv9a8bm996pkc \
--device-id pvd_34qvmj6p4dbqaa5mpys1ekt9jx \
--name 'Mobile and desktop'curl --request PUT \
--url https://api.courier.com/previews/device-sets/{deviceSetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mobile and desktop",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc",
"pvd_34qvmj6p4dbqaa5mpys1ekt9jx"
]
}
'{
"id": "<string>",
"name": "<string>",
"device_ids": [
"<string>"
],
"created_at": "<string>",
"updated_at": "<string>",
"archived_at": "<string>"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "device set pvs_01m2np6evsfam98rf7t6a2k6n1 is the Courier default set and cannot be changed or archived"
}{
"message": "<string>",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The preview set to replace.
Body
application/json
Response
A named, reusable list of preview devices.
Unique identifier for the device set.
Human-readable name.
The devices in this set, by PreviewDevice.id.
ISO-8601 timestamp of when the set was created.
ISO-8601 timestamp of when the set was last written.
ISO-8601 timestamp of when the set was archived. Present only on the archive response, which is the one place the state is observable.
⌘I