Users

GET /users{?q,accounts[]}

Admins may retrieve a list of all Users that belong to accounts at which they are an admin. They may limit this list so specific Accounts, or by a q param that searches by name or email.

Examples

Getting a list of users

Request

GET /users
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X GET /users
    

Response

Status

200

Response Type

hydra:Collection

Example Body

{
  "@type": "hydra:Collection",
  "@context": "/contexts/hydra:Collection.jsonld",
  "id": "/users",
  "members": [
    {
      "@type": "User",
      "@context": "/contexts/User.jsonld",
      "id": "/users/wqyODPA",
      "name": "Chuck Norris",
      "firstName": "Chuck",
      "lastName": "Norris",
      "email": "chuck@textus.example",
      "avatar": null,
      "automatedActor": false,
      "hasPassword": false,
      "discarded": false,
      "settings": {
        "customSettings": {}
      },
      "memberships": {
        "@type": "hydra:Collection",
        "@context": "/contexts/hydra:Collection.jsonld",
        "id": "/users/wqyODPA/memberships",
        "members": [
          {
            "@type": "Membership",
            "@context": "/contexts/Membership.jsonld",
            "id": "/users/wqyODPA/memberships/PWApBE3",
            "role": "user",
            "user": "/users/wqyODPA",
            "account": {
              "@type": "Account",
              "@context": "/contexts/Account.jsonld",
              "id": "/accounts/my_account",
              "name": "Example Account"
            }
          }
        ],
        "totalItems": 1
      }
    }
  ],
  "totalItems": 1,
  "view": {
    "@type": "hydra:PartialCollectionView",
    "@context": "/contexts/hydra:PartialCollectionView.jsonld",
    "id": "/users",
    "first": "/users",
    "next": null,
    "previous": null
  }
}

Searching for users by name or email

Request

GET /users?q=chuck
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X GET /users?q=chuck
    

Response

Status

200

Response Type

hydra:Collection

Example Body

{
  "@type": "hydra:Collection",
  "@context": "/contexts/hydra:Collection.jsonld",
  "id": "/users?q=chuck",
  "members": [
    {
      "@type": "User",
      "@context": "/contexts/User.jsonld",
      "id": "/users/wqyODPA",
      "name": "Chuck Norris",
      "firstName": "Chuck",
      "lastName": "Norris",
      "email": "chuck@textus.example",
      "avatar": null,
      "automatedActor": false,
      "hasPassword": false,
      "discarded": false,
      "settings": {
        "customSettings": {}
      },
      "memberships": {
        "@type": "hydra:Collection",
        "@context": "/contexts/hydra:Collection.jsonld",
        "id": "/users/wqyODPA/memberships",
        "members": [
          {
            "@type": "Membership",
            "@context": "/contexts/Membership.jsonld",
            "id": "/users/wqyODPA/memberships/PWApBE3",
            "role": "user",
            "user": "/users/wqyODPA",
            "account": {
              "@type": "Account",
              "@context": "/contexts/Account.jsonld",
              "id": "/accounts/my_account",
              "name": "Example Account"
            }
          }
        ],
        "totalItems": 1
      }
    }
  ],
  "totalItems": 1,
  "view": {
    "@type": "hydra:PartialCollectionView",
    "@context": "/contexts/hydra:PartialCollectionView.jsonld",
    "id": "/users?q=chuck",
    "first": "/users?q=chuck",
    "next": null,
    "previous": null
  }
}

Searching for users by account

Request

GET /users?accounts[]=/accounts/my_account
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X GET /users?accounts[]=/accounts/my_account
    

Response

Status

200

Response Type

hydra:Collection

Example Body

{
  "@type": "hydra:Collection",
  "@context": "/contexts/hydra:Collection.jsonld",
  "id": "/users?accounts[]=/accounts/my_account",
  "members": [
    {
      "@type": "User",
      "@context": "/contexts/User.jsonld",
      "id": "/users/wqyODPA",
      "name": "Chuck Norris",
      "firstName": "Chuck",
      "lastName": "Norris",
      "email": "chuck@textus.example",
      "avatar": null,
      "automatedActor": false,
      "hasPassword": false,
      "discarded": false,
      "settings": {
        "customSettings": {}
      },
      "memberships": {
        "@type": "hydra:Collection",
        "@context": "/contexts/hydra:Collection.jsonld",
        "id": "/users/wqyODPA/memberships",
        "members": [
          {
            "@type": "Membership",
            "@context": "/contexts/Membership.jsonld",
            "id": "/users/wqyODPA/memberships/PWApBE3",
            "role": "user",
            "user": "/users/wqyODPA",
            "account": {
              "@type": "Account",
              "@context": "/contexts/Account.jsonld",
              "id": "/accounts/my_account",
              "name": "Example Account"
            }
          }
        ],
        "totalItems": 1
      }
    }
  ],
  "totalItems": 1,
  "view": {
    "@type": "hydra:PartialCollectionView",
    "@context": "/contexts/hydra:PartialCollectionView.jsonld",
    "id": "/users?accounts[]=/accounts/my_account",
    "first": "/users?accounts[]=/accounts/my_account",
    "next": null,
    "previous": null
  }
}

Table of contents


© 2024 TextUs