Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-91811

As a developer, I can obtain assets for a given user based on her segmentation using a headless API

    Details

      Description

      Without Context (-LPS-92803-):

      curl -u test@liferay.com:test -D - http://localhost:8080/o/headless-delivery/v1.0/content-sets/{content-set-id}/content-set-elements
      curl -u test@liferay.com:test -D - http://localhost:8080/o/headless-delivery/v1.0/content-sets/{content-set-id}/content-set-elements?page=2&pageSize=1

      To try this with context (-LPS-92804-), you should add the headers you want to the request:

      curl -X GET \
        http://localhost:8080/o/headless-delivery/v1.0/content-sets/37551/content-set-elements \
        -u 'test@liferay.com:test' \
        -H 'X-Device-Brand: LG' \
        -H 'X-Device-Model: G7' 
      

      You can add a new header with

      -H '<header-name>: <header-value>'

      These are the available headers:

      • Host (internal note: this is going to map with Context.URL)
      • Accept-Language (internal note: this is going to map with Context.LANGUAGE_ID)
      • User-Agent (internal note: this is going to map with Context.USER_AGENT)
      • X-Browser (internal note: this is going to map with Context.BROWSER)
      • X-Cookies (internal note: this is going to map with Context.COOKIES)
      • X-Device-Brand (internal note: this is going to map with Context.DEVICE_BRAND)
      • X-Device-Model (internal note: this is going to map with Context.DEVICE_MODEL)
      • X-Device-Screen-Resolution-Height (internal note: this is going to map with Context.DEVICE_SCREEN_RESOLUTION_HEIGHT)
      • X-Device-Screen-Resolution-Width (internal note: this is going to map with Context.DEVICE_SCREEN_RESOLUTION_WIDTH)
      • X-Last-Sign-In-Date-Time (internal note: this is going to map with Context.LAST_SIGN_IN_DATE_TIME)
      • X-Signed-In (internal note: this is going to map with Context.SIGNED_IN)
      • (internal note: Context.LOCAL_DATE is always present in the context)

      Tests

      Acceptance Criteria

      • If the user introduces the wrong endpoint, 404 error shows up.
      • If the user introduces the wrong credentials to the request, 403 error shows up.
      • If the user introduces a wrong contentSetId, 404 error shows up with this message: No AssetListEntry exists with the primary key 37002.
      • If the user does not belong to any segment, the default variation should be retrieved.
      • If the user belongs to a segment, and there is no variation for that segment, default variation should be retrieved.
      • If the user belongs to several segments, the API should retrieve the first variation that conforms the request.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  Master