BrazeEx.Api.CatalogsCatalogItemsAsynchronous (braze_ex v1.0.22)

API calls for all endpoints tagged CatalogsCatalogItemsAsynchronous.

Link to this section Summary

Functions

Delete Multiple Catalog Items

Use this endpoint to delete multiple items in your catalog.

Edit Multiple Catalog Items

Use this endpoint to delete multiple items in your catalog.

Create Multiple Catalog Items

Use this endpoint to create multiple items in your catalog.

Update Multiple Catalog Items

Use this endpoint to update multiple items in your catalog.

Link to this section Functions

Link to this function

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

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

delete-multiple-catalog-items

Delete Multiple Catalog Items

Use this endpoint to delete multiple items in your catalog.

Each request can support up to 50 items. This endpoint is asynchronous.

prerequisites

Prerequisites

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

rate-limit

Rate limit

This endpoint has a shared rate limit of 16,000 requests per minute between all asynchronous catalog item endpoints, as documented in API rate limits.

path-parameters

Path parameters

ParameterRequiredData TypeDescription
catalog_nameRequiredStringName of the catalog.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
itemsRequiredArrayAn array that contains item objects. The item objects should contain an id referencing the items Braze should delete. Up to 50 item objects are allowed per request.

example-request

Example request

curl --location --request DELETE 'https://rest.iad-03.braze.com/catalogs/restaurants/items' --header 'Content-Type: application/json' --header 'Authorization: Bearer YOUR-REST-API-KEY' --data-raw '{
"items": [
  {"id": "restaurant1"},
  {"id": "restaurant2"},
  {"id": "restaurant3"}
]
}'

response

Response

There are three status code responses for this endpoint: 202, 400, and 404.

example-success-response

Example success response

The status code 202 could return the following response body.

{
"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": "items-missing-ids",
    "message": "There are 1 item(s) that do not have ids",
    "parameters": [],
    "parameter_values": []
  }
],
"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.
ids-too-largeItem IDs can't be more than 250 characters.
ids-not-uniqueCheck that the item IDs are unique in the request.
ids-not-stringsItem IDs must be of type string.
items-missing-idsThere are items that do not have item IDs. Check that each item has an item ID.
invalid-idsItem IDs can only include letters, numbers, hyphens, and underscores.
request-includes-too-many-itemsYour request has too many items. The item limit per request is 50.

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_catalog_name_items_patch(connection, catalog_name, opts \\ [])

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

edit-multiple-catalog-items

Edit Multiple Catalog Items

Use this endpoint to delete multiple items in your catalog.

Each request can support up to 50 items. This endpoint is asynchronous.

prerequisites

Prerequisites

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

rate-limit

Rate limit

This endpoint has a shared rate limit of 16,000 requests per minute between all asynchronous catalog item endpoints, as documented in API rate limits.

path-parameters

Path parameters

ParameterRequiredData TypeDescription
catalog_nameRequiredStringName of the catalog.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
itemsRequiredArrayAn array that contains item objects. The item objects should contain an id referencing the items Braze should delete. Up to 50 item objects are allowed per request.

example-request

Example request

curl --location --request DELETE 'https://rest.iad-03.braze.com/catalogs/restaurants/items' --header 'Content-Type: application/json' --header 'Authorization: Bearer YOUR-REST-API-KEY' --data-raw '{
"items": [
  {"id": "restaurant1"},
  {"id": "restaurant2"},
  {"id": "restaurant3"}
]
}'

response

Response

There are three status code responses for this endpoint: 202, 400, and 404.

example-success-response

Example success response

The status code 202 could return the following response body.

{
"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": "items-missing-ids",
    "message": "There are 1 item(s) that do not have ids",
    "parameters": [],
    "parameter_values": []
  }
],
"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.
ids-too-largeItem IDs can't be more than 250 characters.
ids-not-stringsItem IDs must be of type string.
ids-not-uniqueItem IDs must be unique in the request.
invalid-idsItem IDs can only include letters, numbers, hyphens, and underscores.
invalid-fieldsConfirm that all fields you are sending in the API request already exist in the catalog. This is not related to the ID field mentioned in the error.
invalid-keys-in-value-objectItem object keys can't include . or $.
items-missing-idsThere are items that do not have item IDs. Check that each item has an item ID.
item-array-invaliditems must be an array of objects.
items-too-largeItem values can't exceed 5,000 characters.
request-includes-too-many-itemsYour request has too many items. The item limit per request is 50.
too-deep-nesting-in-value-objectItem objects can't have more than 50 levels of nesting.
unable-to-coerce-valueItem types can't be converted.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • catalog_name (String.t):
  • 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
Link to this function

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

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

create-multiple-catalog-items

Create Multiple Catalog Items

Use this endpoint to create multiple items in your catalog.

Each request can support up to 50 items. This endpoint is asynchronous.

prerequisites

Prerequisites

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

rate-limit

Rate limit

This endpoint has a shared rate limit of 16,000 requests per minute between all asynchronous catalog item endpoints, as documented in API rate limits.

path-parameters

Path parameters

