Managing Custom Fields
In this guide we'll cover the basics of creating, updating and deleting Custom Fields in Explore+ using the API.
Note that Custom Fields are constructed as follows:
- Custom field (with name, description and type)
- Values (for tag fields one value, for multi-value fields multiple values)
- Assignment rules (for each value multiple assignment rules can exist)
- Values (for tag fields one value, for multi-value fields multiple values)
Before you start
To run through this tutorial, you will need:
- Your Meltwater API token
Custom Field folders
curl -X GET \
--url "https://api.meltwater.com/v3/explore_plus/assets/custom_fields/folders?workspace_id=none&page_size=10&page=1" \
--header "Accept: application/json" \
--header "apikey: **********"
Listing Custom Fields
curl --request GET \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields?workspace_id=none&page_size=10&page=1' \
--header "Accept: application/json" \
--header "apikey: **********"
Example response:
{
"page": 1,
"page_size": 10,
"total": 30,
"custom_fields": [
{
"id": 123,
"folder_id": 456,
"name": "My Custom Field",
"description": "This is my Custom Field",
"created": "2024-01-01T00:00:00Z",
"updated": "2024-01-01T00:00:00Z",
"type": "multi_value"
},
{
"id": 456,
"folder_id": null,
"name": "My Custom Field 2",
"type": "tag"
}
]
}
Getting Custom Field details
curl --request GET \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********"
The response includes the field's values with IDs you can use for subsequent API calls.
Creating a Custom Field
Two types supported: tag (single value, auto-created) and multi_value (multiple values).
curl --request POST \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"custom_field": {
"name": "My Custom Field",
"description": "my new Custom Field",
"folder_id": 123,
"type": "tag"
}
}'
Parameters: name, description, folder_id, type.
Updating a Custom Field
curl --request PUT \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/1345?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"custom_field": {
"name": "My Custom Field - Updated",
"description": "My new description",
"type": "tag"
}
}'
Note: you cannot change the type of a Custom Field once created.
Deleting a Custom Field
curl -X DELETE \
--url "https://api.meltwater.com/v3/explore_plus/assets/custom_fields/123?workspace_id=none" \
--header "Accept: application/json" \
--header "apikey: **********"
Returns 204 on success.
Getting Custom Field Value details
curl --request GET \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345/values/987?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********"
Creating a Custom Field value
Note: you cannot add a value to a tag type field (it has one auto-created value).
curl --request POST \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345/values?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"custom_field_value": {
"name": "My Custom Field Value",
"color": "#FFFFFF"
}
}'
Updating a Custom Field value
curl --request PUT \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345/values/123?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"custom_field_value": {
"name": "My Custom Field Value - Updated",
"color": "#FFFFFF"
}
}'
Deleting a Custom Field value
curl -X DELETE \
--url "https://api.meltwater.com/v3/explore_plus/assets/custom_fields/123/values/456?workspace_id=none" \
--header "Accept: application/json" \
--header "apikey: **********"
Creating a Custom Field Value assignment rule
Two types of rule supported: boolean and keyword.
curl --request POST \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345/values/123/rules?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"rule": {
"query": {
"case_sensitivity": "no",
"boolean": "honda OR mazda",
"type": "boolean"
}
}
}'
For keyword rules, use all_keywords, any_keywords, not_keywords and case_sensitivity.
Updating a Custom Field value assignment rule
curl --request PUT \
--url 'https://api.meltwater.com/v3/explore_plus/assets/custom_fields/12345/values/123/rules/456?workspace_id=none' \
--header "Accept: application/json" \
--header "apikey: **********" \
--data '{
"rule": {
"query": {
"case_sensitivity": "no",
"boolean": "honda OR mazda",
"type": "boolean"
}
}
}'
Deleting a Custom Field value assignment rule
curl -X DELETE \
--url "https://api.meltwater.com/v3/explore_plus/assets/custom_fields/123/values/456/rules/789?workspace_id=none" \
--header "Accept: application/json" \
--header "apikey: **********"
Returns 204 on success.