-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perso REST: ezp -> ibexa #2346
Open
reithor
wants to merge
7
commits into
master
Choose a base branch
from
missing-ibexafication
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Perso REST: ezp -> ibexa #2346
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4dae487
ezp -> ibexa
reithor 8421b03
mdash -> dash
reithor d5b9a12
Update docs/personalization/enable_personalization.md
reithor f816580
improved authorization handling
reithor 21d8d0b
apply suggestions from github actions
reithor 760a7fb
added export folder
reithor b984b1a
minor changes
reithor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,3 @@ | ||||||||||||||||||||||
--- | ||||||||||||||||||||||
description: Configure your project files to enable Personalization and set up items you want to track. | ||||||||||||||||||||||
--- | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -161,33 +160,43 @@ Place the following code snippet in the `<head>` 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 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` 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: | ||||||||||||||||||||||
|
||||||||||||||||||||||
To check whether the `content` endpoint is working as expected, perform the following request: | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
GET http://<yourdomain>/api/ezp/v2/ibexa_personalization/v1/content/{contentId} | ||||||||||||||||||||||
Accept application/vnd.ez.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' \ | ||||||||||||||||||||||
adriendupuis marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
--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://<yourdomain>/api/ezp/v2/ibexa_personalization/v1/contenttypes/38?page=1&page_size=10 | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
Accept application/vnd.ez.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}' | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
Comment on lines
+184
to
189
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
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 | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
"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 +206,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": "<![CDATA[<section xmlns=\"http://ez.no/namespaces/ezpublish5/xhtml5\"><p>We got the major port city on the south west coast of India.</p></section>\n]]>", | ||||||||||||||||||||||
"description": "<![CDATA[<section xmlns=\"http://ez.no/namespaces/ezpublish5/xhtml5\"><p><strong>Kochi </strong>(formerly Cochin) ... </p></section>\n]]>", | ||||||||||||||||||||||
"intro": "<![CDATA[<section xmlns=\"http://ibexa.co/namespaces/ezpublish5/xhtml5\"><p>We got the major port city on the south west coast of India.</p></section>\n]]>", | ||||||||||||||||||||||
"description": "<![CDATA[<section xmlns=\"http://ibexa.co/namespaces/ezpublish5/xhtml5\"><p><strong>Kochi </strong>(formerly Cochin) ... </p></section>\n]]>", | ||||||||||||||||||||||
"image": "/var/site/storage/images/places-tastes/places/kochin-india/282-5-eng-GB/Kochin-India.jpg", | ||||||||||||||||||||||
"caption": "<![CDATA[<section xmlns=\"http://ez.no/namespaces/ezpublish5/xhtml5\"><p>Chinese fishing nets ... </p></section>\n]]>", | ||||||||||||||||||||||
"caption": "<![CDATA[<section xmlns=\"http://ibexa.co/namespaces/ezpublish5/xhtml5\"><p>Chinese fishing nets ... </p></section>\n]]>", | ||||||||||||||||||||||
"location": "kochin, india", | ||||||||||||||||||||||
"authors_position": "Senior Editor", | ||||||||||||||||||||||
"tags": "India, Kochin", | ||||||||||||||||||||||
|
@@ -228,30 +237,19 @@ 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=<item_type>,<item_type> | ||||||||||||||||||||||
-—languages=<language>,<language> | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
If your installation hosts multiple SiteAccesses with different customer IDs, | ||||||||||||||||||||||
you must run the export separately for each of the `<site_access_name>`/`<customer_id>` pairs. | ||||||||||||||||||||||
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 | ||||||||||||||||||||||
--item-type-identifier-list=<item_type>,<item_type> | ||||||||||||||||||||||
--siteaccess=<site_access_name> | ||||||||||||||||||||||
--customer-id=<customer_id> | ||||||||||||||||||||||
--license-key=<license_key> | ||||||||||||||||||||||
-—languages=<language>,<language> | ||||||||||||||||||||||
--languages=<language>,<language> | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
The bundle exporter collects all content related to the `<site_access_name>`/`<customer_id>` | ||||||||||||||||||||||
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 | ||||||||||||||||||||||
|
@@ -310,13 +308,13 @@ The username is the customer ID and the password is the license key. | |||||||||||||||||||||
<attribute value="/1/2/95/71/74/" key="categoryPath" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="Michael Wang" key="author" type="NOMINAL"/> | ||||||||||||||||||||||
<attribute value="0" key="rating" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5"><p>Outstanding beaches of Dominican Republic, Samana is one of them.</p><p><em>Photograph by Brian Henry - Anchorage north shore Samana, Dominican Republic</em></p></section>
]]>" key="caption" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ibexa.co/namespaces/ezpublish5/xhtml5"><p>Outstanding beaches of Dominican Republic, Samana is one of them.</p><p><em>Photograph by Brian Henry - Anchorage north shore Samana, Dominican Republic</em></p></section>
]]>" key="caption" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="/Places-Tastes/Places/Santo-Domingo-Dominican-Republic" key="uri" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="38" key="contentTypeId" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="Dominican Republic, Santo Domingo" key="tags" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5"><p>Santo Domingo meaning "Saint Dominic", officially Santo Domingo de Guzm&aacute;n, is the capital and largest city in the ... </p></section>
]]>" key="description" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ibexa.co/namespaces/ezpublish5/xhtml5"><p>Santo Domingo meaning "Saint Dominic", officially Santo Domingo de Guzm&aacute;n, is the capital and largest city in the ... </p></section>
]]>" key="description" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="73" key="contentId" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5"><p>The oldest European inhabited settlement in the Americas.</p></section>
]]>" key="intro" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="<![CDATA[<section xmlns="http://ibexa.co/namespaces/ezpublish5/xhtml5"><p>The oldest European inhabited settlement in the Americas.</p></section>
]]>" key="intro" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="1442500260" key="publication_date" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="Santo Domingo, Dominican Republic" key="name" type="TEXT"/> | ||||||||||||||||||||||
<attribute value="Santo Domingo, Dominican Republic" key="location" type="TEXT"/> | ||||||||||||||||||||||
|
@@ -359,7 +357,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. | ||||||||||||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.