From 4dae487a276e11fb6fc984054e0d6a92bbc602e9 Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Wed, 27 Mar 2024 16:52:28 +0100 Subject: [PATCH 1/8] ezp -> ibexa --- .../personalization/enable_personalization.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index ce7ea79830..48802de1b9 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -1,4 +1,4 @@ ---- +git check--- description: Configure your project files to enable Personalization and set up items you want to track. --- @@ -166,16 +166,16 @@ Use the `Accept` header; you may need to add an `Authorization` header if authen To check whether the `content` endpoint is working as expected, perform the following request: ``` -GET http:///api/ezp/v2/ibexa_personalization/v1/content/{contentId} -Accept application/vnd.ez.api.Content+json +GET http:///api/ibexa/v2/personalization/v1/content/{contentId} +Accept application/vnd.ibexa.api.Content+json Authorization Basic xxxxxxxx ``` Additionally, check whether the `contenttypes` endpoint is working with the following request: ``` -GET http:///api/ezp/v2/ibexa_personalization/v1/contenttypes/38?page=1&page_size=10 -Accept application/vnd.ez.api.Content+json +GET http:///api/ibexa/v2/personalization/v1/contenttypes/38?page=1&page_size=10 +Accept application/vnd.ibexa.api.Content+json Authorization Basic xxxxxxxx ``` @@ -184,10 +184,10 @@ The `content` endpoint returns one item and the `contenttypes` endpoint returns ``` json { "contentList": { - "_media-type": "application/vnd.ez.api.contentList+json", + "_media-type": "application/vnd.ibexa.api.ContentList+json", "content": [ { - "_media-type": "application/vnd.ez.api.content+json", + "_media-type": "application/vnd.ibexa.api.Content+json", "contentId": 72, "contentTypeId": 38, "identifier": "place", @@ -197,18 +197,18 @@ The `content` endpoint returns one item and the `contenttypes` endpoint returns "uri": "/Places-Tastes/Places/Kochin-India", "categoryPath": "/1/2/95/71/73/", "mainLocation": { - "_media-type": "application/vnd.ez.api.mainLocation+json", + "_media-type": "application/vnd.ibexa.api.mainLocation+json", "_href": "/api/ezp/v2/content/locations/1/2/95/71/73/" }, "locations": { - "_media-type": "application/vnd.ez.api.locations+json", + "_media-type": "application/vnd.ibexa.api.locations+json", "_href": "/api/ezp/v2/content/objects/72/locations" }, "name": "Kochin, India", - "intro": "

We got the major port city on the south west coast of India.

\n]]>", - "description": "

Kochi (formerly Cochin) ...

\n]]>", + "intro": "

We got the major port city on the south west coast of India.

\n]]>", + "description": "

Kochi (formerly Cochin) ...

\n]]>", "image": "/var/site/storage/images/places-tastes/places/kochin-india/282-5-eng-GB/Kochin-India.jpg", - "caption": "

Chinese fishing nets ...

\n]]>", + "caption": "

Chinese fishing nets ...

\n]]>", "location": "kochin, india", "authors_position": "Senior Editor", "tags": "India, Kochin", @@ -310,13 +310,13 @@ The username is the customer ID and the password is the license key. - + - + - + @@ -359,7 +359,7 @@ and it eventually fetches the affected content and updates it internally. To display recommendations on your site, you must include the asset in the template using the following code: ``` html+twig -{{ encore_entry_script_tags('ezrecommendation-client-js', null, 'ezplatform') }} +{{ encore_entry_script_tags('ibexa-personalization-client-js', null, 'ibexa') }} ``` This file is responsible for sending notifications to the [Recommendation API](recommendation_api.md) after the user clicks a tracking element. From 8421b03fbea3d2005a71bb01ab040aa4e1f46d00 Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Wed, 27 Mar 2024 17:01:01 +0100 Subject: [PATCH 2/8] mdash -> dash --- docs/personalization/enable_personalization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 48802de1b9..edf5fb3195 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -235,7 +235,7 @@ If your installation hosts only one SiteAccess, run the following command to exp ``` bash php bin/console ibexa:personalization:run-export --item-type-identifier-list=, - -—languages=, + --languages=, ``` If your installation hosts multiple SiteAccesses with different customer IDs, @@ -247,7 +247,7 @@ php bin/console ibexa:personalization:run-export --siteaccess= --customer-id= --license-key= - -—languages=, + --languages=, ``` The bundle exporter collects all content related to the ``/`` From d5b9a12fcc85fc49bfcd4142200e1e563c8b550f Mon Sep 17 00:00:00 2001 From: Thorsten Reiter <34274688+reithor@users.noreply.github.com> Date: Tue, 14 May 2024 17:11:28 +0200 Subject: [PATCH 3/8] Update docs/personalization/enable_personalization.md --- docs/personalization/enable_personalization.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index edf5fb3195..e586807b65 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -1,4 +1,3 @@ -git check--- description: Configure your project files to enable Personalization and set up items you want to track. --- From f816580f95a99a85f186e8419ff54ec08afadf7f Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Fri, 20 Sep 2024 09:55:51 +0200 Subject: [PATCH 4/8] improved authorization handling --- .../personalization/enable_personalization.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index e586807b65..1151bd6f3c 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -160,25 +160,35 @@ Place the following code snippet in the `` section of your header template ### Check whether the bundle provides REST data You can verify the import controller of the bundle by calling the local API. -Use the `Accept` header; you may need to add an `Authorization` header if authentication is required. +As the API uses token based authorization you first need a valid bearer token. + +When you publish a Content Item a bearer token will be created and saved to the ibexa_token db table. + +Additionally a POST request is send to the Personalization Engine, containing the token +and the Rest URL where the Personalization Engine can fetch the changed Content. + +The BEARER_TOKEN will be the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token will by default be valid for 1 day. + +You can use this token to check what is provided to the Personalization Engine: -To check whether the `content` endpoint is working as expected, perform the following request: ``` -GET http:///api/ibexa/v2/personalization/v1/content/{contentId} -Accept application/vnd.ibexa.api.Content+json -Authorization Basic xxxxxxxx +curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/content/id/{contentId}?lang={comma_separated_languages}' \ +--header 'Accept: application/vnd.ibexa.api.Content+json' \ +--header 'Authorization: Bearer {BEARER_TOKEN}' ``` -Additionally, check whether the `contenttypes` endpoint is working with the following request: +Additionally, check whether the `contentlist` endpoint is working with the following request: ``` -GET http:///api/ibexa/v2/personalization/v1/contenttypes/38?page=1&page_size=10 -Accept application/vnd.ibexa.api.Content+json -Authorization Basic xxxxxxxx + +curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/contentlist/{comma_separated_content_ids}?lang={comma_separated_languages}' \ +--header 'Accept: application/vnd.ibexa.api.ContentList+json' \ +--header 'AUTHORIZATION: Bearer {BEARER_TOKEN}' + ``` -The `content` endpoint returns one item and the `contenttypes` endpoint returns many. +The `content` endpoint returns one item and the `contentlist` endpoint returns many. ``` json { @@ -227,18 +237,7 @@ To get recommendations you must first export the item information to the Persona After you [define item types to be tracked and recommended](#set-up-item-type-tracking), start the full export. -You do it with the `ibexa:personalization:run-export` command. - -If your installation hosts only one SiteAccess, run the following command to export your data: - -``` bash -php bin/console ibexa:personalization:run-export - --item-type-identifier-list=, - --languages=, -``` - -If your installation hosts multiple SiteAccesses with different customer IDs, -you must run the export separately for each of the ``/`` pairs. +You need to run the `ibexa:personalization:run-export command per SiteAccesses that you want to use together with Personalization. Please note that you need different customer IDs for different SiteAccesses. ``` bash php bin/console ibexa:personalization:run-export From 21d8d0b05f8574cb6753ce4750bb08c42f73ae5e Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Fri, 20 Sep 2024 10:07:40 +0200 Subject: [PATCH 5/8] apply suggestions from github actions --- docs/personalization/enable_personalization.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 1151bd6f3c..5e71668644 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -162,12 +162,12 @@ Place the following code snippet in the `` section of your header template You can verify the import controller of the bundle by calling the local API. As the API uses token based authorization you first need a valid bearer token. -When you publish a Content Item a bearer token will be created and saved to the ibexa_token db table. +When you publish a content item a bearer token is created and saved to the `ibexa_token` db table. Additionally a POST request is send to the Personalization Engine, containing the token and the Rest URL where the Personalization Engine can fetch the changed Content. -The BEARER_TOKEN will be the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token will by default be valid for 1 day. +The BEARER_TOKEN is the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token has a default lifetime of one day. You can use this token to check what is provided to the Personalization Engine: @@ -237,7 +237,7 @@ To get recommendations you must first export the item information to the Persona After you [define item types to be tracked and recommended](#set-up-item-type-tracking), start the full export. -You need to run the `ibexa:personalization:run-export command per SiteAccesses that you want to use together with Personalization. Please note that you need different customer IDs for different SiteAccesses. +You need to run the `ibexa:personalization:run-export command per SiteAccesses that you want to use together with Personalization. You need different customer IDs for different SiteAccesses. ``` bash php bin/console ibexa:personalization:run-export From 760a7fb7547dd55d3882549dcbdef809fba28c5f Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Fri, 20 Sep 2024 11:57:01 +0200 Subject: [PATCH 6/8] added export folder --- docs/personalization/enable_personalization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 5e71668644..39431c4f69 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -249,7 +249,7 @@ php bin/console ibexa:personalization:run-export ``` The bundle exporter collects all content related to the ``/`` -pair and stores it in files. +pair and stores it in files to the folder `public/var/export/yyyy/mm/dd/hh/mm` of your project. After finishing, the system sends a POST request to the endpoint and informs the Personalization server to fetch new content. An internal workflow is then triggered, so that the generated files are downloaded From b984b1ab0ad8ac297df1d519c32347c05f025a53 Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Fri, 20 Sep 2024 12:01:00 +0200 Subject: [PATCH 7/8] minor changes --- docs/personalization/enable_personalization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 39431c4f69..9d4edcbd3c 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -167,7 +167,7 @@ When you publish a content item a bearer token is created and saved to the `ibex Additionally a POST request is send to the Personalization Engine, containing the token and the Rest URL where the Personalization Engine can fetch the changed Content. -The BEARER_TOKEN is the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token has a default lifetime of one day. +The `BEARER_TOKEN` is the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token has a default lifetime of one day. You can use this token to check what is provided to the Personalization Engine: @@ -184,7 +184,7 @@ Additionally, check whether the `contentlist` endpoint is working with the foll curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/contentlist/{comma_separated_content_ids}?lang={comma_separated_languages}' \ --header 'Accept: application/vnd.ibexa.api.ContentList+json' \ ---header 'AUTHORIZATION: Bearer {BEARER_TOKEN}' +--header 'Authorization: Bearer {BEARER_TOKEN}' ``` From ea90b5cad585ae4e671e687ba25ef2920257e220 Mon Sep 17 00:00:00 2001 From: Thorsten Reiter <34274688+reithor@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:49:12 +0200 Subject: [PATCH 8/8] Apply suggestions from code review Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> --- docs/personalization/enable_personalization.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 9d4edcbd3c..13a74fe53e 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -172,7 +172,7 @@ The `BEARER_TOKEN` is the newest one in `ibexa_token` table having `type=1` and You can use this token to check what is provided to the Personalization Engine: -``` +```bash curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/content/id/{contentId}?lang={comma_separated_languages}' \ --header 'Accept: application/vnd.ibexa.api.Content+json' \ --header 'Authorization: Bearer {BEARER_TOKEN}' @@ -180,12 +180,10 @@ curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/cont Additionally, check whether the `contentlist` endpoint is working with the following request: -``` - +```bash curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/contentlist/{comma_separated_content_ids}?lang={comma_separated_languages}' \ --header 'Accept: application/vnd.ibexa.api.ContentList+json' \ --header 'Authorization: Bearer {BEARER_TOKEN}' - ``` The `content` endpoint returns one item and the `contentlist` endpoint returns many.