Skip to content

コンテンツブロックを作成する

post

/content_blocks/create

このエンドポイントを使用して、Content Blockを作成します。

前提条件

このエンドポイントを使用するには、content_blocks.create 権限を持つ APIキーが必要です。

レート制限

APIレート制限に記載されているように、このエンドポイントにはデフォルトのBrazeレート制限(1時間あたり250,000リクエスト)が適用されます。

リクエスト本文

1
2
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
1
2
3
4
5
6
7
{
  "name": (required, string) Must be less than 100 characters,
  "description": (optional, string) The description of the Content Block. Must be less than 250 character,
  "content": (required, string) HTML or text content within Content Block,
  "state": (optional, string) Choose `active` or `draft`. Defaults to `active` if not specified,
  "tags": (optional, array of strings) Tags must already exist
}

リクエストパラメーター

パラメーター 必須 データタイプ 説明
name 必須 文字列 コンテンツブロックの名前。100文字未満である必要があります。
description オプション 文字列 コンテンツブロックの説明。250文字未満である必要があります。
content 必須 文字列 コンテンツブロック内のHTMLまたはテキストコンテンツ。
state オプション 文字列 active または draft を選択します。指定しない場合、デフォルトは active です。
tags オプション 文字列の配列 タグはすでに存在している必要があります。

リクエスト例

curl --location --request POST 'https://rest.iad-01.braze.com/content_blocks/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_REST_API_KEY' \
--data-raw '{
  "name": "content_block",
  "description": "This is my Content Block",
  "content": "HTML content within block",
  "state": "draft",
  "tags": ["marketing"]
}'

応答

1
2
3
4
5
6
{
  "content_block_id": (string) Your newly generated block id,
  "liquid_tag": (string) The generated block tag from the Content Block name,
  "created_at": (string) The time the Content Block was created in ISO 8601,
  "message": "success"
}

トラブルシューティング

次の表に、返される可能性のあるエラーと、関連するトラブルシューティングステップを示します。

エラー トラブルシューティング  
Content cannot be blank    
Content must be a string コンテンツが引用符("")で囲まれていることを確認してください。  
Content must be smaller than 50kb コンテンツブロックのコンテンツは合計50KB未満である必要があります。  
Content contains malformed liquid 指定されたLiquidは有効でないか、解析できません。有効なLiquidで再試行するか、サポートにお問い合わせください。  
Content Block cannot be referenced within itself    
Content Block description cannot be blank    
Content Block description must be a string コンテンツブロックの説明が引用符("")で囲まれていることを確認してください。  
Content Block description must be shorter than 250 characters    
Content Block name cannot be blank    
Content Block name must be shorter than 100 characters    
Content Block name can only contain alphanumeric characters コンテンツブロック名には、文字(大文字または小文字)AZ、数字 09、ダッシュ -、アンダースコア _ のいずれかを含めることができます。絵文字、!@~&、その他の「特殊」文字など、英数字以外の文字を含めることはできません。  
Content Block with this name already exists 別の名前をお試しください。  
Content Block state must be either active or draft    
Tags must be an array タグは文字列の配列としてフォーマットする必要があります(例:["marketing", "promotional", "transactional"])。  
All tags must be strings タグが引用符("")で囲まれていることを確認してください。  
Some tags could not be found コンテンツブロックの作成時にタグを追加するには、そのタグがすでにBrazeに存在している必要があります。  
New Stuff!