Create

POST /users

To add Users to your Account, you need to create them with a Membership. Memberships accept a type attribute of admin, support, or user. These different types offer varying levels of permissions across the app. The user type is for standard users, whereas admin and support types allow users with those memberships to lock and restrict account settings for all users with memberships to a given account.

Examples

Creating new user

Request

POST /users

Body

{
  "name": "Eddie",
  "email": "edmund@bravo.com",
  "memberships": [
    {
      "account": "/accounts/my_account",
      "role":    "admin"
    }
  ]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X POST /users
    -d '{
  "name": "Eddie",
  "email": "edmund@bravo.com",
  "memberships": [
    {
      "account": "/accounts/my_account",
      "role":    "admin"
    }
  ]
}'

Response

Status

201

Response Type

User

Example Body

{
  "@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
  }
}

© 2024 TextUs