Create Marketing Texts
Create marketing texts for a cost rate. The request accepts one or more locales, each containing up to three text types. If marketing texts already exist for the given locale and type, they will be overwritten.
The body must include the cost_rate_uuid of the target cost rate and a marketing_texts field containing a JSON-encoded string of the texts to store. For the expected structure and supported text types, see Marketing text structure.
By default the texts are written to the cost rate’s default scope. To write against a single schedule entry, pass its UUID as rate_cost_schedule_uuid (see Marketing text scope).
Request
Method:
POSTPath:
/api/dynamic_pricing/cost_rate_marketing_text
Body parameters
Name |
Type |
Description |
|---|---|---|
cost_rate_uuid |
string |
UUID of the cost rate to create marketing texts for. Required. |
marketing_texts |
string (JSON) |
JSON-encoded object keyed by locale. Required. See Marketing text structure. |
rate_cost_schedule_uuid |
string|null |
Optional. UUID of a schedule entry (recurring or unique pricing config) to scope the write to that entry. When omitted, the texts are written to the cost rate’s default scope. See Marketing text scope. |
Example request (cost-rate default scope)
curl --location --request POST 'https://example.beenergised.cloud/api/dynamic_pricing/cost_rate_marketing_text' \
--header 'x-api-token: <your_token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'cost_rate_uuid=<COST_RATE_UUID>&marketing_texts={"it_IT":{"short_description":"Test short_description","description":"Test description","legal":"Test legal"}}'
Example request (schedule-entry scope)
curl --location --request POST 'https://example.beenergised.cloud/api/dynamic_pricing/cost_rate_marketing_text' \
--header 'x-api-token: <your_token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'cost_rate_uuid=<COST_RATE_UUID>&rate_cost_schedule_uuid=<SCHEDULE_UUID>&marketing_texts={"en_US":{"short_description":"Peak hours","description":"Premium price during peak hours","legal":"Peak hours terms"}}'
Response (200)
{
"status": "ok"
}
Error responses
400: Invalid locale or unknown marketing text type.
{
"status": "error",
"message": "xx_XX is not a valid locale."
}
400:rate_cost_schedule_uuidis not a valid UUID.
{
"status": "error",
"message": "Invalid rate_cost_schedule_uuid format"
}
404: Cost rate not found.
{
"status": "error",
"message": "Cost rate not found!"
}
404:rate_cost_schedule_uuidis well-formed but does not resolve to a schedule entry belonging to this cost rate.
{
"status": "error",
"message": "Cost rate schedule not found"
}
500: Generic server error.
{
"status": "error",
"message": "An unexpected error occured"
}