ParameterRequiredData TypeDescription
catalog_nameRequiredStringName of the catalog.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
itemsRequiredArrayAn array that contains item objects. The item objects should contain all of the fields in the catalog. Up to 50 item objects are allowed per request.

example-request

Example request

curl --location --request POST 'https://rest.iad-03.braze.com/catalogs/restaurants/items' --header 'Content-Type: application/json' --header 'Authorization: Bearer YOUR-REST-API-KEY' --data-raw '{
"items": [
  {
    "id": "restaurant1",
    "Name": "Restaurant1",
    "City": "New York",
    "Cuisine": "American",
    "Rating": 5,
    "Loyalty_Program": true,
    "Created_At": "2022-11-01T09:03:19.967+00:00"
  },
  {
    "id": "restaurant2",
    "Name": "Restaurant2",
    "City": "New York",
    "Cuisine": "American",
    "Rating": 10,
    "Loyalty_Program": true,
    "Created_At": "2022-11-02T09:03:19.967+00:00"
  },
  {
    "id": "restaurant3",
    "Name": "Restaurant3",
    "City": "New York",
    "Cuisine": "American",
    "Rating": 3,
    "Loyalty_Program": false,
    "Created_At": "2022-11-03T09:03:19.967+00:00"
  }
]
}'

response

Response

There are three status code responses for this endpoint: 202, 400, and 404.

example-success-response

Example success response

The status code 202 could return the following response body.

{
"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": "fields-do-not-match",
    "message": "Fields do not match with fields on the catalog",
    "parameters": [
      "id"
    ],
    "parameter_values": [
      "restaurant2"
    ]
  }
],
"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.
ids-not-stringsItem IDs must be of type string.
ids-not-uniqueItem IDs must be unique in the request.
ids-too-largeItem IDs can't be more than 250 characters.
invalid-idsItem IDs can only include letters, numbers, hyphens, and underscores.
invalid-fieldsConfirm that the fields in the request exist in the catalog.
invalid-keys-in-value-objectItem object keys can't include . or $.
item-array-invaliditems must be an array of objects.
items-missing-idsThere are items that do not have item IDs. Check that each item has an item ID.
items-too-largeItem values can't exceed 5,000 characters.
request-includes-too-many-itemsYour request has too many items. The item limit per request is 50.
too-deep-nesting-in-value-objectItem objects can't have more than 50 levels of nesting.
unable-to-coerce-valueItem types can't be converted.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • catalog_name (String.t):
  • 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
Link to this function

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

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

update-multiple-catalog-items

Update Multiple Catalog Items

Use this endpoint to update multiple items in your catalog.

If a catalog item doesn’t exist, this endpoint will create the item in your catalog. Each request can support up to 50 catalog items. This endpoint is asynchronous.

prerequisites

Prerequisites

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

rate-limit

Rate limit

This endpoint has a shared rate limit of 16,000 requests per minute between all asynchronous catalog item endpoints, as documented in API rate limits.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
catalog_nameRequiredStringName of the catalog.
item_idRequiredStringThe ID of the catalog item.

request-parameters-1

Request parameters

ParameterRequiredData TypeDescription
itemsRequiredArrayAn array that contains item objects. The item objects should contain fields that exist in the catalog except for the id field. Only one item object is allowed per request.

example-request

Example request

curl --location --request PUT 'https://rest.iad-03.braze.com/catalogs/restaurants/items' --header 'Content-Type: application/json' --header 'Authorization: Bearer YOUR-REST-API-KEY' --data-raw '{
"items": [
  {
    "id": "restaurant1",
    "Name": "Restaurant",
    "Loyalty_Program": false,
    "Location": {
      "Latitude": 33.6112,
      "Longitude": -117.8711
    },
    "Open_Time": "2021-09-03T09:03:19.967+00:00"
  },
  {
    "id": "restaurant3",
    "City": "San Francisco",
    "Rating": 2
  }
]
}'

response

Response

There are three status code responses for this endpoint: 200, 400, 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 400 could return the following response body. Refer to Troubleshooting for more information about errors you may encounter.

{
"errors": [
  {
    "id": "invalid-fields",
    "message": "Some of the fields given do not exist in the catalog",
    "parameters": [
      "id"
    ],
    "parameter_values": [
      "restaurant1"
    ]
  }
],
"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.
ids_not_stringConfirm that each item ID is a string.
ids_not_uniqueCheck that each item ID is unique.
ids_too_largeCharacter limit for each item ID is 250 characters.
item_array_invaliditems must be an array of objects.
items_missing_idsConfirm that each item has an ID.
items_too_largeItem values can't exceed 5,000 characters.
invalid_idsSupported characters for item ID names are letters, numbers, hyphens, and underscores.
invalid_fieldsConfirm that the fields in the request exist in the catalog.
invalid_keys_in_value_objectItem object keys can't include . or $.
too_deep_nesting_in_value_objectItem objects can't have more than 50 levels of nesting.
request_includes_too_many_itemsYour request has too many items. The item limit per request is 50.
unable_to_coerce_valueItem types can't be converted.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • catalog_name (String.t):
  • 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