Create catalog selection
post
/catalogs/{catalog_name}/selections
Use this endpoint to create a selection in your catalog.
Prerequisites
To use this endpoint, you’ll need an API key with the catalogs.create_selection
permission.
Rate limit
This endpoint has a shared rate limit of 50 requests per minute between all asynchronous catalog fields and selections endpoints, as documented in API rate limits.
Path parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
catalog_name |
Required | String | Name of the catalog. |
Request parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
selection |
Required | Object | An object that contains selection criteria. The selection objects could contain name , description , filters , results_limit , sort_field , and sort_order . |
Example Request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
curl --location --request POST 'https://rest.iad-03.braze.com/catalogs/restaurants/selections' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"selection": {
"name": "favorite-restaurants",
"description": "Favorite restaurants in NYC",
"filters": [
{
"field": "City",
"operator": "equals",
"value": "NYC"
},
{
"field": "Rating",
"operator": "greater than",
"value": 7
}
]
}
}'
Filter operators
Field type | Supported operators |
---|---|
string |
equals , does not equal |
number |
equals , does not equal , greater than , less than |
boolean |
is |
time |
before , after |
array |
includes value , does not include value |
Response
There are three status code responses for this endpoint: 202
, 400
, and 404
.
Example success response
The status code 202
could return the following response body.
1
2
3
{
"message": "success"
}
Example error response
The status code 400
could return the following response body. Refer to Troubleshooting for more information about errors you may encounter.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"errors": [
{
"id": "catalog-not-found",
"message": "Could not find catalog",
"parameters": [
"catalog_name"
],
"parameter_values": [
"restaurants"
]
}
],
"message": "Invalid Request"
}
Troubleshooting
The following table lists possible returned errors and their associated troubleshooting steps.
Error | Troubleshooting |
---|---|
catalog-not-found |
Check that the catalog name is valid. |
company-size-limit-already-reached |
The catalog storage size limit is reached. |
selection-limit-reached |
The catalog selections limit is reached. |
invalid-selection |
Check that the selection is valid. |
too-many-filters |
Check if the selection has too many filters. |
selection-name-already-exists |
Check if the selection name already exists in the catalog. |
selection-has-invalid-filter |
Check if the selection filter is valid. |
selection-invalid-results-limit |
Check if the selection results limit is valid. |
invalid-sorting |
Check if the selection sorting is valid. |
invalid-sort-field |
Check if the selection sort field is valid. |
invalid-sort-order |
Check if the selection sort order is valid. |
selection-contains-too-many-arrays |
Check if the selection contains more than one field with array type. Only one is supported. |
New Stuff!