Skip to content

카탈로그 생성

post

/catalogs

이 엔드포인트를 사용하여 카탈로그를 생성합니다.

필수 조건

이 엔드포인트를 사용하려면 catalogs.create 권한이 있는 API 키가 필요합니다.

사용량 제한

이 엔드포인트는 API 사용량 제한 설명서에 명시된 바와 같이, 모든 동기식 카탈로그 엔드포인트 간에 분당 50건의 요청이라는 공유 사용량 제한이 적용됩니다.

요청 매개변수

매개변수 필수 데이터 유형 설명
catalogs 필수 배열 카탈로그 오브젝트가 포함된 배열입니다. 이 요청에는 하나의 카탈로그 오브젝트만 허용됩니다.

카탈로그 오브젝트 매개변수

매개변수 필수 데이터 유형 설명
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
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": "object"
        },
        {
          "name": "Top_Dishes",
          "type": "array"
        },
        {
          "name": "Created_At",
          "type": "time"
        }
      ]
    }
  ]
}'

응답

이 엔드포인트에 대한 상태 코드 응답은 201400 두 가지입니다.

성공 응답 예시

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
{
  "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": "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 동일한 필드 이름이 두 번 참조되었습니다.
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 요청당 하나의 카탈로그만 생성할 수 있습니다.
too-many-fields 필드 개수 제한은 500개입니다.
New Stuff!