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 \ :ref:`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 :ref:`marketing-text-schedule-scope`). **Request** - Method: ``POST`` - Path: ``/api/dynamic_pricing/cost_rate_marketing_text`` **Body parameters** .. list-table:: :widths: 25 15 60 :header-rows: 1 * - 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 :ref:`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 :ref:`marketing-text-schedule-scope`. **Example request (cost-rate default scope)** .. code-block:: bash curl --location --request POST 'https://example.beenergised.cloud/api/dynamic_pricing/cost_rate_marketing_text' \ --header 'x-api-token: ' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data 'cost_rate_uuid=&marketing_texts={"it_IT":{"short_description":"Test short_description","description":"Test description","legal":"Test legal"}}' **Example request (schedule-entry scope)** .. code-block:: bash curl --location --request POST 'https://example.beenergised.cloud/api/dynamic_pricing/cost_rate_marketing_text' \ --header 'x-api-token: ' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data 'cost_rate_uuid=&rate_cost_schedule_uuid=&marketing_texts={"en_US":{"short_description":"Peak hours","description":"Premium price during peak hours","legal":"Peak hours terms"}}' **Response (200)** .. code-block:: json { "status": "ok" } **Error responses** - ``400``: Invalid locale or unknown marketing text type. .. code-block:: json { "status": "error", "message": "xx_XX is not a valid locale." } - ``400``: ``rate_cost_schedule_uuid`` is not a valid UUID. .. code-block:: json { "status": "error", "message": "Invalid rate_cost_schedule_uuid format" } - ``404``: Cost rate not found. .. code-block:: json { "status": "error", "message": "Cost rate not found!" } - ``404``: ``rate_cost_schedule_uuid`` is well-formed but does not resolve \ to a schedule entry belonging to this cost rate. .. code-block:: json { "status": "error", "message": "Cost rate schedule not found" } - ``500``: Generic server error. .. code-block:: json { "status": "error", "message": "An unexpected error occured" }