コンテンツブロックを作成
post
/content_blocks/create
コンテンツ・ブロックを作成するには、このエンドポイントを使用します。
前提条件
このエンドポイントを使用するには、content_blocks.create パーミッションを持つAPI キーが必要です。
レート制限
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
リクエスト本文
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 |任意|文字列の配列|タグはすでに存在していなければならない。 | 
    
リクエスト例
1
2
3
4
5
6
7
8
9
10
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
7
8
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
  "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 | 
      指定されたリキッドは有効でないか、解析できません。有効なリキッドで再試行するか、サポートまでご連絡ください。 | |
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 |コンテンツブロック名には、次のいずれかの文字を含めることができます:文字(大文字または小文字)A ~Z 、数字0 ~9 、ダッシュ- 、アンダースコア_ 。絵文字、! 、@ 、~ 、& 、その他の「特殊」文字など、英数字以外の文字を含めることはできません。 | 
      ||
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に存在している必要があります。 | 
      
   Edit this page on GitHub