From 4042db6d2826155b459302a7379eb3afa4b0517e Mon Sep 17 00:00:00 2001 From: Vova Soroka Date: Thu, 18 Mar 2021 16:01:39 +0200 Subject: [PATCH] BAP-20442: Create documentation for X-Localization-ID and X-Currency headers for Storefront API (#29433) --- .../Resources/config/services_api.yml | 8 ++++++++ .../doc/api_frontend/x_localization_id_header.md | 3 +++ .../Resources/doc/api_frontend/product_search.md | 4 ---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 src/Oro/Bundle/FrontendLocalizationBundle/Resources/doc/api_frontend/x_localization_id_header.md diff --git a/src/Oro/Bundle/FrontendLocalizationBundle/Resources/config/services_api.yml b/src/Oro/Bundle/FrontendLocalizationBundle/Resources/config/services_api.yml index ab185c65d19..7e8a6effc47 100644 --- a/src/Oro/Bundle/FrontendLocalizationBundle/Resources/config/services_api.yml +++ b/src/Oro/Bundle/FrontendLocalizationBundle/Resources/config/services_api.yml @@ -1,4 +1,12 @@ services: + oro_frontend_localization.api_doc.documentation_provider.frontend_x_localization_id_header: + class: Oro\Bundle\ApiBundle\ApiDoc\DocumentationProvider + arguments: + - '@@OroFrontendLocalizationBundle/Resources/doc/api_frontend/x_localization_id_header.md' + - '@file_locator' + tags: + - { name: oro.api.documentation_provider, requestType: frontend, priority: 230 } + oro_frontend_localization.api.update_localization_query: class: Oro\Bundle\FrontendLocalizationBundle\Api\Processor\UpdateLocalizationQuery arguments: diff --git a/src/Oro/Bundle/FrontendLocalizationBundle/Resources/doc/api_frontend/x_localization_id_header.md b/src/Oro/Bundle/FrontendLocalizationBundle/Resources/doc/api_frontend/x_localization_id_header.md new file mode 100644 index 00000000000..0453dbebd05 --- /dev/null +++ b/src/Oro/Bundle/FrontendLocalizationBundle/Resources/doc/api_frontend/x_localization_id_header.md @@ -0,0 +1,3 @@ +By default, all locale sensitive data are received and returned in the locale selected for the current website. +To specify another locale, use the **X-Localization-ID** request header. +The list of available localization IDs can be received via the `/api/localizations` resource. diff --git a/src/Oro/Bundle/ProductBundle/Resources/doc/api_frontend/product_search.md b/src/Oro/Bundle/ProductBundle/Resources/doc/api_frontend/product_search.md index 56674f89cd3..873c220289e 100644 --- a/src/Oro/Bundle/ProductBundle/Resources/doc/api_frontend/product_search.md +++ b/src/Oro/Bundle/ProductBundle/Resources/doc/api_frontend/product_search.md @@ -36,10 +36,6 @@ name ~ "headlamp" and minimalPrice < 10 This query will find all products that contain the `headlamp` word in name, and which minimal price is less than 10. It uses two simple expressions, `name ~ "headlamp"` and `minimalPrice < 10`, that are joined by the logical `and` operator. -The locale for the name is equal to the locale selected for the website or the locale specified in the **X-Localization-ID** HTTP header if it is provided. - -The currency for the minimal price is equal to the currency selected for the website or the currency specified in the **X-Currency** HTTP header if it is provided. - The parentheses in complex queries can be used to enforce the precedence of operators. For example: ```