Update an unsubscribe group
Partial update (only name / description). PUT is not routed.
PATCH
/
email_unsubscribe_groups
/
{id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const UnsubscribeGroup = await client.emailUnsubscribeGroups.update('id', {
name: 'name',
});
console.log(UnsubscribeGroup.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
unsubscribe_group = client.email_unsubscribe_groups.update(
id="id",
name="name",
)
print(unsubscribe_group.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
emailUnsubscribeGroup, err := client.EmailUnsubscribeGroups.Update(
context.TODO(),
"id",
telnyx.EmailUnsubscribeGroupUpdateParams{
Name: telnyx.String("name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailUnsubscribeGroup.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailUnsubscribeGroups.EmailUnsubscribeGroupUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailUnsubscribeGroupUpdateParams params = EmailUnsubscribeGroupUpdateParams.builder()
.name("name")
.build();
var response = client.emailUnsubscribeGroups().update("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
unsubscribe_group = telnyx.email_unsubscribe_groups.update("id", name: "name")
puts(unsubscribe_group)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$unsubscribe_group = $client->emailUnsubscribeGroups->update(
'id',
name: 'name',
);
var_dump($unsubscribe_group);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups update \
--api-key 'My API Key' \
--id id \
--name namecurl --request PATCH \
--url https://api.telnyx.com/v2/email_unsubscribe_groups/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Weekly product updates and promotions"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_unsubscribe_group",
"name": "string",
"description": "string",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email block was not found"
}
]
}{
"errors": [
{
"code": "406",
"title": "Not Acceptable",
"detail": "Not Acceptable"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "can't be blank",
"source": {
"pointer": "/data/attributes/to"
}
}
]
}Authorizations
Telnyx API key supplied as Authorization: Bearer <token>. In production, auth may be validated by the API gateway and forwarded via Telnyx auth headers.
Path Parameters
Resource UUID. Malformed UUIDs are treated as not-found (not 400).
Body
application/json
Response
The updated group.
Show child attributes
Show child attributes
Was this page helpful?
โI
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const UnsubscribeGroup = await client.emailUnsubscribeGroups.update('id', {
name: 'name',
});
console.log(UnsubscribeGroup.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
unsubscribe_group = client.email_unsubscribe_groups.update(
id="id",
name="name",
)
print(unsubscribe_group.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
emailUnsubscribeGroup, err := client.EmailUnsubscribeGroups.Update(
context.TODO(),
"id",
telnyx.EmailUnsubscribeGroupUpdateParams{
Name: telnyx.String("name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailUnsubscribeGroup.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailUnsubscribeGroups.EmailUnsubscribeGroupUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailUnsubscribeGroupUpdateParams params = EmailUnsubscribeGroupUpdateParams.builder()
.name("name")
.build();
var response = client.emailUnsubscribeGroups().update("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
unsubscribe_group = telnyx.email_unsubscribe_groups.update("id", name: "name")
puts(unsubscribe_group)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$unsubscribe_group = $client->emailUnsubscribeGroups->update(
'id',
name: 'name',
);
var_dump($unsubscribe_group);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups update \
--api-key 'My API Key' \
--id id \
--name namecurl --request PATCH \
--url https://api.telnyx.com/v2/email_unsubscribe_groups/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Weekly product updates and promotions"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_unsubscribe_group",
"name": "string",
"description": "string",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email block was not found"
}
]
}{
"errors": [
{
"code": "406",
"title": "Not Acceptable",
"detail": "Not Acceptable"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "can't be blank",
"source": {
"pointer": "/data/attributes/to"
}
}
]
}