Principals

Principals#

This endpoint will search for all the available principals in the local PAS plugins when given a query string. We define a principal as any user or group in the system. This endpoint requires an authenticated user.

Search Principals#

To retrieve a list of principals given a search string, call the /@principals endpoint with a GET request and a search query parameter:

http

GET /plone/@principals?search=ploneteam HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X GET 'http://nohost/plone/@principals?search=ploneteam' -H "Accept: application/json" --user admin:secret

httpie

http 'http://nohost/plone/@principals?search=ploneteam' Accept:application/json -a admin:secret

python-requests

requests.get('http://nohost/plone/@principals?search=ploneteam', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))

The server will respond with a list of the users and groups in the portal that match the query string:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "groups": [
        {
            "@id": "http://localhost:55001/plone/@groups/ploneteam",
            "description": "We are Plone",
            "email": "ploneteam@plone.org",
            "groupname": "ploneteam",
            "id": "ploneteam",
            "roles": [
                "Authenticated"
            ],
            "title": "Plone Team"
        }
    ],
    "users": []
}