BrazeEx.Api.CatalogsCatalogManagementSynchronous (braze_ex v1.0.22)

API calls for all endpoints tagged CatalogsCatalogManagementSynchronous.

Link to this section Summary

Functions

Delete Catalog

Use this endpoint to delete a catalog.

List Catalogs

Use this endpoint to return a list of catalogs in a workspace.

Create Catalog

Use this endpoint to create a catalog.

Link to this section Functions

Link to this function

catalogs_catalog_name_delete(connection, catalog_name, opts \\ [])

@spec catalogs_catalog_name_delete(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

delete-catalog

Delete Catalog

Use this endpoint to delete a catalog.

prerequisites

Prerequisites

To use this endpoint, you’ll need an API key with the catalogs.delete permission.

rate-limit

Rate limit

This endpoint has a shared rate limit of 5 requests per minute between all synchronous catalog endpoints, as documented in API rate limits.

path-parameters

Path parameters

ParameterRequiredData TypeDescription
catalog_nameRequiredStringName of the catalog.

response

Response

There are two status code responses for this endpoint: 200 and 404.

example-success-response

Example success response

The status code 200 could return the following response body.

{
"message": "success"
}

example-error-response

Example error response

The status code 404 could return the following response body. Refer to Troubleshooting for more information about errors you may encounter.

{
"errors": [
  {
    "id": "catalog-not-found",
    "message": "Could not find catalog",
    "parameters": [
      "catalog_name"
    ],
    "parameter_values": [
      "restaurants"
    ]
  }
],
"message": "Invalid Request"
}

troubleshooting

Troubleshooting

The following table lists possible returned errors and their associated troubleshooting steps.

ErrorTroubleshooting
catalog-not-foundCheck that the catalog name is valid.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • catalog_name (String.t):
  • opts (keyword): Optional parameters
    • :"Content-Type" (String.t):
    • :Authorization (String.t):

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

catalogs_get(connection, opts \\ [])

@spec catalogs_get(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

list-catalogs

List Catalogs

Use this endpoint to return a list of catalogs in a workspace.

prerequisites

Prerequisites

To use this endpoint, you’ll need an API key with the catalogs.get permission.

rate-limit

Rate limit

This endpoint has a shared rate limit of 5 requests per minute between all synchronous catalog endpoints, as documented in API rate limits.

path-and-request-parameters

Path and request parameters

There are no path or request parameters for this endpoint.

example-request

Example request

curl --location --request GET 'https://rest.iad-03.braze.com/catalogs' --header 'Content-Type: application/json' --header 'Authorization: Bearer YOUR-REST-API-KEY'

response

Response

example-success-response

Example success response

The status code 200 could return the following response body.

{
"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": "Created_At",
        "type": "time"
      }
    ],
    "name": "restaurants",
    "num_items": 10,
    "updated_at": "2022-11-02T20:04:06.879+00:00"
  },
  {
    "description": "My Catalog",
    "fields": [
      {
        "name": "id",
        "type": "string"
      },
      {
        "name": "string_field",
        "type": "string"
      },
      {
        "name": "number_field",
        "type": "number"
      },
      {
        "name": "boolean_field",
        "type": "boolean"
      },
      {
        "name": "time_field",
        "type": "time"
      },
    ],
    "name": "my_catalog",
    "num_items": 3,
    "updated_at": "2022-11-02T09:03:19.967+00:00"
  },
],
"message": "success"
}

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"Content-Type" (String.t):
    • :Authorization (String.t):

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

catalogs_post(connection, opts \\ [])

@spec catalogs_post(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

create-catalog

Create Catalog

Use this endpoint to create a catalog.

prerequisites

Prerequisites

To use this endpoint, you’ll need an API key with the catalogs.create permission.

rate-limit

Rate limit

This endpoint has a shared rate limit of 5 requests per minute between all synchronous catalog endpoints, as documented in API rate limits.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
catalogsRequiredArrayAn array that contains catalog objects. Only one catalog object is allowed for this request.

catalog-object-parameters

Catalog object parameters

ParameterRequiredData TypeDescription
nameRequiredStringThe name of the catalog that you want to create.
descriptionRequiredStringThe description of the catalog that you want to create.
fieldsRequiredArrayAn array of objects where the object contains keys name and type.

example-request

Example request

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": "Created_At",
        "type": "time"
      }
    ]
  }
]
}'

response

Response

There are two status code responses for this endpoint: 201 and 400.

example-success-response

Example success response

The status code 201 could return the following response body.

{
"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": "Created_At",
        "type": "time"
      }
    ],
    "name": "restaurants",
    "num_items": 0,
    "updated_at": "2022-11-02T20:04:06.879+00:00"
  }
],
"message": "success"
}

example-error-response

Example error response

The status code 400 could return the following response body. Refer to Troubleshooting for more information about errors you may encounter.

{
"errors": [
  {
    "id": "catalog-name-already-exists",
    "message": "A catalog with that name already exists",
    "parameters": [
      "name"
    ],
    "parameter_values": [
      "restaurants"
    ]
  }
],
"message": "Invalid Request"
}

troubleshooting

Troubleshooting

The following table lists possible returned errors and their associated troubleshooting steps.

ErrorTroubleshooting
catalog-array-invalidcatalogs must be an array of objects.
catalog-name-already-existsCatalog with that name already exists.
catalog-name-too-largeCharacter limit for a catalog name is 250.
description-too-longCharacter limit for description is 250.
field-names-not-uniqueThe same field name is referenced twice.
field-names-too-largeCharacter limit for a field name is 250.
id-not-first-columnThe id must be the first field in the array. Check that the type is a string.
invalid_catalog_nameCatalog name can only include letters, numbers, hyphens, and underscores.
invalid-field-namesFields can only include letters, numbers, hyphens, and underscores.
invalid-field-typesMake sure the field types are valid.
invalid-fieldsfields is not formatted correctly.
reached-company-catalogs-limitMaximum number of catalogs reached. Contact your Braze account manager for more information.
too-many-catalog-atomsYou can only create one catalog per request.
too-many-fieldsNumber of fields limit is 30.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"Content-Type" (String.t):
    • :Authorization (String.t):
    • :body (String.t):

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure