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

As a developer, I can obtain content space segments using a headless API

    Details

      Description

      Create a headless API to retrieve the segments of a given site.

      To try this:

      curl -u username:password -D - http://localhost:8080/o/headless-admin-user/v1.0/sites/{site-id}/segments
      

      For example:

      curl -u test@liferay.com:test -D - http://localhost:8080/o/headless-admin-user/v1.0/sites/20126/segments
      

      Response:

      {
        "items" : [ {
          "active" : true,
          "criteria" : "{\"criteria\":{\"user\":{\"conjunction\":\"and\",\"filterString\":\"(contains(emailAddress, 'liferay'))\",\"typeValue\":\"model\"}}}",
          "dateCreated" : "2019-03-07T08:09:25Z",
          "dateModified" : "2019-03-07T08:09:25Z",
          "id" : 37069,
          "name" : "Liferay segment",
          "source" : "DEFAULT"
        }, {
          "active" : true,
          "criteria" : "",
          "dateCreated" : "2019-03-07T08:01:57Z",
          "dateModified" : "2019-03-07T08:01:57Z",
          "id" : 23205,
          "name" : "Anyone",
          "source" : "DEFAULT"
        } ],
        "lastPage" : 1,
        "page" : 1,
        "pageSize" : 20,
        "totalCount" : 2
      }
      

      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 siteId, 404 error shows up with this message: Unable to get a valid site with ID 12345.
      • As an admin user, I can list all the segments of a site.
      • As a regular user, if I don't have permissions to see the segments lists, I can' list all the segments of a site.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                manoel.cyreno Manoel Cyreno
                Reporter:
                sarai.diaz Sarai Diaz
                Recent user:
                Manoel Cyreno
                Participants of an Issue:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  Master