Skip to content

カタログを作成する

post

/catalogs

このエンドポイントを使用してカタログを作成します。

前提条件

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

レート制限

このエンドポイントには、APIレート制限に記載されているように、すべての同期カタログエンドポイント間で1分あたり50リクエストの共有レート制限があります。

リクエストパラメーター

パラメーター 必須 データタイプ 説明
catalogs 必須 配列 カタログオブジェクトを含む配列。このリクエストでは、カタログオブジェクトは1つのみ許可されます。

カタログオブジェクトのパラメーター

パラメーター 必須 データタイプ 説明
name 必須 文字列 作成するカタログの名前。
description 必須 文字列 作成するカタログの説明。
fields 必須 配列 キー nametype を含むオブジェクトの配列。

リクエスト例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
curl --location --request POST 'https://rest.iad-03.braze.com/catalogs' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
  "catalogs": [
    {
      "name": "restaurants",
      "description": "My Restaurants",
      "fields": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "Name",
          "type": "string"
        },
        {
          "name": "City",
          "type": "string"
        },
        {
          "name": "Cuisine",
          "type": "string"
        },
        {
          "name": "Rating",
          "type": "number"
        },
        {
          "name": "Loyalty_Program",
          "type": "boolean"
        },
        {
          "name": "Location",
          "type": "geo"
        },
        {
          "name": "Preferences",
          "type": "object"
        },
        {
          "name": "Top_Dishes",
          "type": "array"
        },
        {
          "name": "Created_At",
          "type": "time"
        }
      ]
    }
  ]
}'

応答

このエンドポイントには 201400 の2つのステータスコード応答があります。

成功応答の例

ステータスコード 201 は、次の応答本文を返す可能性があります。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
  "catalogs": [
    {
      "description": "My Restaurants",
      "fields": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "Name",
          "type": "string"
        },
        {
          "name": "City",
          "type": "string"
        },
        {
          "name": "Cuisine",
          "type": "string"
        },
        {
          "name": "Rating",
          "type": "number"
        },
        {
          "name": "Loyalty_Program",
          "type": "boolean"
        },
        {
          "name": "Location",
          "type": "geo"
        },
        {
          "name": "Preferences",
          "type": "object"
        },
        {
          "name": "Top_Dishes",
          "type": "array"
        },
        {
          "name": "Created_At",
          "type": "time"
        }
      ],
      "name": "restaurants",
      "num_items": 0,
      "updated_at": "2022-11-02T20:04:06.879+00:00"
    }
  ],
  "message": "success"
}

エラー応答の例

ステータスコード 400 は、次の応答本文を返す可能性があります。遭遇する可能性のあるエラーの詳細については、「トラブルシューティング」を参照してください。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "errors": [
    {
      "id": "catalog-name-already-exists",
      "message": "A catalog with that name already exists",
      "parameters": [
        "name"
      ],
      "parameter_values": [
        "restaurants"
      ]
    }
  ],
  "message": "Invalid Request"
}

トラブルシューティング

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

エラー トラブルシューティング
catalog-array-invalid catalogs はオブジェクトの配列でなければなりません。
catalog-name-already-exists その名前のカタログはすでに存在しています。
catalog-name-too-large カタログ名の文字数制限は250文字です。
description-too-long 説明の文字数制限は250文字です。
field-names-not-unique 同じフィールド名が2回参照されています。
field-names-too-large フィールド名の文字数制限は250文字です。
id-not-first-column id は配列の最初のフィールドでなければなりません。型が文字列であることを確認してください。
invalid-catalog-name カタログ名にはアルファベット、数字、ハイフン、アンダースコアのみを含めることができます。
invalid-field-names フィールドに含めることができるのは、アルファベット、数字、ハイフン、アンダースコアのみです。
invalid-field-types フィールドタイプが有効であることを確認してください。
invalid-fields fields が正しくフォーマットされていません。
too-many-catalog-atoms 1つのリクエストにつき1つのカタログしか作成できません。
too-many-fields フィールド数の上限は500です。
New Stuff!